1
1
Fork 0

Follow C calling convention (futureproofing) and utilize macros

This commit is contained in:
Lauren Toivanen 2024-08-17 00:37:07 +03:00
parent 32ccb3abd1
commit 7a22e4aed7
Signed by: jt
GPG key ID: 9151B109B73ECAD5
4 changed files with 115 additions and 156 deletions

View file

@ -1,9 +1,14 @@
SERIAL_PORT equ 0x3f8
serialinitialized db 0
serialinit:
push ax
; Write null terminated string in address str_pointer to serial
macro serw str_pointer {
push str_pointer
call serialwrite
add esp, 4
}
serialinit:
;Disable ints
mov dx, SERIAL_PORT+1
mov al, 0x00
@ -54,7 +59,6 @@ serialinit:
out dx, al
mov [serialinitialized], 1
.end:
pop ax
ret
.errormsg db "Serial init failed", 0
@ -64,7 +68,6 @@ serialwrite:
push ebp
mov ebp, esp
push esi
push ax
cld
mov esi, [ebp+8]
.loop:
@ -80,7 +83,6 @@ serialwrite:
out dx, al
jmp .loop
.done:
pop ax
pop esi
pop ebp
ret