Follow C calling convention (futureproofing) and utilize macros
This commit is contained in:
parent
32ccb3abd1
commit
7a22e4aed7
4 changed files with 115 additions and 156 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue