More and advanceder macros

This commit is contained in:
Jarkko Toivanen 2024-08-17 06:21:47 +03:00
parent 7a22e4aed7
commit c2e69b6f7f
Signed by: jt
GPG key ID: 9151B109B73ECAD5
4 changed files with 37 additions and 98 deletions

View file

@ -1,4 +1,4 @@
macro kputpixel x, y, r, g, b {
macro kputpixel x*, y*, r*, g*, b* {
push b ;b
push g ;g
push r ;r

View file

@ -26,6 +26,14 @@
; ECX: Target address (active)
; EDX: Target address (temporary)
;
macro kuitoa src*, dest*, base* {
push dest
push base
push src
call __uitoa
add esp, 3*4
}
__uitoa:
.start:
push ebp

View file

@ -2,7 +2,7 @@ SERIAL_PORT equ 0x3f8
serialinitialized db 0
; Write null terminated string in address str_pointer to serial
macro serw str_pointer {
macro serw [str_pointer*] {
push str_pointer
call serialwrite
add esp, 4

View file

@ -51,114 +51,46 @@ start:
call mbootgetinfo
add esp, 2*4
serw stuff.fbaddrmsgpfx
sub esp, 36 ;Reserve stack for return
push dword esp ;Destination address
push dword 16 ;Base
push dword [mbootinfo.fb_addr] ;source
call __uitoa
add esp, 3*4
serw esp
kuitoa [mbootinfo.fb_addr], esp, 16
serw stuff.fbaddrmsgpfx, esp
serw stuff.fbdimensionsmsgpfx
push dword esp ;destination address
push dword 10 ;base
push dword [mbootinfo.fb_width]
call __uitoa
add esp, 3*4
serw esp
serw stuff.x
kuitoa [mbootinfo.fb_width], esp, 10
serw stuff.fbdimensionsmsgpfx, esp, stuff.x
push dword esp ;destination address
push dword 10 ;base
push dword [mbootinfo.fb_height]
call __uitoa
add esp, 3*4
serw esp
serw stuff.x
kuitoa [mbootinfo.fb_height], esp, 10
serw esp, stuff.x
push dword esp ;destination address
push dword 10 ;base
xor eax, eax
mov al, [mbootinfo.fb_bpp]
push dword eax
call __uitoa
add esp, 3*4
movzx eax, byte [mbootinfo.fb_bpp]
kuitoa eax, esp, 10
serw esp
serw stuff.rpostxt
movzx eax, byte [mbootinfo.fb_rpos]
kuitoa eax, esp, 10
serw stuff.rpostxt, esp
push dword esp
push dword 10
xor eax, eax
mov al, [mbootinfo.fb_rpos]
push dword eax
call __uitoa
add esp, 3*4
serw esp
movzx eax, byte [mbootinfo.fb_gpos]
kuitoa eax, esp, 10
serw stuff.gpostxt, esp
serw stuff.gpostxt
push dword esp
push dword 10
xor eax, eax
mov al, [mbootinfo.fb_gpos]
push dword eax
call __uitoa
add esp, 3*4
serw esp
serw stuff.bpostxt
push dword esp
push dword 10
xor eax, eax
mov al, [mbootinfo.fb_bpos]
push dword eax
call __uitoa
add esp, 3*4
serw esp
movzx eax, byte [mbootinfo.fb_bpos]
kuitoa eax, esp, 10
serw stuff.bpostxt, esp
push stuff.rmasksizetxt
call serialwrite
add esp, 4
movzx eax, byte [mbootinfo.fb_rmasksize]
kuitoa eax, esp, 10
serw stuff.rmasksizetxt, esp
push dword esp
push dword 10
xor eax, eax
mov al, [mbootinfo.fb_rmasksize]
push dword eax
call __uitoa
add esp, 3*4
serw esp
movzx eax, byte [mbootinfo.fb_gmasksize]
kuitoa eax, esp, 10
serw stuff.gmasksizetxt, esp
push stuff.gmasksizetxt
call serialwrite
add esp, 4
push dword esp
push dword 10
xor eax, eax
mov al, [mbootinfo.fb_gmasksize]
push dword eax
call __uitoa
add esp, 3*4
serw esp
serw stuff.bmasksizetxt
push dword esp
push dword 10
xor eax, eax
mov al, [mbootinfo.fb_bmasksize]
push dword eax
call __uitoa
add esp, 3*4
serw esp
movzx eax, byte [mbootinfo.fb_bmasksize]
kuitoa eax, esp, 10
serw stuff.bmasksizetxt, esp
add esp, 36 ;Clean reserved uitoa return string from stack
@ -193,8 +125,7 @@ jmp hang
hang:
push .msg
call serialwrite
serw .msg
cli
.loop:
hlt