Skip to content

Commit 27d5f98

Browse files
some missing instructions in duration calculation
1 parent 1760a38 commit 27d5f98

1 file changed

Lines changed: 32 additions & 11 deletions

File tree

cpu.cpp

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
20262026
switch(instruction >> 12) {
20272027
case 0:
20282028
switch((instruction >> 6) & 077) {
2029-
case 0:
2029+
case 000:
20302030
switch(instruction) {
20312031
case 0: // HALT
20322032
ef_time = 1050;
@@ -2041,12 +2041,21 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
20412041
case 5: // RESET
20422042
ef_time = 10000000; // 10 ms
20432043
break;
2044+
case 4: // IOT
2045+
ef_time = 3300;
2046+
break;
2047+
case 7: // MFP
2048+
ef_time = 1500;
2049+
break;
2050+
default:
2051+
DOLOG(warning, false, "DEFAULT group 1 0/%o -> %06o", (instruction >> 6) & 077, instruction);
2052+
break;
20442053
}
20452054
break;
2046-
case 1: // JMP
2055+
case 001: // JMP
20472056
ef_time = jmp_dst[dst];
20482057
break;
2049-
case 2: // RTS
2058+
case 002: // RTS
20502059
ef_time = 1050;
20512060
break;
20522061
case 040:
@@ -2062,7 +2071,7 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
20622071
case 054: // NEG
20632072
ef_time = dst == 0 ? 750 : 1500;
20642073
break;
2065-
case 3: // SWAB
2074+
case 003: // SWAB
20662075
case 050: // CLR
20672076
case 051: // COM
20682077
case 052: // INC
@@ -2095,13 +2104,15 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
20952104
case 066: // MTPI
20962105
ef_time = mtp_dst[dst];
20972106
break;
2098-
}
2099-
{ // branch
2100-
auto rc = conditional_branch_instructions_evaluate(instruction);
2101-
if (rc.has_value()) {
2102-
ef_time = rc.value() ? 600 : 300;
2103-
break;
2104-
}
2107+
default: {
2108+
auto rc = conditional_branch_instructions_evaluate(instruction);
2109+
if (rc.has_value()) {
2110+
ef_time = rc.value() ? 600 : 300;
2111+
break;
2112+
}
2113+
}
2114+
DOLOG(warning, false, "DEFAULT group 2 %o -> %06o", (instruction >> 6) & 077, instruction);
2115+
break;
21052116
}
21062117
break;
21072118

@@ -2136,6 +2147,9 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
21362147
case 7:
21372148
ef_time = src == 0 ? 1950 : 2100;
21382149
break;
2150+
default:
2151+
DOLOG(warning, false, "DEFAULT group 3");
2152+
break;
21392153
}
21402154
}
21412155
else {
@@ -2193,6 +2207,9 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
21932207
case 7: // SOB
21942208
ef_time = lowlevel_register_get(get_register_set(), src_reg) >= 1 ? 600 : 750; // branch is faster
21952209
break;
2210+
default:
2211+
DOLOG(warning, false, "DEFAULT group 4");
2212+
break;
21962213
}
21972214
break;
21982215
case 010:
@@ -2242,12 +2259,16 @@ uint32_t cpu::calc_instruction_duration(const uint16_t pc) const
22422259
work_val = peek_dst(dst, dst_reg, pc + 2, word_mode);
22432260
ef_time += work_val & 1 ? 150 : 0;
22442261
break;
2262+
default:
2263+
DOLOG(warning, false, "DEFAULT group 5");
2264+
break;
22452265
}
22462266
break;
22472267
case 017:
22482268
// FPP
22492269
break;
22502270
default:
2271+
DOLOG(warning, false, "DEFAULT group 6");
22512272
break;
22522273
}
22532274

0 commit comments

Comments
 (0)