|
|
@@ -10,8 +10,8 @@ section .bss
|
|
|
num resb 4 ;4 byte for ascii numbers
|
|
|
|
|
|
section .data
|
|
|
- ha dw 0 ;hundreds
|
|
|
- ta dw 0 ;tens
|
|
|
+ ha db 0 ;hundreds
|
|
|
+ ta db 0 ;tens
|
|
|
|
|
|
section .text
|
|
|
global _start
|
|
|
@@ -24,12 +24,12 @@ _start:
|
|
|
mov edx, sz ; target struct
|
|
|
int 0x80 ; call kernel
|
|
|
|
|
|
- ;mov [ha], dword 0x0
|
|
|
- ;mov [ta], dword 0x0
|
|
|
|
|
|
; print rows
|
|
|
-hundreds:
|
|
|
+
|
|
|
mov ecx, [sz+0] ;rows in ecx
|
|
|
+
|
|
|
+hundreds:
|
|
|
cmp ecx, 100 ;check if above 100
|
|
|
jge inchundred ;jump to increment hundreds if needed
|
|
|
|
|
|
@@ -48,7 +48,7 @@ tens:
|
|
|
mov eax, ecx
|
|
|
add eax, '0'
|
|
|
mov [num+2], eax
|
|
|
- mov [num+3], dword 0xa ;linebreak
|
|
|
+ mov [num+3], byte 0xa ;linebreak
|
|
|
|
|
|
mov eax, SYS_WRITE
|
|
|
mov ebx, STDOUT
|
|
|
@@ -58,8 +58,6 @@ tens:
|
|
|
|
|
|
; print cols
|
|
|
|
|
|
- ;add [sz+2],'0'
|
|
|
-
|
|
|
mov eax, SYS_WRITE
|
|
|
mov ebx, STDOUT
|
|
|
mov ecx, sz+2
|
|
|
@@ -73,11 +71,11 @@ exit:
|
|
|
int 0x80
|
|
|
|
|
|
inchundred:
|
|
|
- inc dword [ha] ;increment hundreds
|
|
|
+ inc byte [ha] ;increment hundreds
|
|
|
sub ecx, 100
|
|
|
jmp hundreds
|
|
|
|
|
|
inctens:
|
|
|
- inc dword [ta] ;increment hundreds
|
|
|
+ inc byte [ta] ;increment tens
|
|
|
sub ecx, 10
|
|
|
jmp tens
|