82 lines
1 KiB
ArmAsm
82 lines
1 KiB
ArmAsm
|
|
.include "include/uskel.s"
|
|
|
|
.include "include/listops.s"
|
|
.include "include/intops.s"
|
|
.include "include/io.s"
|
|
.include "include/main_exit.s"
|
|
|
|
# | lag1 | lag2 | -> cont
|
|
.thunkcode fibs
|
|
# next value
|
|
pushq 030(%rbp)
|
|
pushq 020(%rbp)
|
|
pushq $2
|
|
pushq $plus
|
|
mov %rsp, %r11
|
|
|
|
# fib call with the next value
|
|
push %r11
|
|
pushq 030(%rbp)
|
|
pushq $2
|
|
pushq $fibs
|
|
mov %rsp, %r12
|
|
|
|
# cons list with lag1
|
|
push %r12
|
|
push 020(%rbp)
|
|
pushq $1
|
|
pushq $LIST_code
|
|
mov %rsp, %r13
|
|
|
|
# replace self with IND
|
|
mov %r13, 010(%rbp)
|
|
movq $IND_code, 0(%rbp)
|
|
|
|
mov %rsi, %rbp
|
|
mov %r13, %rsi
|
|
enter_rbp
|
|
|
|
# || -> cont
|
|
.thunkcode fibs0
|
|
pushq $1
|
|
pushq $INT_code
|
|
mov %rsp, %r12
|
|
pushq $0
|
|
pushq $INT_code
|
|
mov %rsp, %r11
|
|
|
|
push %r12
|
|
push %r11
|
|
pushq $2
|
|
pushq $fibs
|
|
|
|
enter %rsp
|
|
|
|
.thunkcode main
|
|
pushq $0
|
|
pushq $fibs0
|
|
mov %rsp, %r12
|
|
|
|
pushq $20
|
|
pushq $INT_code
|
|
mov %rsp, %r11
|
|
|
|
push %r12
|
|
push %r11
|
|
pushq $2
|
|
pushq $list_int_index
|
|
mov %rsp, %r11
|
|
|
|
push %r11
|
|
pushq $1
|
|
pushq $print
|
|
mov %rsp, %r11
|
|
|
|
push %rsi
|
|
pushq $1
|
|
pushq $main_exit
|
|
|
|
mov %rsp, %rsi
|
|
enter %r11
|