Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Super NES Programming/65c816 reference

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

65816 Internal Registers bits RegisterDescription 8 or 16 AThe accumulator. This is the math register. It stores one of two operands or the result of most arithmetic and logical operations. 8 or 16 X, YThe index registers. These can be used to reference memory, to pass data to memory, or as counters for loops. 16 SThe stack pointer, points to the next available(unused) location on the stack. 8 DBRData bank register, holds the default bank for memory transfers. 16 DDirect page register, used for direct page addressing modes. 8 PBRProgram Bank, holds the bank address of all instruction fetches. 8 PProcessor Status, holds various important flags, see below. 16 PCProgram counter Flags stored in P register MnemonicValueBinary Value DescriptionN#$8010000000Negative Condition codes used for branch instructions.V#$4001000000OverflowZ#$0200000010ZeroC#$0100000001CarryD#$0800001000DecimalI#$0400000100IRQ disableX#$1000010000Index register size (native mode only) (0 = 16-bit, 1 = 8-bit)M#$2000100000Accumulator register size (native mode only) (0 = 16-bit, 1 = 8-bit)Enot in P6502 emulation modeB#$1000010000Break (emulation mode only) Instructions Arithmetic and Logical Instructions InstructionDescriptionArgumentsFlags setADCAdd A with something and carry bit. Result is put in A.Immediate value or addressn,v,z,c Arithmetic instructionsSBCSubtract something and the carry bit.n,v,z,cANDAND A with memory, storing result in A.Immediate value or addressn,z Logical instructionsEORExclusive orn,zORAOR A with memory, storing result in A.Immediate value or addressn,zTSBTest and set bitszTRBTest and reset bitszASLArithmetic shift left A or address n,z,c Shift instructionsLSRLogical shift right A or address n,z,cROLRotate left A or address n,z,cRORRotate right A or address n,z,cBITtest bits, settingimmediate value or addressn,v,z (only z if in immediate mode) Test instructionsCMPCompare accumulator with memoryn,z,cCPXCompare register X with memoryn,z,cCPYCompare register Y with memoryn,z,cDEADecrement Accumulatorn,zDECDecrement, see INCn,zDEXDecrement X registern,zDEYDecrement Y registern,zINAIncrement Accumulatorn,zINCIncrement, see DECn,zINXIncrement X registern,zINYIncrement Y registern,zNOPNo operationnoneXBAExchange bytes of accumulatorn,z Load/Store Instructions InstructionDescriptionLDALoad accumulator from memoryLDXLoad register X from memoryLDYLoad register Y from memorySTAStore accumulator in memorySTXStore register X in memorySTYStore register Y in memorySTZStore zero in memory Transfer Instructions Instruction Description Flags affectedTAX Transfer Accumulator to index register X n,zTAY Transfer Accumulator to index register Y n,zTCD Transfer 16-bit Accumulator to Direct Page register n,zTCS Transfer 16-bit Accumulator to Stack Pointer noneTDC Transfer Direct Page register to 16-bit Accumulator n,zTSC Transfer Stack Pointer to 16-bit Accumulator n,zTSX Transfer Stack Pointer to index register X n,zTXA Transfer index register X to Accumulator n,zTXS Transfer index register X to Stack Pointer noneTXY Transfer index register X to index register Y n,zTYA Transfer index register Y to Accumulator n,zTYX Transfer index register Y to index register X n,z Branch Instructions Instruction DescriptionBCCBranch if Carry flag is clear (C=0)BCSBranch if Carry flag is set (C=1)BNEBranch if not equal (Z=0)BEQBranch if equal (Z=1)BPLBranch if plus (N=0)BMIBranch if minus (N=1)BVCBranch if overflow flag is clear (V=0)BVSBranch if overflow flag is set (V=1)BRABranch Always (unconditional)BRLBranch Always Long (unconditional) Jump and call instructions InstructionDescriptionJMPJumpJMLJump longJSRJump and save return addressJSLJump long and save return addressRTSReturn from subroutineRTLReturn long from subroutine Interrupt instructions InstructionDescriptionBRKGenerate software interruptCOPGenerate coprocessor interruptRTIReturn from interruptSTPStop processor until RESETWAIWait for hardware interrupt P Flag instructions InstructionDescriptionCLCClear carry flagCLDClear decimal flag (binary arithmetic)CLIEnable interrupt requestsCLVClear overflow flagREPReset status bits (for example REP #%00100000 clears the M flag)SECSet carry flagSEDSet decimal flag (decimal arithmetic)SEPSet status bits (for example SEP #%00010000 sets the X flag)SEIDisable interrupt requestsXCEExchange carry flag with emulation flag Stack Instructions InstructionDescriptionPHAPush Accumulator Push instructionsPHXPush index register XPHYPush index register YPHDPush direct page registerPHBPush data bank registerPHKPush Program Bank RegisterPHPPush processor statusPEAPush effective addressPEIPush effective indirect addressPERPush effective relative addressPLAPull Accumulator Pull instructionsPLXPull index register XPLYPull index register YPLPPull processor statusPLDPull direct page registerPLBPull data bank register 65816 Opcode Table. Addressing modes +ModeExampleImplied PHBImmediate[MemoryFlag] AND #1 or 2 bytesImmediate[IndexFlag] LDX #1 or 2 bytesImmediate[8-Bit] SEP #byteRelative BEQ byte (signed)Relative long BRL 2bytes (signed)Direct AND byteDirect indexed (with X) AND byte, xDirect indexed (with Y) AND byte, yDirect indirect AND (byte)Direct indexed indirect AND (byte, x)Direct indirect indexed AND (byte), yDirect indirect long AND [byte]Direct indirect indexed long AND [byte], yAbsolute AND 2bytesAbsolute indexed (with X) AND 2bytes, xAbsolute indexed (with Y) AND 2bytes, yAbsolute long AND 3bytesAbsolute indexed long AND 3bytes, xStack relative AND byte, sStack relative indirect indexed AND (byte, s), yAbsolute indirect JMP (2bytes)Absolute indirect long JML [2bytes]Absolute indexed indirect JMP/JSR (2bytes,x)Implied accumulator INCBlock move MVN/MVP byte, byte External links A 6502 Programmer's Introduction to the 65816 Programming the 65816 65816 Primer