Lectures Datapath

How fetch/execute cycle processes a short assembler program:

The Program (6502 assembler):

0100 9a 23    lda #23    Load the byte value 23h into the accumulator
0102 8a 43 20 adc $2043  Add the byte of data found at memory 2043h
                         Also add one if carry flag set
0105 84 44 20 sta $2044  Store at memory 2044h

The Fetch/Execute sequence
# IP instruction pointer and PC program counter same. 

PC = 0100     (lda #23 instruction  2 cycles)
  MAR<-PC     Place PC contents on address bus, signal read required.
  MBR<-M[MAR] Read opcode = 9a into data register from memory.
  PC<-PC+1    Increment PC. PC = 0101  
  IR<-MBR     Move opcode to instruction register.
              Decode opcode - indicates that operand is needed.

PC = 0101  
  MAR<-PC     Place PC contents on address bus, signal read required.
  MBR<-M[MAR] Fetch byte = 23 into data register.
  PC<-PC+1    Increment PC. PC = 0102  
  AC<-MBR     Move byte into accumulator.

Next