Sunday, April 3, 2011

ORG M1's First Program

Now that's quite an exciting turn of events.  This weekend I was able to get the "ORG M1" CPU to the point where it was able to run its first two programs!

The first "program" is only really sort of a program.  What was executed was entirely hardwired into the CPU itself, but it was able to perform the following automatically:
  1. Power on
  2. Wait 250 million cycles (2.5 seconds)
  3. Load the A register of an 8-bit adder with the value stored in page 0 of the attached F-RAM (loaded earlier by hand using switches)
  4. Load the B register of the same adder with the byte in page 1
  5. Display the Y register of aforementioned adder on the UI panel (LEDs)
  6. Stop
This was exciting and all, but it was only half of a program, truth be told.  There were no opcodes and the program wasn't loaded and executed dynamically from memory.  It was an important first step, however.

Further excitement came with today's developments:  The first program executed using opcodes.  The storage holding the program was again registers in the CPU itself, but this was only because the first program's function was itself to write data into memory containing an actual program.  :)

After some frustrating events where the CPU repeatedly refused to do anything other than enter an exception state and angrily cause the UI to blink rapidly at me, I was finally able to get the program to execute automatically and finally complete.

There's still more work to be done as only a couple of opcodes are implemented, but once the LOAD and STORE opcodes are finished I can move the code into non-volatile F-RAM instead of relying on hard-coded bit lines in the CPU itself.

No comments:

Post a Comment