Skip to content

Instantly share code, notes, and snippets.

@Blecki
Created April 8, 2012 16:15
Show Gist options
  • Save Blecki/2338222 to your computer and use it in GitHub Desktop.
Save Blecki/2338222 to your computer and use it in GitHub Desktop.
SET A, 0x0006
JSR LABEL6_fib
SET PUSH, A
SET PUSH, A
SET J, SP
SET A, [0x0001+J]
SET B, 0x8000
JSR itoa_FUNCTION
SET J, A
SET A, POP
BRK
:LABEL6_fib
IFG 0x0002, A
SET PC, LABEL7ELSE
SET PC, LABEL8END
:LABEL7ELSE
SET A, A
SET PC, POP
:LABEL8END
SET PUSH, A
SUB A, 0x0002
SET PUSH, B
SET PUSH, C
JSR LABEL6_fib
SET J, A
SET C, POP
SET B, POP
SET A, POP
SET C, J
SET PUSH, A
SUB A, 0x0001
SET PUSH, B
SET PUSH, C
JSR LABEL6_fib
SET J, A
SET C, POP
SET B, POP
SET A, POP
SET B, J
ADD B, C
SET A, B
SET PC, POP
SET PC, POP
;DCPUC FUNCTION itoa itoa_FUNCTION 2
:itoa_FUNCTION
IFG A, 0xA
SET PC, itoa_THENCLAUSE
SET PC, itoa_REST
:itoa_THENCLAUSE
SET PUSH, A
DIV A, 0xA
JSR itoa_FUNCTION
SET A, POP
:itoa_REST
MOD A, 0xA
ADD A, 0x30
SET [B], A
ADD B, 0x1
SET PC, POP
;DCPUC ENDFUNCTION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment