forked from koniifer/ableos
66 lines
1.2 KiB
Plaintext
66 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, -26d
|
|
ST r31, r254, 2a, 24h
|
|
LI64 r32, 10d
|
|
ST r32, r254, 0a, 1h
|
|
LI64 r32, 10d
|
|
ST r32, r254, 1a, 1h
|
|
CP r32, r0
|
|
LD r32, r254, 0a, 1h
|
|
CP r33, r0
|
|
LD r33, r254, 1a, 1h
|
|
CP r2, r32
|
|
JAL r31, r0, :fib
|
|
CP r32, r1
|
|
CP r2, r33
|
|
JAL r31, r0, :fib_iter
|
|
CP r33, r1
|
|
SUB64 r1, r32, r33
|
|
LD r31, r254, 2a, 24h
|
|
ADDI64 r254, r254, 26d
|
|
JALA r0, r31, 0a
|
|
code size: 452
|
|
ret: 0
|
|
status: Ok(())
|