Nintendo Entertainment System >> 硬體資訊

CPU


參考資料:
1. 6502.txt
2. Nesdev_Wiki
3. 6502opcodes.html
4. 6502_instruction_set.html

Register

8 Bits8 BitsDescription
AAccumulator
XX Rrgister
YY Register
SPStack Pointer
SRStatus Register
PCProgram Counter
$2000PPUCTRL
$2001PPUMASK
$2002PPUSTATUS
$2003OAMADDR
$2004OAMDATA
$2005PPUSCROLL
$2006PPUADDR
$2007PPUDATA
$4000SQ1_VOL, Duty and volume for square wave 1
$4001SQ1_SWEEP, Sweep control register for square wave 1
$4002SQ1_LO, Low byte of period for square wave 1
$4003SQ1_HI, High byte of period and length counter value for square wave 1
$4004SQ2_VOL, Duty and volume for square wave 2
$4005SQ2_SWEEP, Sweep control register for square wave 2
$4006SQ2_LO, Low byte of period for square wave 2
$4007SQ2_HI, High byte of period and length counter value for square wave 2
$4008TRI_LINEAR, Triangle wave linear counter
$4009Unused, but is eventually accessed in memory-clearing loops
$400ATRI_LO, Low byte of period for triangle wave
$400BTRI_HI, High byte of period and length counter value for triangle wave
$400CNOISE_VOL, Volume for noise generator
$400DUnused, but is eventually accessed in memory-clearing loops
$400ENOISE_LO, Period and waveform shape for noise generator
$400FNOISE_HI, Length counter value for noise generator
$4010DMC_FREQ, Play mode and frequency for DMC samples
$4011DMC_RAW, 7-bit DAC
$4012DMC_START, Start of DMC waveform is at address $C000 + $40*$xx
$4013DMC_LEN, Length of DMC waveform is $10*$xx + 1 bytes (128*$xx + 8 samples)
$4014OAMDMA, Writing $xx copies 256 bytes by reading from $xx00-$xxFF and writing to OAMDATA ($2004)
$4015SND_CHN, Sound channels enable and status
$4016JOY1, Joystick 1 data (R) and joystick strobe (W)
$4017JOY2, Joystick 2 data (R) and frame counter control (W)
$4018-$401FAPU and I/O functionality that is normally disabled. See CPU Test Mode.

Status

Bit76543210
(S) Sign flag (V) Overflow flag (B) Software interrupt flag (D) BCD(I)Interrupt enable/disable flag (Z) Zero flag (C) Carry flag

Instruction Set

InstructionDescription
ADCAdd Memory to Accumulator with Carry
AND"AND" Memory with Accumulator
ASLShift Left One Bit (Memory or Accumulator)
BCCBranch on Carry Clear
BCSBranch on Carry Set
BEQBranch on Result Zero
BITTest Bits in Memory with Accumulator
BMIBranch on Result Minus
BNEBranch on Result not Zero
BPLBranch on Result Plus
BRKForce Break
BVCBranch on Overflow Clear
BVSBranch on Overflow Set
CLCClear Carry Flag
CLDClear Decimal Mode
CLIClear interrupt Disable Bit
CLVClear Overflow Flag
CMPCompare Memory and Accumulator
CPXCompare Memory and Index X
CPYCompare Memory and Index Y
DECDecrement Memory by One
DEXDecrement Index X by One
DEYDecrement Index Y by One
EOR"Exclusive-Or" Memory with Accumulator
INCIncrement Memory by One
INXIncrement Index X by One
INYIncrement Index Y by One
JMPJump to New Location
JSRJump to New Location Saving Return Address
LDALoad Accumulator with Memory
LDXLoad Index X with Memory
LDYLoad Index Y with Memory
LSRShift Right One Bit (Memory or Accumulator)
NOPNo Operation
ORA"OR" Memory with Accumulator
PHAPush Accumulator on Stack
PHPPush Processor Status on Stack
PLAPull Accumulator from Stack
PLPPull Processor Status from Stack
ROLRotate One Bit Left (Memory or Accumulator)
RORRotate One Bit Right (Memory or Accumulator)
RTIReturn from Interrupt
RTSReturn from Subroutine
SBCSubtract Memory from Accumulator with Borrow
SECSet Carry Flag
SEDSet Decimal Mode
SEISet Interrupt Disable Status
STAStore Accumulator in Memory
STXStore Index X in Memory
STYStore Index Y in Memory
TAXTransfer Accumulator to Index X
TAYTransfer Accumulator to Index Y
TSXTransfer Stack Pointer to Index X
TXATransfer Index X to Accumulator
TXSTransfer Index X to Stack Pointer
TYATransfer Index Y to Accumulator

Opcode

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x BRK ORA X, ind ORA zero ASL zero PHP ORA # ASL A ORA abs ASL abs
1x BPL rel ORA ind, Y ORA zero, X ASL zero, X CPC ORA abs, Y ORA abs, X ASL abs, X
2x JSR abs AND X, ind BIT zero AND zero ROL zero PLP AND # ROL A BIT abs AND abs ROL abs
3x BMI rel AND ind, Y AND zero, X ROL zero, X SEC AND abs, Y AND abs, X ROL abs, X
4x RTI EOR X, ind EOR zero LSR zero PHA EOR # LSR A JMP abs EOR abs LSR abs
5x BVC rel EOR ind, Y EOR zero, X LSR zero, X CLI EOR abs, Y EOR abs, X LSR abs, X
6x RTS ADC X, ind ADC zero ROR zero PLA ADC # ROR A JMP ind ADC abs ROR abs
7x BVS rel ADC ind, Y ADC zero, X ROR zero, X SEI ADC abs, Y ADC abs, X ROR abs, X
8x STA X, ind STY zero STA zero STX zero DEY TXA STY abs STA abs STX abs
9x BCC rel STA ind, Y STY zero, X STA zero, X STX zero, X TYA STA abs, Y TXS STA abs, X
Ax LDY # LDA X, ind LDX # LDY zero LDA zero LDX zero TAY LDA # TAX LDY abs LDA abs LDX abs
Bx BCS rel LDA ind, Y LDY zero, X LDA zero, X LDX zero, Y CLV LDA abs, Y TSX LDY abs, X LDA abs, X LDX abs, Y
Cx CPY # CMP X, ind CPY zero CMP zero DEC zero INY CMP # DEX CPY abs CMP abs DEC abs
Dx BNE rel CMP ind, Y CMP zero, X DEC zero, X CLD CMP abs, Y CMP abs, X DEC abs, X
Ex CPX # SBC X, ind CPX zero SBC zero INC zero INX SBC # NOP CPX abs SBC abs INC abs
Fx BEQ rel SBC ind, Y SBC zero, X INC zero, X SED SBC abs, Y SBC abs, X INC abs, X

Cycles

AssemblyOpodeBytesCycles
ADC #Immediate6922
ADC ZeroPage6523
ADC ZeroPage,X7524
ADC Absolute6034
ADC Absolute,X7034*
ADC Absolute,Y7934*
ADC (Indirect,X)6126
ADC (Indirect),Y7125*
AND #Immediate2922
AND ZeroPage2523
AND ZeroPage,X3524
AND Absolute2D34
AND Absolute,X3D34*
AND Absolute,Y3934*
AND (Indirect,X)2126
AND (Indirect),Y3125
ASL A0A12
ASL ZeroPage0625
ASL ZeroPage,X1626
ASL Absolute0E36
ASL Absolute,X1E37
BCC Relative9022*
BCS RelativeB022*
BEQ RelativeF022*
BIT ZeroPage2423
BIT Absolute2C34
BMI Relative3022*
BNE RelativeD022*
BPL Relative1022*
BRK0017
BVC Relative5022*
BVS Relative7022*
CLC1812
CLDD812
CLI5812
CLVB812
CMP #ImmediateC922
CMP ZeroPageC523
CMP ZeroPage,XD524
CMP AbsoluteCD34
CMP Absolute,XDD34*
CMP Absolute,YD934*
CMP (Indirect,X)C126
CMP (Indirect),YD125*
CPX #ImmediateE022
CPX ZeroPageE423
CPX AbsoluteEC34
CPY #ImmediateC022
CPY ZeroPageC423
CPY AbsoluteCC34
DEC ZeroPageC625
DEC ZeroPage,XD626
DEC AbsoluteCE36
DEC Absolute,XDE37
DEXCA12
DEY8812
EOR #Immediate4922
EOR ZeroPage4523
EOR ZeroPage,X5524
EOR Absolute4034
EOR Absolute,X5034*
EOR Absolute,Y5934*
EOR (Indirect,X)4126
EOR (Indirect),Y5125*
INC ZeroPageE625
INC ZeroPage,XF626
INC AbsoluteEE36
INC Absolute,XFE37
INXE812
INYC812
JMP Absolute4C33
JMP Indirect6C35
JSR Absolute2036
LDA #ImmediateA922
LDA ZeroPageA523
LDA ZeroPage,XB524
LDA AbsoluteAD34
LDA Absolute,XBD34*
LDA Absolute,YB934*
LDA (Indirect,X)A126
LDA (Indirect),YB125*
LDA #ImmediateA222
LDA ZeroPageA623
LDA ZeroPage,YB624
LDA AbsoluteAE34
LDA Absolute,YBE34*
LDY #ImmediateA022
LDY ZeroPageA423
LDY ZeroPage,XB424
LDY AbsoluteAC34
LDY Absolute,XBC34*
LSR A4A12
LSR ZeroPage4625
LSR ZeroPage,X5626
LSR Absolute4E36
LSR Absolute,X5E37
NOPEA12
ORA #Immediate0922
ORA ZeroPage0523
ORA ZeroPage,X1524
ORA Absolute0D34
ORA Absolute,X1D34*
ORA Absolute,Y1934*
ORA (Indirect,X)0126
ORA (Indirect),Y1125
PHA4813
PHP0813
PLA6814
PLP2814
ROR A2A12
ROL ZeroPage2625
ROL ZeroPage,X3626
ROL Absolute2E36
ROL Absolute,X3E37
ROR A6A12
ROR ZeroPage6625
ROR ZeroPage,X7626
ROR Absolute6E36
ROR Absolute,X7E37
RTI4D16
RTS6016
SBC #ImmediateE922
SBC ZeroPageE523
SBC ZeroPage,XF524
SBC AbsoluteED34
SBC Absolute,XFD34*
SBC Absolute,YF934*
SBC (Indirect,X)E126
SBC (Indirect),YF125
SEC3812
SEDF812
SEI7812
STA ZeroPage8523
STA ZeroPage,X9524
STA Absolute8034
STA Absolute,X9035
STA Absolute,Y9935
STA (Indirect,X)8126
STA (Indirect),Y9126
STX ZeroPage8623
STX ZeroPage,Y9624
STX Absolute8E34
STY ZeroPage8423
STY ZeroPage,X9424
STY Absolute8C34
TAXAA12
TAYA812
TSXBA12
TXA8A12
TXS9A12
TYA9812

Memory Map

RangeSizeDevice
$0000-$07FF$08002KB internal RAM(zero page is $0000-$00FF)
$0800-$0FFF$0800Mirrors of $0000-$07FF
$1000-$17FF$0800Mirrors of $0000-$07FF
$1800-$1FFF$0800Mirrors of $0000-$07FF
$2000-$2007$0008NES PPU registers
$2008-$3FFF$1FF8Mirrors of $2000-2007 (repeats every 8 bytes)
$4000-$4017$0018NES APU and I/O registers
$4018-$401F$0008APU and I/O functionality that is normally disabled
$4020-$FFFF$BFE0Cartridge space: PRG ROM, PRG RAM, and mapper registers
$6000-$7FFF$1FFFBattery Backed Save or Work RAM
$8000-$FFFF$7FFFUsual ROM, commonly with Mapper Registers
$FFFA-$FFFB$0002NMI vector
$FFFC-$FFFD$0002Reset vector
$FFFE-$FFFF$0002IRQ/BRK vector


返回上一頁