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 b ;b
push g ;g push g ;g
push r ;r push r ;r

View file

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

View file

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

View file

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