728x90
반응형
SMALL
별을 찍어보자
파일은 starprint.asm
global main, _start
section .bss
buffer: resb 128
section .data
star: db 0x2a
gehang: db 0xa
section .text
_start:
main:
push rbp
mov rbp, rsp
sub rsp, 16
mov rax, 0
mov rdi, 0
lea rsi, [rbp-12]
mov rdx, 1
syscall
sub DWORD [rbp-12], 0x30
mov rax, [rbp-12]
and rax, 1
test rax, rax
jne L2
mov rax, 60
mov rdi, 0
syscall
L2:
mov DWORD [rbp-4], 0
jmp L3
L6:
mov DWORD [rbp-8], 1
jmp L4
L5:
mov rax, 1
mov rdi, 1
mov rsi, star
mov rdx, 1
syscall
add DWORD [rbp-8], 1
L4:
mov eax, [rbp-8]
cmp eax, [rbp-4]
jle L5
mov rax, 1
mov rdi, 1
mov rsi, gehang
mov rdx, 1
syscall
add DWORD [rbp-4], 1
L3:
mov eax, [rbp-12]
cmp [rbp-4], eax
jle L6
mov rax, 60
mov rdi, 0
syscall
leave
ret
반응형
LIST