addressing modes for m6800
DESCRIPTION
Describes addressing modes for M6800 micro processorTRANSCRIPT
-
Knowing that there are alternative methods to
implement our steps we can reexamine the previous
assembly language program.
Assm language
# ~ Comment
CLR $000F 3 6 extended mode
LDX #$0000 3 3 to use indexed mode the index register needs to be initialized.
CLR $0F,X 2 7 indexed mode
LDAA $0E 2 3 direct mode
LDAA $000E 3 4 extended mode could have been used however since address of switches is between $0000 and $00FF, a full 16 bit address is unnecessary.
LDAA $0E,X 2 5 index mode (in this case it is assumed that the index register was previously initialized by the earlier LDX instruction.
ECE 3010 ELEMENTS OF ELEC. MACHINES AND DIGITAL SYSTEMS CHAPTER 3
B. YOSHIDA, P.ENG 2013 V1.3.4 3-47
-
Assm language
# ~ Comment
CMPA #$00 2 2 immediate mode used since the value used for the comparison is a constant.
BEQ off 2 4
LDAB #$01 2 2 immediate mode used since the value used is a constant.
STAB $0F 2 4 Direct mode
STAB $000F 3 3 extended mode could have been used however since address of switches is between $0000 and $00FF, a full 16 bit address is unnecessary.
STAB $0F,X 2 6 index mode (in this case it is assumed that the index register was previously initialized by the earlier LDX instruction.
JMP $0003 3 3 Extended mode
ECE 3010 ELEMENTS OF ELEC. MACHINES AND DIGITAL SYSTEMS CHAPTER 3
B. YOSHIDA, P.ENG 2013 V1.3.4 3-48
-
Assm language
# ~ Comment
JMP $03,X 2 4 index mode (in this case it is assumed that appropriate value was placed in the index register by the earlier LDX instruction.
LDAA #$00 2 2 Immediate mode
CLRA 1 2 Implied mode - alternative method to load $00 into accumulator A
STAA $0F 2 4 Direct mode
STAA $000F 3 5 extended mode could have been used however since address of switches is between $0000 and $00FF, a full 16 bit address is unnecessary.
STAB $0F,X 2 6 index mode (in this case it is assumed that the index register was previously initialized by the earlier LDX instruction.
ECE 3010 ELEMENTS OF ELEC. MACHINES AND DIGITAL SYSTEMS CHAPTER 3
B. YOSHIDA, P.ENG 2013 V1.3.4 3-49
-
Assm language
# ~ Comment
JMP $0003 3 3 Extended mode
JMP $03,X 2 4 index mode (in this case it is assumed that the index register was previously initialized by the earlier LDX instruction.
Based on the alternatives available we can see that
different addressing modes / instruction choices will affect
the amount of memory required to store the program as
well as the amount of time required to execute the
program.
Example E3.5 - Modifying the simple program Modify the door ajar light system to indicates if it is a
front door or rear door which is open. Also determine
how much memory is required for your program, and
how long it will take to respond to a change in a door if
the microprocessor is running at 1MHz.
ECE 3010 ELEMENTS OF ELEC. MACHINES AND DIGITAL SYSTEMS CHAPTER 3
B. YOSHIDA, P.ENG 2013 V1.3.4 3-50