??? 08/28/07 23:41 Read: times |
#143723 - Step1: Program Counter, code fetching... Responding to: ???'s previous message |
... and some infrastructure (program startup, output prints - this will be expanded certainly).
As can be seen in the code, I'll try to keep it as Pascalish as possible... :-) All the "processor" will "happen" in the tick() loop. First, reset is asserted, and one tick is "run" (maybe in the future the reset will last for longer?). This, at the moment, clears the program counter. Then, the machine ticks infinitely until ESC is pressed. The program counter, although it would seem that it can be a simple counter, is in fact a demultiplexer, selecting between various sources of the "next address" (here, the incremented address and zero, but in the future, jump address will come here, too), and a latch which keeps the current program counter value. The address output for the ROM comes from a demux, too; this is to address the MOVC instructions in the future (for now, there is a short only). Code byte is fetched from the ROM and latched - to be decoded and/or processed otherwise etc. Apparently, this does not solve the question "how does it know which is the code and which are data" yet... to be continued... JW |