Passing the strings to string prints through stack

This commit is contained in:
Jarkko Toivanen 2023-07-24 05:17:57 +03:00
parent e2572d50af
commit 9fc1cd0064
Signed by: jt
GPG key ID: 9151B109B73ECAD5
2 changed files with 12 additions and 4 deletions

View file

@ -58,9 +58,11 @@ serialinit:
ret ret
serialwrite: serialwrite:
push ebp
mov ebp, esp
pushad pushad
cld cld
mov esi, stuff.bootmsg mov esi, [ebp+8]
.loop: .loop:
mov dx, SERIAL_PORT+5 mov dx, SERIAL_PORT+5
.wait: .wait:
@ -75,6 +77,7 @@ serialwrite:
jmp .loop jmp .loop
.done: .done:
popad popad
pop ebp
ret ret
serialiniterror: serialiniterror:

View file

@ -38,10 +38,11 @@ start:
mov byte [0xb8000], '!' mov byte [0xb8000], '!'
mov esi, stuff.bootmsg push stuff.bootmsg
call serialinit
call printbootmsg call printbootmsg
call serialinit
call serialwrite call serialwrite
add esp, 4
jmp hang jmp hang
@ -66,7 +67,10 @@ multibootnomagic:
.msg db "No multiboot magic", 0 .msg db "No multiboot magic", 0
printbootmsg: printbootmsg:
push ebp
mov ebp, esp
pushad pushad
mov esi, [ebp+8]
mov edi, 0xb8000 mov edi, 0xb8000
cld cld
.loop: .loop:
@ -78,12 +82,13 @@ printbootmsg:
jmp .loop jmp .loop
.done: .done:
popad popad
pop ebp
ret ret
include "src/serial.asm" include "src/serial.asm"
stuff: stuff:
.bootmsg db "=== KoalemOS ===", 0 .bootmsg db "=== KoalemOS ===", 10, 0
stack_bottom: stack_bottom: