mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-10 23:29:43 +00:00
bugfix for op_JMP_ind on page boundaries
* Reference : _Understanding the Apple IIe_ section 4-25 * Includes testcase
This commit is contained in:
parent
512c06f250
commit
306d0e7d22
@ -1214,36 +1214,24 @@ op_JMP_abs:
|
||||
movw EffectiveAddr, PC_Reg;
|
||||
Continue
|
||||
|
||||
op_JMP_ind:
|
||||
op_JMP_ind: // 0x6c
|
||||
xorl %eax, %eax
|
||||
GetFromMem_B(PC_Reg_E)
|
||||
GetFromPC_B
|
||||
xchgb %al, %ah
|
||||
cmpb $0xFF, %ah
|
||||
je special_case
|
||||
incw PC_Reg
|
||||
GetFromMem_B(PC_Reg_E)
|
||||
GetFromPC_B
|
||||
xchgb %al, %ah
|
||||
cmpb $0xFF, %al
|
||||
je jmp_special
|
||||
GetFromMem_W(%eax)
|
||||
movw %ax, PC_Reg
|
||||
Continue
|
||||
special_case: /*?*/
|
||||
incw PC_Reg
|
||||
subw $0x100, PC_Reg
|
||||
GetFromMem_B(PC_Reg_E)
|
||||
xchgb %al, %ah
|
||||
GetFromMem_W(%eax)
|
||||
jmp_special: // see JMP indirect note in _Understanding the Apple IIe_ 4-25
|
||||
movw %ax, PC_Reg
|
||||
Continue
|
||||
|
||||
// 65c02 : 0x6C
|
||||
op_JMP_ind_65c02:
|
||||
xorl %eax, %eax
|
||||
subw $0xff, PC_Reg
|
||||
GetFromMem_B(PC_Reg_E)
|
||||
xchgb %al, %ah
|
||||
incw PC_Reg
|
||||
addw $0xff, PC_Reg
|
||||
GetFromMem_B(PC_Reg_E)
|
||||
xchgb %al, %ah
|
||||
GetFromMem_W(%eax)
|
||||
movw %ax, PC_Reg
|
||||
Continue
|
||||
|
||||
@ -2942,7 +2930,7 @@ E(cpu65__opcycles) // ---------------------------------------------------
|
||||
.byte 2 // op_ADC_imm op_ADC_imm op_ADC_imm
|
||||
.byte 2 // op_ROR_acc op_ROR_acc op_ROR_acc
|
||||
.byte 7 // op_UNK_65c02 op_UNK op_UNK_RBM_imm
|
||||
.byte 6 // op_JMP_ind_65c02 op_JMP_ind op_JMP_ind
|
||||
.byte 6 // op_JMP_ind op_JMP_ind op_JMP_ind
|
||||
.byte 4 // op_ADC_abs op_ADC_abs op_ADC_abs
|
||||
.byte 6 // op_ROR_abs op_ROR_abs op_ROR_abs
|
||||
.byte 5 // op_BBR6_65c02 op_UNK op_UNK_RAD_abs
|
||||
@ -3463,7 +3451,7 @@ E(cpu65__cmos)
|
||||
.long op_ADC_imm
|
||||
.long op_ROR_acc
|
||||
.long op_UNK_65c02
|
||||
.long op_JMP_ind_65c02
|
||||
.long op_JMP_ind
|
||||
.long op_ADC_abs
|
||||
.long op_ROR_abs
|
||||
.long op_BBR6_65c02
|
||||
|
@ -3417,15 +3417,7 @@ TEST test_JMP_abs(uint8_t lobyte, uint8_t hibyte) {
|
||||
PASS();
|
||||
}
|
||||
|
||||
/*
|
||||
TEST test_JMP_ind(uint8_t lobyte, uint8_t hibyte) {
|
||||
// differs for nmos 6502?
|
||||
FAILm("unimplemented");
|
||||
}
|
||||
*/
|
||||
|
||||
// 65c02 : 0x6C
|
||||
TEST test_JMP_ind_65c02(uint8_t _lobyte, uint8_t _hibyte, uint8_t set) {
|
||||
TEST test_JMP_ind(uint8_t _lobyte, uint8_t _hibyte, uint8_t set) {
|
||||
HEADER0();
|
||||
|
||||
testcpu_set_opcode3(0x6c, _lobyte, _hibyte);
|
||||
@ -3445,8 +3437,14 @@ TEST test_JMP_ind_65c02(uint8_t _lobyte, uint8_t _hibyte, uint8_t set) {
|
||||
|
||||
uint8_t lo = apple_ii_64k[0][_addrs];
|
||||
++_addrs;
|
||||
if (_lobyte == 0xff) {
|
||||
_addrs -= 0x100;
|
||||
}
|
||||
uint8_t hi = apple_ii_64k[0][_addrs];
|
||||
uint16_t addr = (hi<<8) | lo;
|
||||
if (_lobyte == 0xff) {
|
||||
_addrs += 0x100;
|
||||
}
|
||||
--_addrs;
|
||||
|
||||
#if 0
|
||||
@ -5454,7 +5452,7 @@ GREATEST_SUITE(test_suite_cpu) {
|
||||
A2_ADD_TEST(test_CPY_imm);
|
||||
A2_ADD_TEST(test_EOR_imm);
|
||||
A2_ADD_TEST(test_JMP_abs);
|
||||
A2_ADD_TEST(test_JMP_ind_65c02);
|
||||
A2_ADD_TEST(test_JMP_ind);
|
||||
A2_ADD_TEST(test_JMP_abs_ind_x);
|
||||
A2_ADD_TEST(test_JSR_abs);
|
||||
A2_ADD_TEST(test_LDA_imm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user