section .data
new_line db 10
msg1 db "prva"
msg2 db "druga"
msg3 db "treca"
msg4 db "cetvrta"
section .bss
digits resb 8
base resb 8
section .text
global _start
_start:
call _print_msg1
call _end
_print_msg1:
mov rax, 1
mov rdi, 1
mov rsi, msg1
mov rdx, 4
syscall
call _print_new_line
call _print_digits_rbp
call _print_msg2
ret
_print_msg2:
mov rax, 1
mov rdi, 1
mov rsi, msg2
mov rdx, 5
syscall
call _print_new_line
call _print_digits_rbp
call _print_msg3
ret
_print_msg3:
mov rax, 1
mov rdi, 1
mov rsi, msg3
mov rdx, 5
syscall
call _print_new_line
call _print_digits_rbp
call _print_msg4
ret
_print_msg4:
mov rax, 1
mov rdi, 1
mov rsi, msg4
mov rdx, 7
syscall
call _print_new_line
call _print_digits_rbp
ret
_print_digits_rbp:
mov rax, rsp
_print_digits_rax:
mov rbx, 10
mov rcx, digits
mov rdx, 10
mov [digits], rdx
call _loop_rax
mov rbx, 0
call _loop_rcx
call _print_new_line
ret
_loop_rcx:
mov rax, 1
mov rdi, 1
mov rsi, rcx
mov rdx, 1
push rcx
syscall
pop rcx
dec rcx
cmp rcx, digits
jne _loop_rcx
ret
_loop_rax:
inc rcx
mov rdx, 0
div rbx
add rdx, 48
mov [rcx], rdx
cmp rax, 0
jne _loop_rax
ret
_print_new_line:
mov rax, 1
mov rdi, 1
mov rsi, new_line
mov rdx, 1
syscall
ret
_end:
mov rax, 60
mov rdi, 0
syscall
To embed this project on your website, copy the following code and paste it into your website's HTML: