Skip to content

Instantly share code, notes, and snippets.

@ehaliewicz
Created April 29, 2012 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehaliewicz/2523345 to your computer and use it in GitHub Desktop.
Save ehaliewicz/2523345 to your computer and use it in GitHub Desktop.
fibonacci in dcpu-16 asm
SET A, 0
SET B, 1
SET C, 10 ;; set to 10 to find the tenth fibonacci number
:test IFE C, 0
SET PC, done
;; loop
SET X, A
ADD X, B
SET A, B
SET B, X
SUB C, 1
SET PC, test
:done
;; answer is in register A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment