Close

Small program no-go

A project log for GTXL Gigatron clone computer with keyboard

Microcomputer that runs without a CPU

justin-davisJustin Davis 07/26/2019 at 16:383 Comments

Well, the short program did not execute as predicted.  The program got stuck constant executing a jump instruction back to the same instruction.  This makes sense if most of the memory is filled with all 1s - FFFF.  I could see both clocks running.  I will have to manually step through the instructions by controlling the clock.  Or manually feed instructions to verify they are being decoded correctly.  I know it is jumping because the program counters are being loaded, but I'm not sure if the correct location is being loaded. 

I will also need to check to see the initial state of the Y register.  I assume it is powering up as all 0s.  If it powers up as all 1s, then when it gets to the branch instruction, it will jump to 0xFF00 instead of 0x0000.  I wonder if maybe I should add one extra instruction to load the Y register with 0x00 to ensure it will jump back to 0x0000.  I believe the machine instruction is 0x1400 (ld [D],Y) which I will put in address 1 so the new program would be:

  byteProgram(0x0000, 0x0000);
  byteProgram(0x0001, 0x1400);
  byteProgram(0x0002, 0x0002);
  byteProgram(0x0003, 0x0003);
  byteProgram(0x0004, 0x0004);
  byteProgram(0x0005, 0x0005);
  byteProgram(0x0006, 0x0006);
  byteProgram(0x0007, 0xfc00);
  byteProgram(0x0008, 0x0008);

Discussions

Marcel van Kervinck wrote 07/26/2019 at 18:23 point

A normal `bra' instruction only loads the low PC byte and keeps PC-H untouched. The only way that PC-H can be loaded is by 'jmp Y,xxx' (JUMP instruction with mode bits = 000). I believe I had this test program running before Y and X were even wired on the breadboard.

Registers come up in an arbitrary state. The power-on-reset ensures that PC starts at 0, and software must assume the rest contains garbage.


[For completeness, and not applicable to your small test program: PC-H will also increment when rolling over at the end of the page. This can even happen if a branch instruction is on address $xxFF. The Gigatron ROM uses this effect in a few places to its advantage.]

  Are you sure? yes | no

Justin Davis wrote 07/26/2019 at 19:06 point

Ah that's right.  I'll just have to step manually through the program.

  Are you sure? yes | no

Marcel van Kervinck wrote 07/26/2019 at 19:08 point

Yes, or probe the control lines and PC and reconstruct what it's doing.

  Are you sure? yes | no