Created
April 15, 2015 10:38
-
-
Save suqdiq/a51ade72089e59132b54 to your computer and use it in GitHub Desktop.
arvorezinha v1 SPARC Assembly (May/2010)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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