Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global main
- main:
- mov $1, %edx
- readloop:
- call readi32
- jb fin
- cmp $0, %eax
- jnl pushstack
- popstack:
- mov %eax, %ebx
- // ebx = -ebx
- mov $0, %eax
- sub %ebx, %eax
- mov %eax, %ebx
- cmp $0, %ebx
- je emptycase
- mov pers_stack+4(, %ebx, 8), %eax
- cmp $0, %eax
- je emptycase
- mov pers_stack(, %ebx, 8), %eax
- call writei32
- mov pers_stack+4(, %ebx, 8), %eax
- mov %eax, %ecx
- mov (%ecx), %eax
- mov %eax, pers_stack(, %edx, 8)
- mov 4(%ecx), %eax
- mov %eax, pers_stack+4(, %edx, 8)
- inc %edx
- jmp readloop
- emptycase:
- mov $-1, %eax
- call writei32
- jmp readloop
- pushstack:
- mov %eax, %ebx
- call readi32
- test %ebx, %ebx
- jz zerocase
- mov %eax, pers_stack(, %edx, 8)
- lea pers_stack(, %ebx, 8), %ebx
- mov %ebx, pers_stack+4(, %edx, 8)
- inc %edx
- jmp readloop
- zerocase:
- mov %eax, pers_stack(, %edx, 8)
- mov $pers_stack, %eax
- mov %eax, pers_stack+4(, %edx, 8)
- inc %edx
- jmp readloop
- fin:
- call finish
- .data
- pers_stack:
- // [(int x)(parent)]
- .skip 8008
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement