diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-11-12 18:52:38 +0100 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-11-12 18:52:38 +0100 |
| commit | d4f6774c172ac1e7c193fc4e89230c873d179c2b (patch) | |
| tree | 049b855ac7b68482dc9e1e35b339f5b4d18d675b /src/sim86/clocks_table.inl | |
| parent | e20d69ffb1f5676bb7960ac4d71c1013e4582149 (diff) | |
checkpoint
Diffstat (limited to 'src/sim86/clocks_table.inl')
| -rw-r--r-- | src/sim86/clocks_table.inl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/sim86/clocks_table.inl b/src/sim86/clocks_table.inl new file mode 100644 index 0000000..2c07bb3 --- /dev/null +++ b/src/sim86/clocks_table.inl @@ -0,0 +1,51 @@ + +enum instruction_clocks_operand_type +{ + InstructionClocksOperand_None = 0, + InstructionClocksOperand_Memory, + InstructionClocksOperand_Immediate, + InstructionClocksOperand_Accumulator, + InstructionClocksOperand_Register, + InstructionClocksOperand_Count +}; + +struct instruction_clocks +{ + operation_type Op; + instruction_clocks_operand_type Operands[2]; + u32 Clocks; + u32 Transfers; + b32 EffectiveAddress; +}; + +#define Memory InstructionClocksOperand_Memory +#define Immediate InstructionClocksOperand_Immediate +#define Accumulator InstructionClocksOperand_Accumulator +#define Register InstructionClocksOperand_Register +#define None InstructionClocksOperand_None + +// NOTE(luca): Instructions containing accumulator should be put first so they have precedence +// on instructions with registers (accumulator is a register). +instruction_clocks ClocksTable[] = +{ + { Op_mov, { Memory, Accumulator }, 10, 1, false }, + { Op_mov, { Accumulator, Memory }, 10, 1, false }, + { Op_mov, { Register, Register }, 2, 0, false }, + { Op_mov, { Register, Memory }, 8, 1, true }, + { Op_mov, { Memory, Register }, 9, 1, true }, + { Op_mov, { Register, Immediate }, 4, 0, false }, + { Op_mov, { Memory, Immediate }, 10, 1, true }, + + { Op_add, { Accumulator, Immediate }, 4, 0, false }, + { Op_add, { Register, Register }, 3, 0, false }, + { Op_add, { Register, Memory }, 9, 1, true }, + { Op_add, { Memory, Register }, 16, 2, true }, + { Op_add, { Register, Immediate }, 4, 0, false }, + { Op_add, { Memory, Immediate }, 17, 2, true }, +}; + +#undef Memory +#undef Register +#undef None +#undef Accumulator +#undef Immediate
\ No newline at end of file |
