Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .text
- global _main ; must be declared for linker (gcc)
- _main: ; tell linker entry point
- mov rdx, len ; message length
- mov rcx, msg ; message to write
- mov rbx, 1 ; file descriptor (stdout)
- mov rax, 4 ; system call number (sys_write)
- syscall
- mov rdx, 9 ; message length
- mov rcx, s2 ; message to write
- mov rbx, 1 ; file descriptor (stdout)
- mov rax, 4 ; system call number (sys_write)
- syscall
- mov rax, 1 ; system call number (sys_exit)
- syscall
- section .data
- msg: db 'Displaying 9 stars',0xa ; a message
- len: equ $ - msg ; length of message
- s2: times 9 db '*'
- $ nasm -f macho64 ninestars.asm
- $ ld -macosx_version_min 10.14 -lSystem -o ninestars ninestars.o
- $ ./ninestars
- Bus error: 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement