《6502指令集(英文)》由会员分享,可在线阅读,更多相关《6502指令集(英文)(12页珍藏版)》请在金锄头文库上搜索。
1、6502/6510/8500/8502 Opcode matrix:imm = #$00zp = $00zpx = $00,Xzpy = $00,Yizx = ($00,X)izy = ($00),Yabs = $0000abx = $0000,Xaby = $0000,Yind = ($0000)rel = $0000 (PC-relative) x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF0x BRK7ORAizx 6KILSLOizx 8NOPzp 3ORAzp 3ASLzp 5SLOzp 5PHP3ORAimm 2ASL2ANCimm
2、2NOPabs 4ORAabs 4ASLabs 6SLOabs 61xBPLrel 2*ORAizy 5*KILSLOizy 8NOPzpx 4ORAzpx 4ASLzpx 6SLOzpx 6CLC2ORAaby 4*NOP2SLOaby 7NOPabx 4*ORAabx 4*ASLabx 7SLOabx 72xJSRabs 6ANDizx 6KILRLAizx 8BITzp 3ANDzp 3ROLzp 5RLAzp 5PLP4ANDimm 2ROL2ANCimm 2BITabs 4ANDabs 4ROLabs 6RLAabs 63xBMIrel 2*ANDizy 5*KILRLAizy 8N
3、OPzpx 4ANDzpx 4ROLzpx 6RLAzpx 6SEC2ANDaby 4*NOP2RLAaby 7NOPabx 4*ANDabx 4*ROLabx 7RLAabx 74x RTI6EORizx 6KILSREizx 8NOPzp 3EORzp 3LSRzp 5SREzp 5PHA3EORimm 2LSR2ALRimm 2JMPabs 3EORabs 4LSRabs 6SREabs 65xBVCrel 2*EORizy 5*KILSREizy 8NOPzpx 4EORzpx 4LSRzpx 6SREzpx 6CLI2EORaby 4*NOP2SREaby 7NOPabx 4*EOR
4、abx 4*LSRabx 7SREabx 76x RTS6ADCizx 6KILRRAizx 8NOPzp 3ADCzp 3RORzp 5RRAzp 5PLA4ADCimm 2ROR2ARRimm 2JMPind 5ADCabs 4RORabs 6RRAabs 67xBVSrel 2*ADCizy 5*KILRRAizy 8NOPzpx 4ADCzpx 4RORzpx 6RRAzpx 6SEI2ADCaby 4*NOP2RRAaby 7NOPabx 4*ADCabx 4*RORabx 7RRAabx 78xNOPimm 2STAizx 6NOPimm 2SAXizx 6STYzp 3STAzp
5、 3STXzp 3SAXzp 3DEY2NOPimm 2TXA2XAAimm 2STYabs 4STAabs 4STXabs 4SAXabs 49xBCCrel 2*STAizy 6KILAHXizy 6STYzpx 4STAzpx 4STXzpy 4SAXzpy 4TYA2STAaby 5TXS2TASaby 5SHYabx 5STAabx 5SHXaby 5AHXaby 5AxLDYimm 2LDAizx 6LDXimm 2LAXizx 6LDYzp 3LDAzp 3LDXzp 3LAXzp 3TAY2LDAimm 2TAX2LAXimm 2LDYabs 4LDAabs 4LDXabs 4
6、LAXabs 4BxBCSrel 2*LDAizy 5*KILLAXizy 5*LDYzpx 4LDAzpx 4LDXzpy 4LAXzpy 4CLV2LDAaby 4*TSX2LASaby 4*LDYabx 4*LDAabx 4*LDXaby 4*LAXaby 4*CxCPYimm 2CMPizx 6NOPimm 2DCPizx 8CPYzp 3CMPzp 3DECzp 5DCPzp 5INY2CMPimm 2DEX2AXSimm 2CPYabs 4CMPabs 4DECabs 6DCPabs 6DxBNErel 2*CMPizy 5*KILDCPizy 8NOPzpx 4CMPzpx 4D
7、ECzpx 6DCPzpx 6CLD2CMPaby 4*NOP2DCPaby 7NOPabx 4*CMPabx 4*DECabx 7DCPabx 7ExCPXimm 2SBCizx 6NOPimm 2ISCizx 8CPXzp 3SBCzp 3INCzp 5ISCzp 5INX2SBCimm 2NOP2SBCimm 2CPXabs 4SBCabs 4INCabs 6ISCabs 6FxBEQrel 2*SBCizy 5*KILISCizy 8NOPzpx 4SBCzpx 4INCzpx 6ISCzpx 6SED2SBCaby 4*NOP2ISCaby 7NOPabx 4*SBCabx 4*IN
8、Cabx 7ISCabx 7* : add 1 cycle if page boundary is crossed.add 1 cycle on branches if taken.Logical and arithmetic commands:Opcode imp imm zp zpxzpy izx izy abs abx abyindrel Function N V B D IZ CORA $09 $05 $15 $01 $11 $0D $1D $19 A:=A or adr * * AND $29 $25 $35 $21 $31 $2D $3D $39 A:=A&adr * * EOR
9、$49 $45 $55 $41 $51 $4D $5D $59 A:=A exor adr * * ADC $69 $65 $75 $61 $71 $6D $7D $79 A:=A+adr * * * *SBC $E9 $E5 $F5 $E1 $F1 $ED $FD $F9 A:=A-adr * * * *CMP $C9 $C5 $D5 $C1 $D1 $CD $DD $D9 A-adr * * *CPX $E0 $E4 $EC X-adr * * *CPY $C0 $C4 $CC Y-adr * * *DEC $C6 $D6 $CE $DE adr:=adr-1 * * DEX $CA X:
10、=X-1 * * DEY $88 Y:=Y-1 * * INC $E6 $F6 $EE $FE adr:=adr+1 * * INX $E8 X:=X+1 * * INY $C8 Y:=Y+1 * * ASL $0A $06 $16 $0E $1E adr:=adr*2 * * *ROL $2A $26 $36 $2E $3E adr:=adr*2+C * * *LSR $4A $46 $56 $4E $5E adr:=adr/2 * * *ROR $6A $66 $76 $6E $7E adr:=adr/2+C*128 * * *Move commands:Opcode imp imm zp
11、 zpx zpy izx izy abs abx aby ind rel Function N V B D I Z CLDA $A9 $A5 $B5 $A1 $B1 $AD $BD $B9 A:=adr * * STA $85 $95 $81 $91 $8D $9D $99 adr:=A LDX $A2 $A6 $B6 $AE $BE X:=adr * * STX $86 $96 $8E adr:=X LDY $A0 $A4 $B4 $AC $BC Y:=adr * * STY $84 $94 $8C adr:=Y TAX $AA X:=A * * TXA $8A A:=X * * TAY $
12、A8 Y:=A * * TYA $98 A:=Y * * TSX $BA X:=S * * TXS $9A S:=X PLA $68 A:=+(S) * * PHA $48 (S)-:=A PLP $28 P:=+(S) * * * * * *PHP $08 (S)-:=P Jump/Flag commands:Opcode imp imm zp zpx zpy izx izy abs abx aby ind rel Function N V B D I Z CBPL $10 branch on N=0 BMI $30 branch on N=1 BVC $50 branch on V=0 B
13、VS $70 branch on V=1 BCC $90 branch on C=0 BCS $B0 branch on C=1 BNE $D0 branch on Z=0 BEQ $F0 branch on Z=1 BRK $00 (S)-:=PC,P PC:=($FFFE) 1 1 RTI $40 P,PC:=+(S) * * * * * *JSR $20 (S)-:=PC PC:=adr RTS $60 PC:=+(S) JMP $4C $6C PC:=adr BIT $24 $2C N:=b7 V:=b6 Z:=A&adr * * * CLC $18 C:=0 0SEC $38 C:=1 1CLD $D8 D:=0 0 SED $F8 D:=1 1 CLI $58 I:=0 0 SEI $78 I:=1 1 CLV $B8 V:=0 0 NOP $EA Flags of the status register:The processor status register has 8 bits, where 7 are used as flags:N = negative