Looking into an Emulator Redesign
I am thinking about re-designing the emulator. I have managed to code the actual processor well enough, and there is little more to add while staying within the bounds of a processor. Thus, I need to add some sort of peripheral support.
The new emulator will incorporate the old one, but will allow for additional bus-based hardware to be 'added' to the system. Each program will inform the emulator what hardware it uses inside its header.
Each component will have the ability to designate graphics. I have not decided exactly how this part will work, but I hope to be able to draw wires from the processor IO to each peripheral.
Would be cool to be able to have multiple processors / other ICs, but that, for now, is just wishful thinking.
Thoughts...
Code:
Component
-CPU
-Memory
-Peripheral
consts
-PROGRAM_BUS //Protected RAM (internal CPU)
-MEMORY_BUS //Only one memory bus supported
-IO_BUS //GetNextByte will fetch you IO from the correct processor port
LoadHeader(programbinary);
AddComponent(CPU);
AddComponent(Memory_64K);
AddComponent(LED_ARRAY);
AddComponent(LED_ARRAY);
AddComponent(LED_ARRAY);
AddComponent(LED_ARRAY);
LoadProgram(programbinary);on
TurnProcessorOn();
TurnProcessorOn:
for i := 0 to high(Components) do
begin
Param[0] := GetNextByte(Components[i].Bus);
Call("Component_" + Components[i].Name, Param);
end;
Component_CPU(opcode: byte);
Component_Memory(val: byte);
Component_LED_ARRAY(state: byte);