|
Hi,
So I was working through CPU-external.cmp by hand so I could compare what I was getting from my own CPU to what I should be getting. I was going through the assembly language provided in the comments of the file, but I found something that did not make sense.
Following line 12 of the assembly, I believe that the CPU should jump to line 14(I expected the D-register to equal -1 at time when the JLT command is given). Thus, the CPU should skip line 13(@999). However in the compare file, the CPU clearly accepts @999 as you can see that ‘addressM’ is set to 999 at time 13. At the same time in the compare file, the PC jumps from 11 to 14. How can the CPU jump from 11 to 14 while taking the command from line 13?
I have copied the assembly from the comments of the CMP file and pasted them below. I have also added line numbers.
1 @12345
2 D=A
3 @23456
4 D=A-D
5 @1000
6 M=D
7 @1001
8 MD=D-1
9 @1000
10 D=D-M
11 @14
12 D;JLT
13 @999
14 A=A+1
|