string.parse_int added, fixed print.int
This commit is contained in:
Binary file not shown.
+30
-1
@@ -5,6 +5,7 @@ extrn print.int
|
||||
extrn print.bin
|
||||
extrn print.str
|
||||
extrn print.nl
|
||||
extrn string.parse_int
|
||||
extrn exit
|
||||
|
||||
macro nl {
|
||||
@@ -13,7 +14,13 @@ macro nl {
|
||||
|
||||
|
||||
section '.strtab'
|
||||
str1 db "Hello world!", 0
|
||||
str1 db "Hello world!", 10, 0
|
||||
str2 db "Enter the number: ", 0
|
||||
str3 db " + 10 = ", 0
|
||||
|
||||
|
||||
section '.bss' writeable
|
||||
buffer rb 11
|
||||
|
||||
|
||||
section '.text' executable
|
||||
@@ -28,6 +35,28 @@ _start:
|
||||
|
||||
push str1
|
||||
call print.str
|
||||
|
||||
push str2
|
||||
call print.str
|
||||
mov eax, 3
|
||||
mov ebx, 0
|
||||
mov ecx, buffer
|
||||
mov edx, 11
|
||||
int 80h
|
||||
|
||||
mov [buffer+eax-1], 0
|
||||
|
||||
push buffer
|
||||
call print.str
|
||||
push str3
|
||||
call print.str
|
||||
|
||||
push buffer
|
||||
call string.parse_int
|
||||
pop eax
|
||||
add eax, 10
|
||||
push eax
|
||||
call print.int
|
||||
nl
|
||||
|
||||
call exit
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
all: main
|
||||
|
||||
main: ../../std.o main.o
|
||||
ld -m elf_i386 main.o ../../std.o --output main
|
||||
main: ../../std.o ../../string.o main.o
|
||||
ld -m elf_i386 main.o ../../std.o ../../string.o --output main
|
||||
|
||||
main.o:
|
||||
fasm main.asm
|
||||
@@ -9,5 +9,8 @@ main.o:
|
||||
../../std.o:
|
||||
make -C ../../ std.o
|
||||
|
||||
../../string.o:
|
||||
make -C ../../ string.o
|
||||
|
||||
clear:
|
||||
rm main.o main
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user