MCS6500 Microcomputer System Hardware Manual

Publication No. 6500-10A

January 1976, 2nd Ed.

copyright © 1976, MOS Technology, Inc.

APPENDIX A

SUMMARY OF SINGLE-CYCLE EXECUTION

This section contains an outline of the data on both the address bus and the data bus for each cycle of the various processor instructions. It tells the system designer exactly what to expect while single-cycling through a program.

Note that the processor will not stop in any cycle where R/W is a 0 (WRITE cycle). Instead, it will go right into the next READ cycle and stop there. For this reason, some instructions may appear to be shorter than indicated here.

All Instructions begin with T0 and the fetch of the OP CODE and continue through the required number of cycles until the next T0 and the fetch of the next OP CODE.

While the basic terminology used in this appendix is discussed in the Programming Manual, it has been defined below for ease of reference while studying Single-Cycle Execution.

OP CODE
The first byte of the instruction containing the operator and mode of address.
OPERAND
The data on which the operation specified In the OP CODE is performed.
BASE ADDRESS
The address in Indexed addressing modes which specifies the location in memory to which indexing is referenced. The high-order byte of the base address (AB08 to AB15) is BAH (Base Address High) and the low-order byte of the base address (AB00 to AB07) is BAL (Base Address Low).
EFFECTIVE ADDRESS
The destination in memory in which data are to be found. The effective address may be loaded directly as in the case of Page Zero and Absolute Addressing or may be calculated as in Indexing operations. The high-order byte of the effective address (AB08 to AB15) is ADH and the low-order byte of the effective address (AB00 to AB07) is ADL.
INDIRECT ADDRESS
The address found in the operand of instructions utilizing (Indirect),Y which contains the low-order byte of the base address. IAH and IAL represent the high- and low-order bytes.
JUMP ADDRESS
The value to be loaded into Program Counter as a result of a Jump instruction.

A. 1. SINGLE-BYTE INSTRUCTIONS

ASLDEXROLTAX
CLCDEYRORTAY
CLDINXSECTSX
CLIINYSEDTXA
CLVLSRSEITXS
NOP TYA

These single-byte instructions require two cycles to execute. During the second cycle the address of the next instruction in program sequence will be placed on the address bus. However, the OP CODE which appears on the data bus during the second cycle will be ignored. This same instruction will be fetched on the following cycle, at which time it will be decoded and executed. The ASL, LSR, ROL and ROR instructions apply to the accumulator mode of address.

A. 1.1 Implied Addressing (2 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1OP CODE (Discarded)1
T0PC + 1OP CODE1Next Instruction

A. 2. INTERNAL EXECUTION ON MEMORY DATA

ADCCMPEORLDY
ANDCPXLDAORA
BITCPYLDXSBC

The instructions listed above will execute by performing operations inside the microprocessor using data fetched from the effective address. This total operation requires three steps. The first step (one cycle) is the OP CODE fetch. The second (zero to four cycles) Is the calculation of an effective address. The final step is the fetching of the data from the effective address. Execution of the instruction takes place during the fetching and decoding of the next instruction.

A. 2.1. Immediate Addressing (2 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1Data1Fetch Data
T0PC + 2OP CODE1Next Instruction

A. 2.2. Zero Page Addressing (3 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Effective Address
T200, ADLData1Fetch Data
T0PC + 2OP CODE1Next Instruction

A. 2.3. Absolute Addressing (4 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Low-Order Effective Address Byte
T2PC + 2ADH1Fetch High-Order Effective Address Byte
T3ADH, ADLData1Fetch Data
T0PC + 3OP CODE1Next Instruction

A. 2.4. Indirect, X Addressing (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Page Zero Base Address
T200, BALData (Discarded)1
T300, BAL + XADL1Fetch Low-Order Byte of Effective Address
T400, BAL + X + 1ADH1Fetch High-Order Byte of Effective Address
T5ADH, ADLData1Fetch Data
T0PC + 2OP CODE1Next Instruction

A. 2.5. Absolute, X or Absolute, Y Addressing (4 or 5 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Low-Order Byte of Base Address
T2PC + 2BAH1Fetch High-Order Byte of Base Address
T3ADL: BAL + Index
ADH: BAH + C
Dataa1Fetch Data (No Page Crossing)
Carry is 0 or 1 as Required from Previous Add Operation
T4aADL: BAL + Index
ADH: BAH + 1
Data1Fetch Data from Next Page
T0PC + 3OP CODE1Next Instruction
  1. If the page boundary is crossed in the indexing operation, the data fetched in T3 is ignored. If page boundary is not crossed, the T4 cycle is bypassed.

A. 2.6. Zero Page, X or Zero Page, Y Addressing Modes (4 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Page Zero Base Address
T200, BALData (Discarded)1
T300, BAL + IndexData1Fetch Data (No Page Crossing)
T0PC + 2OP CODE1Next Instruction

A. 2.7. Indirect, Y Addressing Mode (5 or 6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1IAL1Fetch Page Zero Indirect Address
T200, IALBAL1Fetch Low-Order Byte of Base Address
T300, IAL + 1BAH1Fetch High-Order Byte of Base Address
T4ADL: BAL + Y
ADH: BAH + C
Dataa1Fetch Data from Same Page
Carry is 0 or 1 as Required from Previous Add Operation
T5aADL: BAL + Y
ADH: BAH + 1
Data1Fetch Data from Next Page
T0PC + 2OP CODE1Next Instruction
  1. If the page boundary is crossed in the indexing operation, the data fetched in T4 is ignored. If page boundary is not crossed, the T5 cycle is bypassed.

A. 3. STORE OPERATAIONS

STA
STX
STY

The specific steps taken in the Store Operations are very similar to those taken in the previous group (internal execution on memory data). However, in the Store Operation, the fetch of data is replaced by a WRITE (R/W = 0) cycle. No overlapping occurs and no shortening of the instruction time occurs on indexing operations.

A. 3.1. Zero Page Addressing (3 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Zero Page Effective Address
T200, ADLData0Write Internal Register to Memory
T0PC + 2OP CODE1Next Instruction

A. 3.2. Absolute Addressing (4 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Low-Order Byte of Effective Address
T2PC + 2ADH1Fetch High-Order Byte of Effective Address
T3ADH, ADLData0Write Internal Register to Memory
T0PC + 3OP CODE1Next Instruction

A. 3.3. Indirect, X Addressing (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Page Zero Base Address
T200, BALData (Discarded)1
T300, BAL + XADL1Fetch Low-Order Byte of Effective Address
T400, BAL + X + 1ADH1Fetch High-Order Byte of Effective Address
T5ADH, ADLData0Write Internal Register to Memory
T0PC + 2OP CODE1Next Instruction

A. 3.4. Absolute, X or Absolute, Y Addressing (5 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Low-Order Byte of Base Address
T2PC + 2BAH1Fetch High-Order Byte of Base Address
T3ADL: BAL + Index
ADH: BAH + C
Data (Discarded)1
T4ADH, ADLData0Write Internal Register to Memory
T0PC + 3OP CODE1Next Instruction

A. 3.5. Zero Page, X or Zero Page, Y Addressing Modes (4 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Page Zero Base Address
T200, BALData (Discarded)1
T3ADL: BAL + IndexData0Write Internal Register to Memory
T0PC + 2OP CODE1Next Instruction

A. 3.6. Indirect, Y Addressing Mode (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1IAL1Fetch Page Zero Indirect Address
T200, IALBAL1Fetch Low-Order Byte of Base Address
T300, IAL + 1BAH1Fetch High-Order Byte of Base Address
T4ADL: BAL + Y
ADH: BAH
Data (Discarded)1
T5ADH, ADLData0Write Internal Register to Memory
T0PC + 2OP CODE1Next Instruction

A. 4. READ -- MODIFY -- WRITE OPERATAIONS

ASLLSR
DECROL
INCROR

The Read -- Modify -- Write operations involve the loading of operands from the operand address, modification of the operand and the resulting modified data being stored in the original location.

A. 4.1. Zero Page Addressing (5 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Page Zero Effective Address
T200, ADLData1Fetch Data
T300, ADLData0
T400, ADLModified Data0Write Modified Data Back into Memory
T0PC + 2OP CODE1Next Instruction

A. 4.2. Absolute Addressing (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Low-Order Byte of Effective Address
T2PC + 2ADH1Fetch High-Order Byte of Effective Address
T3ADH, ADLData1Fetch Data
T4ADH, ADLData0
T5ADH, ADLModified Data0Write Modified Data Back into Memory
T0PC + 3OP CODE1Next Instruction

A. 4.3. Zero Page, X Addressing (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Page Zero Base Address
T200, BALData (Discarded)1
T3ADL: BAL + X
(w/o Carry)
Data1Fetch Data
T4ADL: BAL + X
(w/o Carry)
Data0
T5ADL: BAL + X
(w/o Carry)
Modified Data0Write Modified Data Back into Memory
T0PC + 2OP CODE1Next Instruction

A. 4.4. Absolute, X Addressing (7 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1BAL1Fetch Low-Order Byte of Base Address
T2PC + 2BAH1Fetch High-Order Byte of Base Address
T3ADL: BAL + X
ADH: BAH + C
Data (Discarded)1
T4ADL: BAL + X
ADH: BAH + C
Data1Fetch Data
T5ADH, ADLData0
T6ADH, ADLModified Data0Write Modified Data Back into Memory
T0PC + 3OP CODE1Next Instruction

A. 5. MISCELLANEOUS OPERATIONS

BCCBRKPHA
BCSBVCPHP
BEQBVSPLA
BMI PLP
BNEJMPRTI
BPLJSRRTS

A. 5.1. Push Operations -- PHP, PHA (3 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1OP CODE (Discarded)1
T2Stack PointerData0Write Internal Register into Stack
T0PC + 1OP CODE1Next Instruction

A. 5.2. Pull Operations -- PLP, PLA (4 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1OP CODE (Discarded)1
T2Stack PointerData (Discarded)1
T3Stack Pointer + 1Data1Fetch Data from Stack
T0PC + 1OP CODE1Next Instruction

A. 5.3. Jump to Subroutine -- JSR (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Low-Order Byte of Subroutine Address
T2Stack PointerData (Discarded)1
T3Stack PointerPCH0Push High-Order Byte of Program Counter to Stack
T4Stack Pointer - 1PCL0Push Low-Order Byte of Program Counter to Stack
T5PC + 2ADH1Fetch High-Order Byte of Subroutine Address
T0Subroutine Address (ADH, ADL)OP CODE1Next Instruction

A. 5.4. Break Operation -- (Hardware Interrupt)-BRK (7 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch BRK OP CODE (or Force BRK)
T1PC + 1
(PC on Hardware Interrupt)
Data (Discarded)1
T2Stack PointerPCH0Push High-Order Byte of Program Counter to Stack
T3Stack Pointer - 1PCL0Push Low-Order Byte of Program Counter to Stack
T4Stack Pointer - 2P0Push Status Register to Stack
T5FFFE
(NMI-FFFA)
(RES-FFFC)
ADL1Fetch Low-Order Byte of Interrupt Vector
T6FFFF
(NMI-FFFB)
(RES-FFFD)
ADH1Fetch High-Order Byte of Interrupt Vector
T0Interrupt Vector (ADH, ADL)OP CODE1Next Instruction

A. 5.5. Return from Interrupt -- RTI (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1Data (Discarded)1
T2Stack PointerData (Discarded)1
T3Stack Pointer + 1Data1Pull P from Stack
T4Stack Pointer + 2Data1Pull PCL from Stack
T5Stack Pointer + 3Data1Pull PCH from Stack
T0PCH, PCLOP CODE1Next Instruction

A. 5.6. Jump Operation -- JMP

A. 5.6.1 Absolute Addressing Mode (3 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1ADL1Fetch Low-Order Byte of Jump Address
T2PC + 2ADH1Fetch High-Order Byte of Jump Address
T0ADH, ADLOP CODE1Next Instruction

A. 5.6.2 Indirect Addressing Mode (5 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1IAL1Fetch Low-Order Byte of Indirect Address
T2PC + 2IAH1Fetch High-Order Byte of Indirect Address
T3IAH, IALADL1Fetch Low-Order Byte of Jump Address
T4IAH, IAL + 1ADH1Fetch High-Order Byte of Jump Address
T0ADH, ADLOP CODE1Next Instruction

A. 5.7. Return from Subroutine -- RTS (6 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1Data (Discarded)1
T2Stack PointerData (Discarded)1
T3Stack Pointer + 1PCL1Pull PCL from Stack
T4Stack Pointer + 2PCH1Pull PCH from Stack
T5PCH, PCL (from Stack)Data (Discarded)1
T0PCH, PCL + 1OP CODE1Next Instruction

A. 5.8. Branch Operation -- BCC, BCS, BEQ, BMI, BNE, BPL, BVC, BVS (2, 3, or 4 Cycles)

TnAddress BusData BusR/WComments
T0PCOP CODE1Fetch OP CODE
T1PC + 1Offset1Fetch Branch Offest
T2aPC + 2 + Offset (w/o Carry)OP CODE1Offset Added to Program Counter
T3bPC + 2 + Offset (with Carry)OP CODE1Carry Added
  1. Skip if branch not taken.
  2. Skip if branch not taken; skip if branch operation does not cross page boundary.