Upload
nami-zaini
View
231
Download
1
Embed Size (px)
Citation preview
8/19/2019 Lab 1 Addressing Modes
1/13
FACULTY OF ELECTRICAL ENGINEERING
UNIVERSITI TEKNOLOGI MARA
INTRODUCTION TO MICROPROCESSOR SYSTEMS LABORATORY (ECE354)
Lab Experiment : Experiment #1
Title of Experiment : Directive Assembler and Addressing Modes of
68HC12 Assembly Language Programming
Group :
Dateline : 4 February 2016
Members :
No. Name Matrix Card No.
1
2
3
Assessments :
riteria Marks
Programming .lst (complete with comments) /10
Results /20
Discussions /20
Conclusions /10
Questions /40
Total marks /100
8/19/2019 Lab 1 Addressing Modes
2/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 2
Contents
EXPERIMENT 1 ....................................................................................................... 3
1.0 OBJECTIVES ..................................................................................................... 3
2.0 LIST OF REQUIREMENTS ............................................................................ 3
2.1 Equipments .................................................................................................... 3
3.0 THEORY .......................................................................................................... 3
4.0 PROCEDURE 1 ............................................................................................... 5
4.1 QUESTION 1 ................................................................................................ 6
5.0 PROCEDURE 2 ............................................................................................... 6
5.1 QUESTION 2 ................................................................................................ 8
6.0 QUESTION 3 ................................................................................................... 8
7.0 INSTRUCTIONS ...........................................................................................10
8.0 REFERENCES ...............................................................................................10
Appendix 1 ...........................................................................................................11
8/19/2019 Lab 1 Addressing Modes
3/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 3
FACULTY OF ELECTRICAL ENGINEERING
UNIVERSITI TEKNOLOGI MARA
________________________________________________________________
INTORDUCTION TO MICROPROCESSOR SYSTEMS LABORATORY(ECE354)
EXPERIMENT 1
DIRECTIVE ASSEMBLER AND ADDRESSING MODES OF 68HC12 ASSEMBLYLANGUAGE PROGRAMMING
1.0 OBJECTIVES
i) To understand the directives assembler of 68HC12
ii) To understand the fundamental of addressing modes in 68HC12
iii) To determine the machine language and content inside the CPU registers and
memory
2.0 LIST OF REQUIREMENTS
2.1 Equipments
1. Personal Computer
2. Installer of J2RE
3. Installer of MiniIDE
4. Installer of HC12SIM
5. Power supply
3.0 THEORY
A 68HC12 instruction consists of one or two bytes of opcode and zero to five bytes of
operand addressing information. The opcode byte(s) specifies the operation to be performed
8/19/2019 Lab 1 Addressing Modes
4/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 4
and the addressing modes to be used to access the operand(s). The first byte of a two-byte
opcode is $18.
Addressing modes determines how the CPU accesses memory locations to be operated
upon. Addressing modes supported by the 68HC12 are summarized in Table 3.0.
Table 3.0
8/19/2019 Lab 1 Addressing Modes
5/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 5
4.0 PROCEDURE 1
1. Install all the software required by the experiment.
2. Write a program as Figure 4.0 in MiniIDE with comments, translate to the list file and
machine file.
ORG $0800 ;DIRECTIVE ASSEMBLER TABLE1: DC.B 20,98,56,48 ; store the data into memory TABLE2: DC.W $3E,$F4VAR1: DS.W 5 ;reserve the memory for future use TABLE3: DC.L 25
ORG $0900 ;ADDRESSING MODES TYPES : INH,IMM,EXT LDX #$20FF ; X
8/19/2019 Lab 1 Addressing Modes
6/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 6
4.1 QUESTION 1
Draw a table as illustrated in Table Q1 and show each instruction in Procedure 1 correspond to
the machine code. Determine its addressing mode.
Table Q1Address of
memory
Machine code Mnemonic Addressing Mode
ORG $2000 Directive Assembler
$2000 CC 98 3E LDD #$983E Immediate Mode
$2003 O2 INY Inherent Mode
END Directive Assembler
5.0 PROCEDURE 2
1. Write a program as Figure 5.0 in MiniIDE with comments, translate to the list file and
machine file.
ORG $0800 ;Indexed addressing modes LDAA 2,X ; A
8/19/2019 Lab 1 Addressing Modes
7/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 7
Table 5.0
CPU registers /
Memory
Initial value
A 73H
B 68H
IX 0900H
IY 09FFH
SP 0B00H
PC 0800H
$0902 A6H
$090F 09H
$0910 80H
$0980 BFH
$0A0C E1H
$0AF9 3EH
$0AFA 8CH
3. Write a discussion regarding to this procedure. (Hint: State type of addressing modes
that are using in Procedure 1 and explain them)
8/19/2019 Lab 1 Addressing Modes
8/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 8
5.1 QUESTION 2
Draw a table as illustrated in Table Q2 and show each instruction in Procedure 2 correspond to
the machine code. Determine its addressing mode.
Table Q2
Address of
memoryMachine code Mnemonic Addressing Mode Range of offset
ORG $0900 Directive Assembler
$0900 A6 43 LDAA 3,Y 5-bit offset constant
index addressing
(IDX)
-16 to 15
$0902 6B E2 D11B STAB -12005,X 16-bit offset
constant inex
addressing (IDX2)
-32,768 to 32,767
And 0 to 216-1
END Directive Assembler
6.0 QUESTION 3
1. Write a program to load an immediate data to accumulator as following :
A =89, B = 65, X = 1000H, Y=2000H
2. Write a program to store a group of data in memory with starting address at $0900 as
Table 6.02.
Table 6.02
Address of
memoryData/Content
$0900 85H
$0901 00H
$0902 00H
$0903 00H
$0904 00H
8/19/2019 Lab 1 Addressing Modes
9/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 9
$0905 DDH
$0906 AAH
3. Write a program to execute actions as Table 6.03, and then determine its addressing
mode.
Table 6.03
Instruction
numberExecutions
0 Start your program at $0800
1 Load the contents of the memory location into
accumulator A with the address equal to the sum of
the values of accumulator B and index register Y.
A
8/19/2019 Lab 1 Addressing Modes
10/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 10
4. Identify the addressing modes for the following instructions:i) LDAA 10,Xii) STAB 100,Yiii) LDX -1,Yiv) STAA -18,Xv) ABA
vi) LDY #$2525vii) STAA $1500
7.0 INSTRUCTIONS
Pre-lab:
1. Fill in the result table.
2. Before participating first lab session, please refer to the module Chapter 3 and learn how to
use MGTEK MiniIDE and simulator at home. You can also refer to sitisararais.blogspot.com
and open in Blendspace for further clarification.
Group works:
Your final report should be included:
1. Front page.
2. Programming:List file of your programming include comments as Figure 7.0.
Figure 7.0
3. Result table.
4. Discussion for each procedure.
5. Answer all the questions.
6. Conclusion of your experiments.
7. Submit before the dateline given.
8.0 REFERENCES
[1] S. F. Barret and D. J. Pack. (2005). Embedded Systems : Design and Application with the68HC12 and HCS12.
[2] H.-W. Huang. (2009). Introduction to the 68HC12 Microcontroller .
8/19/2019 Lab 1 Addressing Modes
11/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 11
Appendix 1
Table 1 procedure 1
Address of memory Data/content of memory
Before execution
dc.b 20,98,56,48
dc.w $3E,$F4
ds.w 5
8/19/2019 Lab 1 Addressing Modes
12/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 12
dc. l 25
CPU Register A B X Y SP
Before
execution
LDX #$20FF
INX
LDY #$10AA
INY
LDAA #$EE
LDAB #$CC
DECA
ABA
LDS $902
8/19/2019 Lab 1 Addressing Modes
13/13
ECE354 Introduction to Microprocessor System
Prepared by :
Siti Sara Binti Rais
FKE UiTM Dungun Page 13
Table 2 Procedure 2
Instruction
Before execution After execution
CPU
register
Data in
CPU
Register
Address of
memory
Data in
memory
CPU
register
Data in
CPU
Register
Address
of
memory
Data in
memory
LDAA 2,X
STAB -7,Y
LDAB -244,SP
STAA 100,PC
LDD B,Y
LDAA [15,X]
STAA 2,SP-
LDX 5,-SP
STAA 4,+SP