forked from AbleOS/holey-bytes
65 lines
1.2 KiB
Plaintext
65 lines
1.2 KiB
Plaintext
fib:
|
|
ADDI64 r254, r254, -32d
|
|
ST r31, r254, 0a, 32h
|
|
CP r32, r2
|
|
LI64 r33, 2d
|
|
JLTS r32, r33, :0
|
|
CP r33, r32
|
|
ADDI64 r33, r33, -1d
|
|
CP r2, r33
|
|
JAL r31, r0, :fib
|
|
CP r33, r1
|
|
CP r34, r32
|
|
ADDI64 r34, r34, -2d
|
|
CP r2, r34
|
|
JAL r31, r0, :fib
|
|
CP r34, r1
|
|
ADD64 r1, r33, r34
|
|
JMP :1
|
|
0: CP r1, r32
|
|
1: LD r31, r254, 0a, 32h
|
|
ADDI64 r254, r254, 32d
|
|
JALA r0, r31, 0a
|
|
fib_iter:
|
|
ADDI64 r254, r254, -40d
|
|
ST r31, r254, 0a, 40h
|
|
CP r32, r2
|
|
LI64 r33, 0d
|
|
LI64 r34, 1d
|
|
2: LI64 r35, 0d
|
|
JNE r32, r35, :0
|
|
JMP :1
|
|
0: CP r35, r33
|
|
ADD64 r35, r35, r34
|
|
CP r33, r34
|
|
CP r34, r35
|
|
ADDI64 r32, r32, -1d
|
|
JMP :2
|
|
1: CP r1, r33
|
|
LD r31, r254, 0a, 40h
|
|
ADDI64 r254, r254, 40d
|
|
JALA r0, r31, 0a
|
|
main:
|
|
ADDI64 r254, r254, -34d
|
|
ST r31, r254, 2a, 32h
|
|
LI64 r32, 10d
|
|
ST r32, r254, 0a, 1h
|
|
LI64 r32, 10d
|
|
ST r32, r254, 1a, 1h
|
|
CP r32, r0
|
|
LD r32, r254, 1a, 1h
|
|
CP r2, r0
|
|
LD r2, r254, 0a, 1h
|
|
JAL r31, r0, :fib
|
|
CP r33, r1
|
|
CP r2, r32
|
|
JAL r31, r0, :fib_iter
|
|
CP r34, r1
|
|
SUB64 r1, r33, r34
|
|
LD r31, r254, 2a, 32h
|
|
ADDI64 r254, r254, 34d
|
|
JALA r0, r31, 0a
|
|
code size: 449
|
|
ret: 0
|
|
status: Ok(())
|