This repository has been archived on 2025-01-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2022-11-06 13:51:51 +03:00
|
|
|
format ELF
|
|
|
|
|
public _start
|
|
|
|
|
|
|
|
|
|
extrn print.int
|
|
|
|
|
extrn print.bin
|
|
|
|
|
extrn print.str
|
|
|
|
|
extrn print.nl
|
2022-11-12 19:14:56 +03:00
|
|
|
extrn string.parse_int
|
2022-11-06 13:51:51 +03:00
|
|
|
extrn exit
|
|
|
|
|
|
|
|
|
|
macro nl {
|
2022-11-06 18:21:21 +03:00
|
|
|
call print.nl
|
2022-11-06 13:51:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
section '.strtab'
|
2022-11-12 19:14:56 +03:00
|
|
|
str1 db "Hello world!", 10, 0
|
|
|
|
|
str2 db "Enter the number: ", 0
|
|
|
|
|
str3 db " + 10 = ", 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
section '.bss' writeable
|
|
|
|
|
buffer rb 11
|
2022-11-06 13:51:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
section '.text' executable
|
|
|
|
|
_start:
|
2022-11-06 18:21:21 +03:00
|
|
|
push dword 123
|
|
|
|
|
call print.int
|
|
|
|
|
nl
|
2022-11-06 13:51:51 +03:00
|
|
|
|
2022-11-06 18:21:21 +03:00
|
|
|
push dword 123
|
|
|
|
|
call print.bin
|
|
|
|
|
nl
|
2022-11-06 13:51:51 +03:00
|
|
|
|
2022-11-06 18:21:21 +03:00
|
|
|
push str1
|
|
|
|
|
call print.str
|
2022-11-12 19:14:56 +03:00
|
|
|
|
|
|
|
|
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
|
2022-11-06 18:21:21 +03:00
|
|
|
nl
|
2022-11-06 13:51:51 +03:00
|
|
|
|
2022-11-06 18:21:21 +03:00
|
|
|
call exit
|