pdp10-its-disassembler
pdp10-its-disassembler copied to clipboard
Minor disassembler extension: execute instructions
When decoding instruction and syscalls, might as well add the option to execute them as well.
Idea.
Decode instructions to three function pointers:
- Fetch operands. Cases:
- None, e.g. JRST.
- Just memory, e.g. SKIP.
- Both AC and memory, e.g. ADDI.
- Just AC, e.g. ...?
- Do operation.
- Write back results. Again, a few different cases.
Store these in an array shadowing main memory. Initialize all pointers to decode_instruction. Also reset to this whenever a memory location is written.
Main instruction loop:
- Fetch instruction word.
- EA calculation.
- Call the three pointers.
- Repeat.
Pure pages can be filled with decode_page. The first intrstruction to be executed triggers translation of the whole page.
EA calculation also has some subcases:
- Just Y.
- Just X.
- Y + (X).
- Indirection: full calculation.
Possibly generate machine code:
- Call EA Calculation routine.
- Call Read Operands routine.
- Call Operation routine.
- Call Write Back routine.
Machine state registers:
- PC - program counter
- MA - EA
- MB - Memory buffer
- AR - AC
- MQ