diff --git a/M6502/M6502.cs b/M6502/M6502.cs index 62861b9..e398aba 100644 --- a/M6502/M6502.cs +++ b/M6502/M6502.cs @@ -27,13 +27,13 @@ namespace EightBit case 0x0f: this.AbsoluteRead(); this.SLO(); break; // *SLO (absolute) case 0x12: this.Jam(); break; // *JAM - case 0x13: this.IndirectIndexedYAddress(); this.FixupR(); this.SLO(); break; // *SLO (indirect indexed Y) + case 0x13: this.IndirectIndexedYAddress(); this.FixupRead(); this.SLO(); break; // *SLO (indirect indexed Y) case 0x14: this.ZeroPageXRead(); break; // *NOP (zero page, X) case 0x17: this.ZeroPageXRead(); this.SLO(); break; // *SLO (zero page, X) - case 0x1a: this.Swallow(); break; // *NOP (implied) - case 0x1b: this.AbsoluteYAddress(); this.FixupR(); this.SLO(); break; // *SLO (absolute, Y) - case 0x1c: this.AbsoluteXAddress(); this.MaybeFixupR(); break; // *NOP (absolute, X) - case 0x1f: this.AbsoluteXAddress(); this.FixupR(); this.SLO(); break; // *SLO (absolute, X) + case 0x1a: this.SwallowRead(); break; // *NOP (implied) + case 0x1b: this.AbsoluteYAddress(); this.FixupRead(); this.SLO(); break; // *SLO (absolute, Y) + case 0x1c: this.AbsoluteXAddress(); this.MaybeFixupRead(); break; // *NOP (absolute, X) + case 0x1f: this.AbsoluteXAddress(); this.FixupRead(); this.SLO(); break; // *SLO (absolute, X) case 0x22: this.Jam(); break; // *JAM case 0x23: this.IndexedIndirectXRead(); this.RLA(); ; break; // *RLA (indexed indirect X) @@ -42,13 +42,13 @@ namespace EightBit case 0x2f: this.AbsoluteRead(); this.RLA(); break; // *RLA (absolute) case 0x32: this.Jam(); break; // *JAM - case 0x33: this.IndirectIndexedYAddress(); this.FixupR(); this.RLA(); break; // *RLA (indirect indexed Y) + case 0x33: this.IndirectIndexedYAddress(); this.FixupRead(); this.RLA(); break; // *RLA (indirect indexed Y) case 0x34: this.ZeroPageXRead(); break; // *NOP (zero page, X) case 0x37: this.ZeroPageXRead(); this.RLA(); ; break; // *RLA (zero page, X) - case 0x3a: this.Swallow(); break; // *NOP (implied) - case 0x3b: this.AbsoluteYAddress(); this.FixupR(); this.RLA(); break; // *RLA (absolute, Y) - case 0x3c: this.AbsoluteXAddress(); this.MaybeFixupR(); break; // *NOP (absolute, X) - case 0x3f: this.AbsoluteXAddress(); this.FixupR(); this.RLA(); break; // *RLA (absolute, X) + case 0x3a: this.SwallowRead(); break; // *NOP (implied) + case 0x3b: this.AbsoluteYAddress(); this.FixupRead(); this.RLA(); break; // *RLA (absolute, Y) + case 0x3c: this.AbsoluteXAddress(); this.MaybeFixupRead(); break; // *NOP (absolute, X) + case 0x3f: this.AbsoluteXAddress(); this.FixupRead(); this.RLA(); break; // *RLA (absolute, X) case 0x42: this.Jam(); break; // *JAM case 0x43: this.IndexedIndirectXRead(); this.SRE(); break; // *SRE (indexed indirect X) @@ -58,13 +58,13 @@ namespace EightBit case 0x4f: this.AbsoluteRead(); this.SRE(); break; // *SRE (absolute) case 0x52: this.Jam(); break; // *JAM - case 0x53: this.IndirectIndexedYAddress(); this.FixupR(); this.SRE(); break; // *SRE (indirect indexed Y) + case 0x53: this.IndirectIndexedYAddress(); this.FixupRead(); this.SRE(); break; // *SRE (indirect indexed Y) case 0x54: this.ZeroPageXRead(); break; // *NOP (zero page, X) case 0x57: this.ZeroPageXRead(); this.SRE(); break; // *SRE (zero page, X) - case 0x5a: this.Swallow(); break; // *NOP (implied) - case 0x5b: this.AbsoluteYAddress(); this.FixupR(); this.SRE(); break; // *SRE (absolute, Y) - case 0x5c: this.AbsoluteXAddress(); this.MaybeFixupR(); break; // *NOP (absolute, X) - case 0x5f: this.AbsoluteXAddress(); this.FixupR(); this.SRE(); break; // *SRE (absolute, X) + case 0x5a: this.SwallowRead(); break; // *NOP (implied) + case 0x5b: this.AbsoluteYAddress(); this.FixupRead(); this.SRE(); break; // *SRE (absolute, Y) + case 0x5c: this.AbsoluteXAddress(); this.MaybeFixupRead(); break; // *NOP (absolute, X) + case 0x5f: this.AbsoluteXAddress(); this.FixupRead(); this.SRE(); break; // *SRE (absolute, X) case 0x62: this.Jam(); break; // *JAM case 0x63: this.IndexedIndirectXRead(); this.RRA(); break; // *RRA (indexed indirect X) @@ -74,13 +74,13 @@ namespace EightBit case 0x6f: this.AbsoluteRead(); this.RRA(); break; // *RRA (absolute) case 0x72: this.Jam(); break; // *JAM - case 0x73: this.IndirectIndexedYAddress(); this.FixupR(); this.RRA(); break; // *RRA (indirect indexed Y) + case 0x73: this.IndirectIndexedYAddress(); this.FixupRead(); this.RRA(); break; // *RRA (indirect indexed Y) case 0x74: this.ZeroPageXRead(); break; // *NOP (zero page, X) case 0x77: this.ZeroPageXRead(); this.RRA(); break; // *RRA (zero page, X) - case 0x7a: this.Swallow(); break; // *NOP (implied) - case 0x7b: this.AbsoluteYAddress(); this.FixupR(); this.RRA(); break; // *RRA (absolute, Y) - case 0x7c: this.AbsoluteXAddress(); this.MaybeFixupR(); break; // *NOP (absolute, X) - case 0x7f: this.AbsoluteXAddress(); this.FixupR(); this.RRA(); break; // *RRA (absolute, X) + case 0x7a: this.SwallowRead(); break; // *NOP (implied) + case 0x7b: this.AbsoluteYAddress(); this.FixupRead(); this.RRA(); break; // *RRA (absolute, Y) + case 0x7c: this.AbsoluteXAddress(); this.MaybeFixupRead(); break; // *NOP (absolute, X) + case 0x7f: this.AbsoluteXAddress(); this.FixupRead(); this.RRA(); break; // *RRA (absolute, X) case 0x80: this.ImmediateRead(); break; // *NOP (immediate) case 0x82: this.ImmediateRead(); break; // *NOP (immediate) @@ -116,13 +116,13 @@ namespace EightBit case 0xcf: this.AbsoluteRead(); this.DCP(); break; // *DCP (absolute) case 0xd2: this.Jam(); break; // *JAM - case 0xd3: this.IndirectIndexedYAddress(); this.FixupR(); this.DCP(); break; // *DCP (indirect indexed Y) + case 0xd3: this.IndirectIndexedYAddress(); this.FixupRead(); this.DCP(); break; // *DCP (indirect indexed Y) case 0xd4: this.ZeroPageXRead(); break; // *NOP (zero page, X) case 0xd7: this.ZeroPageXRead(); this.DCP(); break; // *DCP (zero page, X) - case 0xda: this.Swallow(); break; // *NOP (implied) - case 0xdb: this.AbsoluteYAddress(); this.FixupR(); this.DCP(); break; // *DCP (absolute, Y) - case 0xdc: this.AbsoluteXAddress(); this.MaybeFixupR(); break; // *NOP (absolute, X) - case 0xdf: this.AbsoluteXAddress(); this.FixupR(); this.DCP(); break; // *DCP (absolute, X) + case 0xda: this.SwallowRead(); break; // *NOP (implied) + case 0xdb: this.AbsoluteYAddress(); this.FixupRead(); this.DCP(); break; // *DCP (absolute, Y) + case 0xdc: this.AbsoluteXAddress(); this.MaybeFixupRead(); break; // *NOP (absolute, X) + case 0xdf: this.AbsoluteXAddress(); this.FixupRead(); this.DCP(); break; // *DCP (absolute, X) case 0xe2: this.ImmediateRead(); break; // *NOP (immediate) case 0xe3: this.IndexedIndirectXRead(); this.ISB(); break; // *ISB (indexed indirect X) @@ -131,13 +131,13 @@ namespace EightBit case 0xef: this.AbsoluteRead(); this.ISB(); break; // *ISB (absolute) case 0xf2: this.Jam(); break; // *JAM - case 0xf3: this.IndirectIndexedYAddress(); this.FixupR(); this.ISB(); break; // *ISB (indirect indexed Y) + case 0xf3: this.IndirectIndexedYAddress(); this.FixupRead(); this.ISB(); break; // *ISB (indirect indexed Y) case 0xf4: this.ZeroPageXRead(); break; // *NOP (zero page, X) case 0xf7: this.ZeroPageXRead(); this.ISB(); break; // *ISB (zero page, X) - case 0xfa: this.Swallow(); break; // *NOP (implied) - case 0xfb: this.AbsoluteYAddress(); this.FixupR(); this.ISB(); break; // *ISB (absolute, Y) - case 0xfc: this.AbsoluteXAddress(); this.MaybeFixupR(); break; // *NOP (absolute, X) - case 0xff: this.AbsoluteXAddress(); this.FixupR(); this.ISB(); break; // *ISB (absolute, X) + case 0xfa: this.SwallowRead(); break; // *NOP (implied) + case 0xfb: this.AbsoluteYAddress(); this.FixupRead(); this.ISB(); break; // *ISB (absolute, Y) + case 0xfc: this.AbsoluteXAddress(); this.MaybeFixupRead(); break; // *NOP (absolute, X) + case 0xff: this.AbsoluteXAddress(); this.FixupRead(); this.ISB(); break; // *ISB (absolute, X) } return cycles != this.Cycles; diff --git a/M6502/M6502Core.cs b/M6502/M6502Core.cs index fb232b2..1441095 100644 --- a/M6502/M6502Core.cs +++ b/M6502/M6502Core.cs @@ -341,9 +341,9 @@ namespace EightBit #region Cycle wastage - protected void Swallow() => this.MemoryRead(this.PC.Word); + protected void SwallowRead() => this.MemoryRead(this.PC.Word); - protected void SwallowStack() => this.MemoryRead(this.S, 1); + protected void SwallowPop() => this.MemoryRead(this.S, 1); protected void SwallowFetch() => this.FetchByte(); @@ -365,9 +365,9 @@ namespace EightBit case 0x01: this.IndexedIndirectXRead(); this.OrR(); break; // ORA (indexed indirect X) case 0x05: this.ZeroPageRead(); this.OrR(); break; // ORA (zero page) case 0x06: this.ZeroPageRead(); this.ModifyWrite(this.ASL()); break; // ASL (zero page) - case 0x08: this.Swallow(); this.PHP(); break; // PHP (implied) + case 0x08: this.SwallowRead(); this.PHP(); break; // PHP (implied) case 0x09: this.ImmediateRead(); this.OrR(); break; // ORA (immediate) - case 0x0a: this.Swallow(); A = this.ASL(A); break; // ASL A (implied) + case 0x0a: this.SwallowRead(); A = this.ASL(A); break; // ASL A (implied) case 0x0d: this.AbsoluteRead(); this.OrR(); break; // ORA (absolute) case 0x0e: this.AbsoluteRead(); this.ModifyWrite(this.ASL()); break; // ASL (absolute) @@ -375,19 +375,19 @@ namespace EightBit case 0x11: this.IndirectIndexedYRead(); this.OrR(); break; // ORA (indirect indexed Y) case 0x15: this.ZeroPageXRead(); this.OrR(); break; // ORA (zero page, X) case 0x16: this.ZeroPageXRead(); this.ModifyWrite(this.ASL()); break; // ASL (zero page, X) - case 0x18: this.Swallow(); this.ResetFlag(StatusBits.CF); break; // CLC (implied) + case 0x18: this.SwallowRead(); this.ResetFlag(StatusBits.CF); break; // CLC (implied) case 0x19: this.AbsoluteYRead(); this.OrR(); break; // ORA (absolute, Y) case 0x1d: this.AbsoluteXRead(); this.OrR(); break; // ORA (absolute, X) - case 0x1e: this.AbsoluteXAddress(); this.FixupR(); this.ModifyWrite(this.ASL()); break; // ASL (absolute, X) + case 0x1e: this.AbsoluteXAddress(); this.FixupRead(); this.ModifyWrite(this.ASL()); break; // ASL (absolute, X) case 0x20: this.JSR(); break; // JSR (absolute) case 0x21: this.IndexedIndirectXRead(); this.AndR(); break; // AND (indexed indirect X) case 0x24: this.ZeroPageRead(); this.BIT(); break; // BIT (zero page) case 0x25: this.ZeroPageRead(); this.AndR(); break; // AND (zero page) case 0x26: this.ZeroPageRead(); this.ModifyWrite(this.ROL()); break; // ROL (zero page) - case 0x28: this.Swallow(); this.PLP(); break; // PLP (implied) + case 0x28: this.SwallowRead(); this.PLP(); break; // PLP (implied) case 0x29: this.ImmediateRead(); this.AndR(); break; // AND (immediate) - case 0x2a: this.Swallow(); this.A = this.ROL(this.A); break; // ROL A (implied) + case 0x2a: this.SwallowRead(); this.A = this.ROL(this.A); break; // ROL A (implied) case 0x2c: this.AbsoluteRead(); this.BIT(); break; // BIT (absolute) case 0x2d: this.AbsoluteRead(); this.AndR(); break; // AND (absolute) case 0x2e: this.AbsoluteRead(); this.ModifyWrite(this.ROL()); break; // ROL (absolute) @@ -396,18 +396,18 @@ namespace EightBit case 0x31: this.IndirectIndexedYRead(); this.AndR(); break; // AND (indirect indexed Y) case 0x35: this.ZeroPageXRead(); this.AndR(); break; // AND (zero page, X) case 0x36: this.ZeroPageXRead(); this.ModifyWrite(this.ROL()); break; // ROL (zero page, X) - case 0x38: this.Swallow(); this.SetFlag(StatusBits.CF); break; // SEC (implied) + case 0x38: this.SwallowRead(); this.SetFlag(StatusBits.CF); break; // SEC (implied) case 0x39: this.AbsoluteYRead(); this.AndR(); break; // AND (absolute, Y) case 0x3d: this.AbsoluteXRead(); this.AndR(); break; // AND (absolute, X) - case 0x3e: this.AbsoluteXAddress(); this.FixupR(); this.ModifyWrite(this.ROL()); break; // ROL (absolute, X) + case 0x3e: this.AbsoluteXAddress(); this.FixupRead(); this.ModifyWrite(this.ROL()); break; // ROL (absolute, X) - case 0x40: this.Swallow(); this.RTI(); break; // RTI (implied) + case 0x40: this.SwallowRead(); this.RTI(); break; // RTI (implied) case 0x41: this.IndexedIndirectXRead(); this.EorR(); break; // EOR (indexed indirect X) case 0x45: this.ZeroPageRead(); this.EorR(); break; // EOR (zero page) case 0x46: this.ZeroPageRead(); this.ModifyWrite(this.LSR()); break; // LSR (zero page) - case 0x48: this.Swallow(); this.Push(this.A); break; // PHA (implied) + case 0x48: this.SwallowRead(); this.Push(this.A); break; // PHA (implied) case 0x49: this.ImmediateRead(); this.EorR(); break; // EOR (immediate) - case 0x4a: this.Swallow(); this.A = this.LSR(this.A); break; // LSR A (implied) + case 0x4a: this.SwallowRead(); this.A = this.LSR(this.A); break; // LSR A (implied) case 0x4c: this.AbsoluteAddress(); this.Jump(this.Bus.Address.Word); break; // JMP (absolute) case 0x4d: this.AbsoluteRead(); this.EorR(); break; // EOR (absolute) case 0x4e: this.AbsoluteRead(); this.ModifyWrite(this.LSR()); break; // LSR (absolute) @@ -416,18 +416,18 @@ namespace EightBit case 0x51: this.IndirectIndexedYRead(); this.EorR(); break; // EOR (indirect indexed Y) case 0x55: this.ZeroPageXRead(); this.EorR(); break; // EOR (zero page, X) case 0x56: this.ZeroPageXRead(); this.ModifyWrite(this.LSR()); break; // LSR (zero page, X) - case 0x58: this.Swallow(); this.ResetFlag(StatusBits.IF); break; // CLI (implied) + case 0x58: this.SwallowRead(); this.ResetFlag(StatusBits.IF); break; // CLI (implied) case 0x59: this.AbsoluteYRead(); this.EorR(); break; // EOR (absolute, Y) case 0x5d: this.AbsoluteXRead(); this.EorR(); break; // EOR (absolute, X) - case 0x5e: this.AbsoluteXAddress(); this.FixupR(); this.ModifyWrite(this.LSR()); break; // LSR (absolute, X) + case 0x5e: this.AbsoluteXAddress(); this.FixupRead(); this.ModifyWrite(this.LSR()); break; // LSR (absolute, X) - case 0x60: this.Swallow(); this.RTS(); break; // RTS (implied) + case 0x60: this.SwallowRead(); this.Return(); break; // RTS (implied) case 0x61: this.IndexedIndirectXRead(); this.ADC(); break; // ADC (indexed indirect X) case 0x65: this.ZeroPageRead(); this.ADC(); break; // ADC (zero page) case 0x66: this.ZeroPageRead(); this.ModifyWrite(this.ROR()); break; // ROR (zero page) - case 0x68: this.Swallow(); this.SwallowStack(); this.A = this.Through(this.Pop()); break; // PLA (implied) + case 0x68: this.SwallowRead(); this.SwallowPop(); this.A = this.Through(this.Pop()); break; // PLA (implied) case 0x69: this.ImmediateRead(); this.ADC(); break; // ADC (immediate) - case 0x6a: this.Swallow(); this.A = this.ROR(this.A); break; // ROR A (implied) + case 0x6a: this.SwallowRead(); this.A = this.ROR(this.A); break; // ROR A (implied) case 0x6c: this.IndirectAddress(); this.Jump(this.Bus.Address.Word); break; // JMP (indirect) case 0x6d: this.AbsoluteRead(); this.ADC(); break; // ADC (absolute) case 0x6e: this.AbsoluteRead(); this.ModifyWrite(this.ROR()); break; // ROR (absolute) @@ -436,17 +436,17 @@ namespace EightBit case 0x71: this.IndirectIndexedYRead(); this.ADC(); break; // ADC (indirect indexed Y) case 0x75: this.ZeroPageXRead(); this.ADC(); break; // ADC (zero page, X) case 0x76: this.ZeroPageXRead(); this.ModifyWrite(this.ROR()); break; // ROR (zero page, X) - case 0x78: this.Swallow(); this.SetFlag(StatusBits.IF); break; // SEI (implied) + case 0x78: this.SwallowRead(); this.SetFlag(StatusBits.IF); break; // SEI (implied) case 0x79: this.AbsoluteYRead(); this.ADC(); break; // ADC (absolute, Y) case 0x7d: this.AbsoluteXRead(); this.ADC(); break; // ADC (absolute, X) - case 0x7e: this.AbsoluteXAddress(); this.FixupR(); this.ModifyWrite(this.ROR()); break; // ROR (absolute, X) + case 0x7e: this.AbsoluteXAddress(); this.FixupRead(); this.ModifyWrite(this.ROR()); break; // ROR (absolute, X) case 0x81: this.IndexedIndirectXAddress(); this.MemoryWrite(A); break; // STA (indexed indirect X) case 0x84: this.ZeroPageAddress(); this.MemoryWrite(this.Y); break; // STY (zero page) case 0x85: this.ZeroPageAddress(); this.MemoryWrite(this.A); break; // STA (zero page) case 0x86: this.ZeroPageAddress(); this.MemoryWrite(this.X); break; // STX (zero page) - case 0x88: this.Swallow(); this.Y = this.DEC(this.Y); break; // DEY (implied) - case 0x8a: this.Swallow(); this.A = this.Through(this.X); break; // TXA (implied) + case 0x88: this.SwallowRead(); this.Y = this.DEC(this.Y); break; // DEY (implied) + case 0x8a: this.SwallowRead(); this.A = this.Through(this.X); break; // TXA (implied) case 0x8c: this.AbsoluteAddress(); this.MemoryWrite(this.Y); break; // STY (absolute) case 0x8d: this.AbsoluteAddress(); this.MemoryWrite(this.A); break; // STA (absolute) case 0x8e: this.AbsoluteAddress(); this.MemoryWrite(this.X); break; // STX (absolute) @@ -456,9 +456,9 @@ namespace EightBit case 0x94: this.ZeroPageXAddress(); this.MemoryWrite(this.Y); break; // STY (zero page, X) case 0x95: this.ZeroPageXAddress(); this.MemoryWrite(this.A); break; // STA (zero page, X) case 0x96: this.ZeroPageYAddress(); this.MemoryWrite(this.X); break; // STX (zero page, Y) - case 0x98: this.Swallow(); this.A = this.Through(this.Y); break; // TYA (implied) + case 0x98: this.SwallowRead(); this.A = this.Through(this.Y); break; // TYA (implied) case 0x99: this.AbsoluteYAddress(); this.Fixup(); this.MemoryWrite(this.A); break; // STA (absolute, Y) - case 0x9a: this.Swallow(); this.S = this.X; break; // TXS (implied) + case 0x9a: this.SwallowRead(); this.S = this.X; break; // TXS (implied) case 0x9d: this.AbsoluteXAddress(); this.Fixup(); this.MemoryWrite(this.A); break; // STA (absolute, X) case 0xa0: this.ImmediateRead(); this.Y = this.Through(); break; // LDY (immediate) @@ -467,9 +467,9 @@ namespace EightBit case 0xa4: this.ZeroPageRead(); this.Y = this.Through(); break; // LDY (zero page) case 0xa5: this.ZeroPageRead(); this.A = this.Through(); break; // LDA (zero page) case 0xa6: this.ZeroPageRead(); this.X = this.Through(); break; // LDX (zero page) - case 0xa8: this.Swallow(); this.Y = Through(this.A); break; // TAY (implied) + case 0xa8: this.SwallowRead(); this.Y = Through(this.A); break; // TAY (implied) case 0xa9: this.ImmediateRead(); this.A = this.Through(); break; // LDA (immediate) - case 0xaa: this.Swallow(); this.X = this.Through(this.A); break; // TAX (implied) + case 0xaa: this.SwallowRead(); this.X = this.Through(this.A); break; // TAX (implied) case 0xac: this.AbsoluteRead(); this.Y = this.Through(); break; // LDY (absolute) case 0xad: this.AbsoluteRead(); this.A = this.Through(); break; // LDA (absolute) case 0xae: this.AbsoluteRead(); this.X = this.Through(); break; // LDX (absolute) @@ -479,9 +479,9 @@ namespace EightBit case 0xb4: this.ZeroPageXRead(); this.Y = this.Through(); break; // LDY (zero page, X) case 0xb5: this.ZeroPageXRead(); this.A = this.Through(); break; // LDA (zero page, X) case 0xb6: this.ZeroPageYRead(); this.X = this.Through(); break; // LDX (zero page, Y) - case 0xb8: this.Swallow(); this.ResetFlag(StatusBits.VF); break; // CLV (implied) + case 0xb8: this.SwallowRead(); this.ResetFlag(StatusBits.VF); break; // CLV (implied) case 0xb9: this.AbsoluteYRead(); this.A = this.Through(); break; // LDA (absolute, Y) - case 0xba: this.Swallow(); this.X = this.Through(this.S); break; // TSX (implied) + case 0xba: this.SwallowRead(); this.X = this.Through(this.S); break; // TSX (implied) case 0xbc: this.AbsoluteXRead(); this.Y = this.Through(); break; // LDY (absolute, X) case 0xbd: this.AbsoluteXRead(); this.A = this.Through(); break; // LDA (absolute, X) case 0xbe: this.AbsoluteYRead(); this.X = this.Through(); break; // LDX (absolute, Y) @@ -491,9 +491,9 @@ namespace EightBit case 0xc4: this.ZeroPageRead(); this.CMP(this.Y); break; // CPY (zero page) case 0xc5: this.ZeroPageRead(); this.CMP(this.A); break; // CMP (zero page) case 0xc6: this.ZeroPageRead(); this.ModifyWrite(this.DEC()); break; // DEC (zero page) - case 0xc8: this.Swallow(); this.Y = this.INC(this.Y); break; // INY (implied) + case 0xc8: this.SwallowRead(); this.Y = this.INC(this.Y); break; // INY (implied) case 0xc9: this.ImmediateRead(); this.CMP(this.A); break; // CMP (immediate) - case 0xca: this.Swallow(); this.X = this.DEC(this.X); break; // DEX (implied) + case 0xca: this.SwallowRead(); this.X = this.DEC(this.X); break; // DEX (implied) case 0xcc: this.AbsoluteRead(); this.CMP(this.Y); break; // CPY (absolute) case 0xcd: this.AbsoluteRead(); this.CMP(this.A); break; // CMP (absolute) case 0xce: this.AbsoluteRead(); this.ModifyWrite(this.DEC()); break; // DEC (absolute) @@ -502,19 +502,19 @@ namespace EightBit case 0xd1: this.IndirectIndexedYRead(); this.CMP(this.A); break; // CMP (indirect indexed Y) case 0xd5: this.ZeroPageXRead(); this.CMP(this.A); break; // CMP (zero page, X) case 0xd6: this.ZeroPageXRead(); this.ModifyWrite(this.DEC()); break; // DEC (zero page, X) - case 0xd8: this.Swallow(); this.ResetFlag(StatusBits.DF); break; // CLD (implied) + case 0xd8: this.SwallowRead(); this.ResetFlag(StatusBits.DF); break; // CLD (implied) case 0xd9: this.AbsoluteYRead(); this.CMP(this.A); break; // CMP (absolute, Y) case 0xdd: this.AbsoluteXRead(); this.CMP(this.A); break; // CMP (absolute, X) - case 0xde: this.AbsoluteXAddress(); this.FixupR(); this.ModifyWrite(this.DEC()); break; // DEC (absolute, X) + case 0xde: this.AbsoluteXAddress(); this.FixupRead(); this.ModifyWrite(this.DEC()); break; // DEC (absolute, X) case 0xe0: this.ImmediateRead(); this.CMP(this.X); break; // CPX (immediate) case 0xe1: this.IndexedIndirectXRead(); this.SBC(); break; // SBC (indexed indirect X) case 0xe4: this.ZeroPageRead(); this.CMP(this.X); break; // CPX (zero page) case 0xe5: this.ZeroPageRead(); this.SBC(); break; // SBC (zero page) case 0xe6: this.ZeroPageRead(); this.ModifyWrite(INC()); break; // INC (zero page) - case 0xe8: this.Swallow(); this.X = this.INC(this.X); break; // INX (implied) + case 0xe8: this.SwallowRead(); this.X = this.INC(this.X); break; // INX (implied) case 0xe9: this.ImmediateRead(); this.SBC(); break; // SBC (immediate) - case 0xea: this.Swallow(); break; // NOP (implied) + case 0xea: this.SwallowRead(); break; // NOP (implied) case 0xec: this.AbsoluteRead(); this.CMP(this.X); break; // CPX (absolute) case 0xed: this.AbsoluteRead(); this.SBC(); break; // SBC (absolute) case 0xee: this.AbsoluteRead(); this.ModifyWrite(this.INC()); break; // INC (absolute) @@ -523,10 +523,10 @@ namespace EightBit case 0xf1: this.IndirectIndexedYRead(); this.SBC(); break; // SBC (indirect indexed Y) case 0xf5: this.ZeroPageXRead(); this.SBC(); break; // SBC (zero page, X) case 0xf6: this.ZeroPageXRead(); this.ModifyWrite(this.INC()); break; // INC (zero page, X) - case 0xf8: this.Swallow(); this.SetFlag(StatusBits.DF); break; // SED (implied) + case 0xf8: this.SwallowRead(); this.SetFlag(StatusBits.DF); break; // SED (implied) case 0xf9: this.AbsoluteYRead(); this.SBC(); break; // SBC (absolute, Y) case 0xfd: this.AbsoluteXRead(); this.SBC(); break; // SBC (absolute, X) - case 0xfe: this.AbsoluteXAddress(); this.FixupR(); this.ModifyWrite(this.INC()); break; // INC (absolute, X) + case 0xfe: this.AbsoluteXAddress(); this.FixupRead(); this.ModifyWrite(this.INC()); break; // INC (absolute, X) } return cycles != this.Cycles; @@ -690,13 +690,13 @@ namespace EightBit this.Bus.Address.High = this.FixedPage; } - protected void MaybeFixupR() + protected void MaybeFixupRead() { this.MaybeFixup(); this.MemoryRead(); } - protected void FixupR() + protected void FixupRead() { this.Fixup(); this.MemoryRead(); @@ -815,19 +815,19 @@ namespace EightBit protected void AbsoluteXRead() { this.AbsoluteXAddress(); - this.MaybeFixupR(); + this.MaybeFixupRead(); } protected void AbsoluteYRead() { this.AbsoluteYAddress(); - this.MaybeFixupR(); + this.MaybeFixupRead(); } protected void IndirectIndexedYRead() { this.IndirectIndexedYAddress(); - this.MaybeFixupR(); + this.MaybeFixupRead(); } #endregion @@ -846,7 +846,7 @@ namespace EightBit if (condition) { var relative = (sbyte)this.Bus.Data; - this.Swallow(); + this.SwallowRead(); this.NoteFixedAddress(this.PC.Word + relative); this.MaybeFixup(); this.Jump(this.Bus.Address.Word); @@ -1041,30 +1041,30 @@ namespace EightBit private void JSR() { this.Intermediate.Low = this.FetchByte(); - this.SwallowStack(); + this.SwallowPop(); this.PushWord(this.PC); - this.Intermediate.High = this.FetchByte(); - this.PC.Word = this.Intermediate.Word; + this.PC.High = this.FetchByte(); + this.PC.Low = this.Intermediate.Low; } private void PHP() => this.Push(SetBit(this.P, StatusBits.BF)); private void PLP() { - this.SwallowStack(); + this.SwallowPop(); this.P = ClearBit(SetBit(this.Pop(), StatusBits.RF), StatusBits.BF); } private void RTI() { this.PLP(); - this.Return(); + base.Return(); } - private void RTS() + protected override void Return() { - this.SwallowStack(); - this.Return(); + this.SwallowPop(); + base.Return(); this.SwallowFetch(); }