diff --git a/src/framebuffer.asm b/src/framebuffer.asm index e7168b0..e58e16e 100644 --- a/src/framebuffer.asm +++ b/src/framebuffer.asm @@ -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 diff --git a/src/itoa.asm b/src/itoa.asm index 914b214..429f9cf 100644 --- a/src/itoa.asm +++ b/src/itoa.asm @@ -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 diff --git a/src/serial.asm b/src/serial.asm index c46b511..2699f01 100644 --- a/src/serial.asm +++ b/src/serial.asm @@ -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 diff --git a/src/start32.asm b/src/start32.asm index b6cb689..b72db5e 100644 --- a/src/start32.asm +++ b/src/start32.asm @@ -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