Continued to lesson 15
This commit is contained in:
+53
@@ -1,3 +1,56 @@
|
||||
;------------------------------------------
|
||||
; void iprint(Integer number)
|
||||
; Integer printing function (itoa)
|
||||
iprint:
|
||||
push eax
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
mov ecx, 0
|
||||
|
||||
divideLoop:
|
||||
inc ecx
|
||||
mov edx, 0
|
||||
mov esi, 10
|
||||
idiv esi
|
||||
add edx, 48
|
||||
push edx
|
||||
cmp eax, 0
|
||||
jnz divideLoop
|
||||
|
||||
printLoop:
|
||||
dec ecx
|
||||
mov eax, esp
|
||||
call sprint
|
||||
pop eax
|
||||
cmp ecx, 0
|
||||
jnz printLoop
|
||||
|
||||
pop esi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;------------------------------------------
|
||||
; void iprintLF(Integer number)
|
||||
; Integer printing function with linefeed (itoa)
|
||||
iprintLF:
|
||||
call iprint
|
||||
|
||||
push eax
|
||||
mov eax, 0Ah
|
||||
push eax
|
||||
mov eax, esp
|
||||
call sprint
|
||||
pop eax
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;------------------------------------------
|
||||
; int slen(String message)
|
||||
; String length calculation function
|
||||
|
||||
Reference in New Issue
Block a user