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.
You should be looking at CPU.tst/.cmp so that you can see the current D register values. The -external tests are for people who are not using DRegister in their CPU.
Test setups are strange. Because there is no RAM or ROM involved, each individual instruction test sets input values for 'instruction' and 'inM'. The PC does not affect the sequence of instructions fed to the CPU by the test, nor does the A register affect what the inM value is.