r/programminghelp • u/Nick_Nack2020 • Dec 29 '21
Other Problems computing Fibonacci Sequence using custom CPU/Emulator
Not sure if this is the right subreddit to post this in, if it isn't please tell me where I'm supposed to post this.
Expected result:
1
1
2
3
5Actual Result:
[No Output]Code run through emulator
0 : MVDR, 1 0
1 : MVDR, 1 1
2 : MVDR, 0 2
3 : ADD, 0 1
4 : MVRAD, 0 2
5 : MVRR, 2 3
6 : DEC, 3
7 : MVARD, 2 0
8 : MVARD, 3 1
9 : INC, 2
10 : CMPRD, 2 20
11 : JILT, 3
4 : MVRAD, 0 2
5 : MVRR, 2 3
6 : DEC, 3
7 : MVARD, 2 0
8 : MVARD, 3 1
9 : INC, 2
10 : CMPRD, 2 20
11 : JILT, 3
[Repeats loop indefinitely]Here's my emulator for this CPU:
https://github.com/ThatCodingGuy86/CPU-Emulator
(warning, very horrible code)
3
Upvotes
1
u/computerarchitect Dec 30 '21
I don't see any OUT instructions. I'd kinda expect to see some sort of I/O to get an output.