Back
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
PC = 0102 (adc $2043 instruction 4 cycles)
MAR<-PC Place PC contents on address bus, signal read required.
MBR<-M[MAR] Read opcode = 8a into data register from memory.
PC<-PC+1 Increment PC. PC = 0103
IR<-MBR Move opcode to instruction register.
Decode opcode - indicates that next 2 bytes in memory
are the address of the needed data.
PC = 0103
MAR<-PC Place PC contents on address bus, signal read required.
MBR<-M[MAR] Fetch byte = 43 into data register.
PC<-PC+1 Increment PC. PC = 0104
TL<-MBR Move retrieved data into lower half of a double width
temporary register.
PC = 0104
MAR<-PC Place PC contents on address bus, signal read required.
MBR<-M[MAR] Fetch byte = 20 into data register.
PC<-PC+1 Increment PC. PC = 0105
TH<-MBR Move retrieved data into upper half of a double width
temporary register.
Signal read.
MAR<-TH/TL Move combined address to memory address register.
MBR<-M[MAR] Fetch byte at memory 2043 into data register.
AC<-AC+MBR Add data to Accumulator
AC<-AC+CC[carry bit] Add carry if set.
Change CC Set carry flag if value overflows storage.
Next