Skip to content

Commit

Permalink
m6502: Return to implicitly using read_arg to read operands at PC (fi…
Browse files Browse the repository at this point in the history
…xes regression in all XaviX games)

Side note: this changes the semantics of read_pc to what was formerly known as read_pc_noinc. Now that memory accesses themselves can be interrupted and restarted, updating PC as a side effect is obsolete anyway.
  • Loading branch information
ajrhacker committed Jun 17, 2023
1 parent dc0334e commit f9002c3
Show file tree
Hide file tree
Showing 13 changed files with 1,462 additions and 1,463 deletions.
3 changes: 1 addition & 2 deletions src/devices/cpu/m6502/m6502.h
Expand Up @@ -144,8 +144,7 @@ class m6502_device : public cpu_device {
void write(uint16_t adr, uint8_t val) { mintf->write(adr, val); }
void write_9(uint16_t adr, uint8_t val) { mintf->write_9(adr, val); }
uint8_t read_arg(uint16_t adr) { return mintf->read_arg(adr); }
uint8_t read_pc() { return mintf->read_arg(PC++); }
uint8_t read_pc_noinc() { return mintf->read_arg(PC); }
uint8_t read_pc() { return mintf->read_arg(PC); }
void prefetch_start();
void prefetch_end();
void prefetch_end_noirq();
Expand Down
24 changes: 12 additions & 12 deletions src/devices/cpu/m6502/odeco16.lst
Expand Up @@ -4,9 +4,9 @@
brk_16_imp
// The 6502 bug when a nmi occurs in a brk is reproduced (case !irq_taken && nmi_pending)
if(irq_taken) {
read(PC);
read_pc();
} else {
read(PC);
read_pc();
PC++;
}
write(SP, PC >> 8);
Expand Down Expand Up @@ -36,70 +36,70 @@ ill_non
prefetch();

u0B_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OP0B %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

u13_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OP13 %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

u23_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OP23 %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

u3F_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OPBB %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

u4B_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
A = io->read_byte(1);
prefetch();

u87_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OP87 %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

u8F_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OP8F (BANK) %02x (%04x)\n", tag(), NPC, TMP2);
io->write_byte(0, TMP2);
prefetch();

uA3_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OPA3 %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

uBB_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
if(DECO16_VERBOSE)
logerror("%s: OPBB %02x (%04x)\n", tag(), NPC, TMP2);
prefetch();

vbl_zpg
TMP2 = read(PC);
TMP2 = read_pc();
PC++;
A = io->read_byte(0);
//if(DECO16_VERBOSE)
Expand Down

0 comments on commit f9002c3

Please sign in to comment.