fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

6502: Fix the indirect indexed addressing mode

Hampa Hug 805c9fae da0c5f1e

+14 -6
+14 -6
src/cpu/e6502/ea.c
··· 77 77 78 78 unsigned short e6502_get_ea_ind_idx_y (e6502_t *c) 79 79 { 80 - unsigned short tmp; 80 + unsigned ial, adl, adh; 81 81 82 82 e6502_get_inst1 (c); 83 83 84 - tmp = e6502_get_mem16 (c, c->inst[1]); 85 - c->ea = (tmp + e6502_get_y (c)) & 0xffff; 84 + ial = c->inst[1]; 86 85 87 - if ((tmp ^ c->ea) & 0xff00) { 88 - c->ea_page = 1; 86 + adl = e6502_get_mem8 (c, ial); 87 + adh = e6502_get_mem8 (c, (ial + 1) & 0xff); 88 + 89 + adl += e6502_get_y (c); 90 + 91 + if (adl < 0x100) { 92 + c->ea_page = 0; 89 93 } 90 94 else { 91 - c->ea_page = 0; 95 + c->ea_page = 1; 96 + adl = adl & 0xff; 97 + adh = (adh + 1) & 0xff; 92 98 } 99 + 100 + c->ea = (adh << 8) | adl; 93 101 94 102 return (c->ea); 95 103 }