Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. namespace NesEmu
  9. {
  10.     public class CPU6502
  11.     {
  12.         // Registers (8-bit)
  13.         public byte regA = 0x00;
  14.         public byte regX = 0x00;
  15.         public byte regY = 0x00;
  16.  
  17.         // Stack pointer (8-bit)
  18.         public byte stackPointer = 0x00;
  19.  
  20.         // Status (8-bit)
  21.         public byte status = 0x00;
  22.  
  23.         // Flags (1-bit)
  24.         //public bool carryFlag = false;
  25.         //public bool zeroFlag = false;
  26.         //public bool interruptDisable = false;
  27.         //public bool decimalMode = false;
  28.         //public bool breakCommand = false;
  29.         //public bool overflowFlag = false;
  30.         //public bool negativeFlag = false;
  31.  
  32.        
  33.  
  34.         // Program counter (16-bit)
  35.         public ushort programCounter = 0x0000;
  36.  
  37.        
  38.         // Opcodes (it begins...)
  39.         // LDX - Load X Register
  40.         // Immediate
  41.         public void opcode0xA2(byte value)
  42.         {
  43.             // Load the X register with the hex "value"
  44.             this.regX = value;
  45.         }
  46.  
  47.         // Zero Page
  48.         public void opcode0xA6(byte value)
  49.         {
  50.             this.regX = value;
  51.         }
  52.  
  53.         // Zero Page, Y
  54.         public void opcode0xB6(byte value)
  55.         {
  56.             this.regX = (byte)(value + this.regY);
  57.         }
  58.  
  59.         // Absolute
  60.         public void opcode0xAE(byte value)
  61.         {
  62.             this.regX = value;
  63.         }
  64.  
  65.         // Absolute, Y
  66.         public void opcode0xBE(byte value)
  67.         {
  68.             this.regX = (byte)(value + this.regY);
  69.         }
  70.  
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement