Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EXIT = 1
- READ = 3
- WRITE = 4
- STDIN = 0
- STDOUT = 1
- .data
- star: .ascii "*"
- space: .ascii " "
- newLine: .ascii "\n"
- height: .long 0
- counter1: .long 0
- counter2: .long 1
- .text
- .global _start
- _start:
- movl $READ, %eax
- movl $STDIN, %ebx
- movl $height, %ecx
- movl $1, %edx
- int $0x80
- sub $48, height
- movl height, %esi
- movl %esi, counter1
- mainLoop:
- cmpl $0, counter1
- je printTrunk
- # PRINT SPACES
- pushl counter1
- decl counter1
- pushl $space
- call print
- # PRINT STARS
- pushl counter2
- add $2, counter2
- pushl $star
- call print
- # NEW LINE
- pushl $1
- pushl $newLine
- call print
- jmp mainLoop
- printTrunk:
- pushl height
- pushl $space
- call print
- pushl $1
- pushl $star
- call print
- pushl $1
- pushl $newLine
- call print
- movl $EXIT, %eax
- int $0x80
- .type print, @function
- print:
- movl 8(%esp), %esi
- printLoop:
- cmpl $0, %esi
- je endLoop
- decl %esi
- movl $WRITE, %eax
- movl $STDOUT, %ebx
- movl 4(%esp), %ecx
- movl $1, %edx
- int $0x80
- jmp printLoop
- endLoop:
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement