Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace NesEmu
- {
- public class CPU6502
- {
- // Registers (8-bit)
- public byte regA = 0x00;
- public byte regX = 0x00;
- public byte regY = 0x00;
- // Stack pointer (8-bit)
- public byte stackPointer = 0x00;
- // Status (8-bit)
- public byte status = 0x00;
- // Flags (1-bit)
- //public bool carryFlag = false;
- //public bool zeroFlag = false;
- //public bool interruptDisable = false;
- //public bool decimalMode = false;
- //public bool breakCommand = false;
- //public bool overflowFlag = false;
- //public bool negativeFlag = false;
- // Program counter (16-bit)
- public ushort programCounter = 0x0000;
- // Opcodes (it begins...)
- // LDX - Load X Register
- // Immediate
- public void opcode0xA2(byte value)
- {
- // Load the X register with the hex "value"
- this.regX = value;
- }
- // Zero Page
- public void opcode0xA6(byte value)
- {
- this.regX = value;
- }
- // Zero Page, Y
- public void opcode0xB6(byte value)
- {
- this.regX = (byte)(value + this.regY);
- }
- // Absolute
- public void opcode0xAE(byte value)
- {
- this.regX = value;
- }
- // Absolute, Y
- public void opcode0xBE(byte value)
- {
- this.regX = (byte)(value + this.regY);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement