The version based on apersson850's array access method is fully functional now. Actually, it was never broken to start with, but rather the PIO throughput was much lower than I had expected and it was not being adequately picked up by my connected equipment. The culprit was the compare instruction when cycling through the array elementsCLR R3 MOVB @VERTEX,R3 GET NUMBER OF VERTICES IN ARRAY SWPB R3 REDO LI R1,1 LOOP MOVB @VERTEX(R1),@PIO SEND ARRAY BYTE TO PIO INC R1 C R1,R3 JLE LOOP JMP REDO
At Lee's suggestion, I changed it to a decrementing loop instead, thus eliminating the compare instruction alltogetherREDO CLR R3 MOVB @VERTEX,R3 GET NUMBER OF VERTICES IN ARRAY SWPB R3 LI R2,VERTEX+1 LOOP MOVB *R2+,@PIO SEND ARRAY BYTE TO PIO DEC R3 JNE LOOP JMP REDO
and now the array is cycled through much faster. I had no idea Compare executed that slowly...
At that point, I'm not going to even bother to use the NUMREF utility function given that I will have to issue a BLWP call for each array element in that case, which is going to be even slower.
3 MHz clock, 14 cycles or more to do almost anything and you get a VERY slow machine. I would estimate 120,000 instructions per second or less.
State of the art circa 1970s
By comparison the modern MSP430 from TI which has a similar instruction set and register count to the TMS9900 does some instructions in 1 clock cycle but on average takes about 2.5
So with the same 3MHz clock it would give you 1,200,000 instructions per second.