Continued to lesson 15
This commit is contained in:
Executable
BIN
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
|
||||
; %include '../lib/fl.asm' ; local
|
||||
%include 'lib/fl.asm' ; build.sh
|
||||
|
||||
SECTION .text
|
||||
global _start
|
||||
|
||||
_start:
|
||||
mov ecx, 0
|
||||
|
||||
nextNumber:
|
||||
inc ecx
|
||||
mov eax, ecx
|
||||
call iprintLF
|
||||
cmp ecx, 10
|
||||
jne nextNumber
|
||||
|
||||
call quit
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
; %include '../lib/fl.asm' ; local
|
||||
%include 'lib/fl.asm' ; build.sh
|
||||
|
||||
SECTION .text
|
||||
global _start
|
||||
|
||||
_start:
|
||||
mov eax, 90
|
||||
mov ebx, 9
|
||||
add eax, ebx
|
||||
call iprintLF
|
||||
|
||||
call quit
|
||||
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
; %include '../lib/fl.asm' ; local
|
||||
%include 'lib/fl.asm' ; build.sh
|
||||
|
||||
SECTION .text
|
||||
global _start
|
||||
|
||||
_start:
|
||||
mov eax, 90
|
||||
mov ebx, 9
|
||||
sub eax, ebx
|
||||
call iprintLF
|
||||
|
||||
call quit
|
||||
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
; %include '../lib/fl.asm' ; local
|
||||
%include 'lib/fl.asm' ; build.sh
|
||||
|
||||
SECTION .text
|
||||
global _start
|
||||
|
||||
_start:
|
||||
mov eax, 90
|
||||
mov ebx, 9
|
||||
mul ebx
|
||||
call iprintLF
|
||||
|
||||
call quit
|
||||
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
|
||||
; %include '../lib/fl.asm' ; local
|
||||
%include 'lib/fl.asm' ; build.sh
|
||||
|
||||
SECTION .data
|
||||
msg1 db ' remainder '
|
||||
|
||||
SECTION .text
|
||||
global _start
|
||||
|
||||
_start:
|
||||
mov eax, 90
|
||||
mov ebx, 9
|
||||
div ebx
|
||||
call iprint
|
||||
mov eax, msg1
|
||||
call sprint
|
||||
mov eax, edx
|
||||
call iprintLF
|
||||
|
||||
call quit
|
||||
Binary file not shown.
+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