Merge pull request #1 from E-Almqvist/dev

Pull dev branch
pull/3/head
E. Almqvist 4 years ago committed by GitHub
commit c719b094c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 55
      src/bootloader.asm
  2. 42
      src/elib/io.asm

@ -1,50 +1,21 @@
%include "equ/BIOS.asm" [org 0x7c00] ; bootsector
%include "equ/ASCII.asm"
mov ah, BIOS_MODE_TELETYPE ; enter teletype mode (BIOS)
mov al, ASCII_LINEBREAK ; linebreak
int BIOS_INT
; Print "eOS"
mov al, "e"
int BIOS_INT
mov al, "O"
int BIOS_INT
mov al, "S" mov bx, welcomeString ; Print the welcome string
int BIOS_INT call println
mov al, ASCII_CARRIAGE_RETURN jmp $ ; inf loop
int BIOS_INT
mov al, ASCII_LINEBREAK ; linebreak ;; includes
int BIOS_INT ; EQU
%include "equ/BIOS.asm"
; ALPHABET PRINT %include "equ/ASCII.asm"
mov al, 64 ; one less than A since we are printing in a loop and it increments before sys interupt
loop:
; Print the alphabetic char
inc al ; move to next char
int BIOS_INT ; bios interupt to print it
push ax ; push ax onto stack
; newline
mov al, ASCII_CARRIAGE_RETURN
int BIOS_INT
mov al, ASCII_LINEBREAK
int BIOS_INT
; Prepair for next iteration
pop ax ; restore
cmp al, 90 ; 26 letters in english alphabet (64 + 26)
jl loop ; if al < 64+26: jmp loop
; eLIB
%include "elib/io.asm"
jmp $ ;; Data
welcomeString: db "Welcome to eOS", ASCII_END
; Magic BIOS number
times 510-($-$$) db 0 times 510-($-$$) db 0
db 0x55, 0xaa db 0x55, 0xaa

@ -1,2 +1,42 @@
; eLibrary ; eLibrary
; Input/Output sr ; Input/Output subroutines
; Subroutine to print a string
print:
pusha ; save current state of registers
printLoop:
; Char check
mov al, [bx] ; load the char
cmp al, ASCII_END ; check if end of string
je return ; if al == ASCII_END then return end | lua is good psuedo-code
; BIOS Printing
mov ah, BIOS_MODE_TELETYPE ; enter tty mode
int BIOS_INT ; interupt and print the char (from line 10)
; Preperation for next iteration
inc bx ; increment the pointer to get next char
jmp printLoop ; repeat
return:
popa ; restore all registers
ret ; return to previous location
newline: db ASCII_CARRIAGE_RETURN, ASCII_LINEBREAK, ASCII_END ; used for printing newlines
; Subroutine to print a string on a new line
println:
pusha
; Print the input string
call print ; this will print whatever is in [bx], so clear it if you dont want to print anything
; Print the newline
mov bx, newline
call print
popa
ret

Loading…
Cancel
Save