Skip to content

Instantly share code, notes, and snippets.

@edg-l
Created September 7, 2023 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edg-l/63cba75c38a61b1b55052ea07bd84b26 to your computer and use it in GitHub Desktop.
Save edg-l/63cba75c38a61b1b55052ea07bd84b26 to your computer and use it in GitHub Desktop.
global _start
section .text
stdout equ 1
_start:
mov r8, 1 ; initial line length
mov r9, 0 ; chars written
mov rdx, buffer
line:
mov byte [rdx], '*'
inc rdx
inc r9
cmp r9, r8 ; check if number of written stars is same as needed
jne line
lineDone:
mov byte [rdx], `\n`
inc rdx
inc r8
mov r9, 0
cmp r8, maxlines
jng line
print:
mov byte [rdx], `\n`
inc rdx
sub rdx, buffer
mov rax, 1
mov rdi, stdout
mov rsi, buffer
syscall
mov rax, 60 ; system call for exit
xor rdi, rdi ; exit code 0
syscall
section .bss
maxlines equ 8
buffer_size equ 64
buffer: resb buffer_size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment