diff --git a/main.asm b/main.asm index 4897e56..cc81c2a 100644 --- a/main.asm +++ b/main.asm @@ -5,7 +5,7 @@ section KERNEL follows=BOOTSECTOR vstart=1000h main: - mov bx, 24734 + mov bx, 65535 call print_uint jmp $ ; Halt diff --git a/main.bin b/main.bin index 7530319..d02d440 100644 Binary files a/main.bin and b/main.bin differ diff --git a/print_util.asm b/print_util.asm index 42a37ab..b86f3ed 100644 --- a/print_util.asm +++ b/print_util.asm @@ -124,24 +124,30 @@ print_uint: pusha mov ax, bx ; Move number into ax - - mov bx, _print_dec_buff+5 ; Place in the buffer + mov bx, 0 .loop: - sub bx, 1 mov cx, 10 mov dx, 0 ; IMPORTANT: Division will not work unless the remainder register is set to 0 beforehand div cx ; Divide ax by cx (10), -> ax, rem -> dx add dx, 0x30 ; Add ascii '0' - mov [bx], dx ; Place that value into the buffer + push dx ; Push that value + add bx, 1 cmp ax, 0 ; Continue looping as long as the quotient is not 0 jnz .loop - ; Print the contents of the buffer - ; String is already in bx - call print + .print_loop: + sub bx, 1 + + pop ax ; 16-bit value + mov ah, 0x0e + ;add al, 0x30 + int 0x10 + + cmp bx, 0 + jnz .print_loop popa ret