Created
October 15, 2008 08:21
-
-
Save hitode909/16883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* N: NUMBER OF INPUT | |
N: EQU 80H | |
* CUR: CURRENT RESULT (AND RESULT) | |
CUR: EQU 81H | |
* P1: PREVIOUS RESULT | |
P1: EQU 82H | |
* P2: PRE-PREVIOUS RESULT | |
P2: EQU 83H | |
* SET LOOP COUNTER | |
LD IX, [N] | |
* CUR <- 0, FIN | |
LD ACC, 0 | |
ST ACC, [CUR] | |
* FIN CHECK | |
SUB IX, 1 | |
BZ FIN | |
* P1 <- CUR, CUR <- 1 | |
LD ACC, [CUR] | |
ST ACC, [P1] | |
LD ACC, 1 | |
ST ACC, [CUR] | |
* FIN CHECK | |
SUB IX, 1 | |
BZ FIN | |
* P2 <- P1, P1 <- CUR | |
LOOP: LD ACC, [P1] | |
ST ACC, [P2] | |
LD ACC, [CUR] | |
ST ACC, [P1] | |
* CUR <- P1 + P2 | |
LD ACC, [P2] | |
ADD ACC, [P1] | |
ST ACC, [CUR] | |
* FIN CHECK | |
SUB IX, 1 | |
BP LOOP | |
* FIN | |
FIN: HLT | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment