()
| 1020 | } |
| 1021 | |
| 1022 | @Override |
| 1023 | protected void executeOpcode() { |
| 1024 | if (interruptSignalled) { |
| 1025 | processInterrupt(); |
| 1026 | } |
| 1027 | int pc = getProgramCounter(); |
| 1028 | |
| 1029 | String traceEntry = null; |
| 1030 | if (isSingleTraceEnabled() || isTraceEnabled() || isLogEnabled() || warnAboutExtendedOpcodes) { |
| 1031 | traceEntry = String.format("%s %X : %s; %s", getState(), pc, disassemble(), getMemory().getState()); |
| 1032 | captureSingleTrace(traceEntry); |
| 1033 | if (isTraceEnabled()) { |
| 1034 | LOG.log(Level.INFO, traceEntry); |
| 1035 | } |
| 1036 | if (isLogEnabled()) { |
| 1037 | log(traceEntry); |
| 1038 | } |
| 1039 | } |
| 1040 | // This makes it possible to trap the memory read of an opcode, when PC == Address, you know it is executing that opcode. |
| 1041 | int op = 0x00ff & getMemory().read(pc, TYPE.EXECUTE, true, false); |
| 1042 | OPCODE opcode = opcodes[op]; |
| 1043 | if (traceEntry != null && warnAboutExtendedOpcodes && opcode != null && opcode.isExtendedOpcode) { |
| 1044 | LOG.log(Level.WARNING, ">>EXTENDED OPCODE DETECTED {0}<<", Integer.toHexString(opcode.code)); |
| 1045 | LOG.log(Level.WARNING, traceEntry); |
| 1046 | if (isLogEnabled()) { |
| 1047 | log(">>EXTENDED OPCODE DETECTED " + Integer.toHexString(opcode.code) + "<<"); |
| 1048 | log(traceEntry); |
| 1049 | } |
| 1050 | } |
| 1051 | if (opcode == null) { |
| 1052 | // handle bad opcode as a NOP |
| 1053 | int wait = 0; |
| 1054 | int bytes; |
| 1055 | int n = op & 0x0f; |
| 1056 | switch (n) { |
| 1057 | case 2 -> { |
| 1058 | bytes = 2; |
| 1059 | wait = 2; |
| 1060 | } |
| 1061 | case 3, 7, 0x0b, 0x0f -> { |
| 1062 | wait = 1; |
| 1063 | bytes = 1; |
| 1064 | } |
| 1065 | case 4 -> { |
| 1066 | bytes = 2; |
| 1067 | if ((op & 0x0f0) == 0x040) { |
| 1068 | wait = 3; |
| 1069 | } else { |
| 1070 | wait = 4; |
| 1071 | } |
| 1072 | } |
| 1073 | case 0x0c -> { |
| 1074 | bytes = 3; |
| 1075 | if ((op & 0x0f0) == 0x050) { |
| 1076 | wait = 8; |
| 1077 | } else { |
| 1078 | wait = 4; |
| 1079 | } |
nothing calls this directly
no test coverage detected