Continued to lesson 15
This commit is contained in:
parent
6a824fbbda
commit
8d471b77f7
BIN
lesson11/l11
Executable file
BIN
lesson11/l11
Executable file
Binary file not shown.
18
lesson11/l11.asm
Normal file
18
lesson11/l11.asm
Normal file
@ -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
|
||||
BIN
lesson11/l11.o
Normal file
BIN
lesson11/l11.o
Normal file
Binary file not shown.
BIN
lesson12/l12
Executable file
BIN
lesson12/l12
Executable file
Binary file not shown.
15
lesson12/l12.asm
Normal file
15
lesson12/l12.asm
Normal file
@ -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
|
||||
|
||||
BIN
lesson12/l12.o
Normal file
BIN
lesson12/l12.o
Normal file
Binary file not shown.
BIN
lesson13/l13
Executable file
BIN
lesson13/l13
Executable file
Binary file not shown.
15
lesson13/l13.asm
Normal file
15
lesson13/l13.asm
Normal file
@ -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
|
||||
|
||||
BIN
lesson13/l13.o
Normal file
BIN
lesson13/l13.o
Normal file
Binary file not shown.
BIN
lesson14/l14
Executable file
BIN
lesson14/l14
Executable file
Binary file not shown.
15
lesson14/l14.asm
Normal file
15
lesson14/l14.asm
Normal file
@ -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
|
||||
|
||||
BIN
lesson14/l14.o
Normal file
BIN
lesson14/l14.o
Normal file
Binary file not shown.
BIN
lesson15/l15
Executable file
BIN
lesson15/l15
Executable file
Binary file not shown.
21
lesson15/l15.asm
Normal file
21
lesson15/l15.asm
Normal file
@ -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
|
||||
BIN
lesson15/l15.o
Normal file
BIN
lesson15/l15.o
Normal file
Binary file not shown.
53
lib/fl.asm
53
lib/fl.asm
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user