Skip to content

Instantly share code, notes, and snippets.

@suqdiq
Created April 15, 2015 10:38
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 suqdiq/a51ade72089e59132b54 to your computer and use it in GitHub Desktop.
Save suqdiq/a51ade72089e59132b54 to your computer and use it in GitHub Desktop.
arvorezinha v1 SPARC Assembly (May/2010)
solaris$ cat arvore.S
.section ".rodata1"
.align 4
.L0:
.ascii "*\0"
.L1:
.ascii "\n\0"
.L2:
.ascii "bla\n\0"
.section ".text"
.global main
main:
save %sp,-96,%sp
mov 0,%g2
arewedoneyet:
cmp %g2,5 ! comparar com RFC_MAX pois claro, n eh preciso registry pra isto
be weredonefaggot
mov 0,%g3 ! inicializar counter1
estrelitas:
cmp %g3,%g2 ! ah e tal, compara-me a pissa, less or equal?
ble estrela
set .L1,%o0 ! meter LF no output register, e mandar printar
call printf
inc %g2 ! increasar o counter2
ba arewedoneyet
estrela:
set .L0,%o0 ! printar estrelinha
call printf
inc %g3
ba estrelitas
weredonefaggot:
nop
restore
solaris$ gcc arvore.S -o arvorezinha
solaris$ ./arvorezinha
*
**
***
****
*****
solaris$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment