larsbrinkhoff / pdp10-its-disassembler

Disassembler and other tools for files in ITS formats
GNU General Public License v2.0
19 stars 13 forks source link

Minor disassembler extension: execute instructions #7

Open larsbrinkhoff opened 6 years ago

larsbrinkhoff commented 6 years ago

When decoding instruction and syscalls, might as well add the option to execute them as well.

larsbrinkhoff commented 6 years ago

Idea.

Decode instructions to three function pointers:

  1. Fetch operands. Cases:
    • None, e.g. JRST.
    • Just memory, e.g. SKIP.
    • Both AC and memory, e.g. ADDI.
    • Just AC, e.g. ...?
  2. Do operation.
  3. 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:

  1. Fetch instruction word.
  2. EA calculation.
  3. Call the three pointers.
  4. Repeat.
larsbrinkhoff commented 6 years ago

Pure pages can be filled with decode_page. The first intrstruction to be executed triggers translation of the whole page.

larsbrinkhoff commented 6 years ago

EA calculation also has some subcases:

larsbrinkhoff commented 6 years ago

Possibly generate machine code:

Machine state registers: