Académique Documents
Professionnel Documents
Culture Documents
STUDENT KIT
ENGINEERING
LAB MODULE TM
Authors
1st Revision : Assoc. Prof. Datin Dr. Wahidah Mansor Date : July 2009
Chair : Date :
MICROPROCESSOR MODULE -
ADDRESSING MODES & DATA MOVEMENT INSTRUCTIONS ECE501
Signature :
MODULE OUTCOMES:
MO1: Write simple assembly language programs for the MC68000 CPU using data transfer
instructions and execute the programs on the MC68000 trainer
MO2: Write simple programs to assign data to memory and registers using various addressing
modes.
THEORETICAL BACKGROUND:
The Motorola MC68000 Central Processing Unit is capable of accessing a linear address space
of 16 Mbytes. Like other microprocessor system, the MC68000 Trainer Board consists of two
types of memory; ROM and RAM. All resources available on the Trainer Board are controlled by
the monitor program that is stored in ROM. The ROM occupies memory locations 000000H-
07FFFFH. The program that is written by a user is stored in RAM. This memory occupies
specific addresses, for example 400400H up to 43FFFFH. Therefore, user programs should be
started at an address 400400H.
The programming model of the CPU describes the register set and the number of bits that can
be held by the registers. This programming model needs to be understood before writing
assembly language programs for the MC68000 CPU.
MICROPROCESSOR MODULE -
ADDRESSING MODES & DATA MOVEMENT INSTRUCTIONS ECE501
Figure 1 shows the MC68000 programming model This processor has eight data registers; D0
to D7, eight address registers; A0 to A7, a program counter (PC) and status register (SR). All
registers except for the status register can hold a maximum of 32 bit data. The function of the
data registers is to store information (data) within the MC68000 CPU itself whereas the address
registers are used to store the location (memory address) of the data stored in the external
memory chips.
There are four types of data transfer instructions provided by the 68000 microprocessor:
a) register to register c) register to memory
b) memory to register d) memory to memory
Data transfer instructions involve instructions such as MOVE, MOVEA, MOVEM, MOVEQ,
SWAP etc to copy or move data between the various locations.
Data Register Direct and Address Register Direct addressing modes are used to address data
registers and address registers. Table 1 shows the assembler syntax of some commonly used
addressing modes for transferring data.
PRE-LAB WORK:
Read the document, especially the Experimental Work section. Search the internet and grasp
as much as possible the material before going to the lab. Students should be able to write
simple programs using different addressing modes and data movement instructions. In this pre-
lab work, the Easy68k software has to be used to enter, edit and execute your programs.
Please ensure that your pre-lab findings are verified by the instructor before you begin your
experimental work.
3. Execute the following program and state the contents of the affected registers and the
memory location. Explain the function of the program.
4. Write a program that will store $A4, $2B65 in two data registers and copy these values
in memory locations $400650 and $400652 respectively.
5. Execute the following program and state the contents of the affected registers and the
memory location. Explain the benefit of using this addressing mode in a program.
ORG $080C00
MOVE.W #$3846, D1
LEA $400460, A1
MOVE.W D0, (A1)
MOVE.B (A1), D2
MOVE.W (A1), D5
END
MICROPROCESSOR MODULE -
ADDRESSING MODES & DATA MOVEMENT INSTRUCTIONS ECE501
6. Execute the following program and explain the result of each instruction.
ORG $400400
NUM1 EQU $69C3
NUM2 EQU $E72B
MOVE.W #NUM1, D0
MOVE.W #NUM2, D1
MOVEA.L #$400450, A0
MOVE.B (A0), D1
MOVE.W (A0), D0
ORG $400450
DC.W $B243
END
Verification by Instructor
..................PLEASE SIGN.............................
(Name: )
EXPERIMENTAL WORK:
Apparatus:
a.A Personal computer installed with the MC68000 CPU Editor/Assembler and Simulator
software, EASy68K.
b. MC68000 CPU Trainer Board (Kaycomp II or Flight Model).
Exercises:
All the programs in the exercises have to be written and assembled using the EASy68K
simulator. To observe the results, the programs have to be downloaded and executed on the
MC68000 CPU Trainer Board. The contents of the affected registers and memory locations
have to be examined through single stepping or breakpoints setting.
1. Write a 68K assembly language program that will store $A2345600 in a data register
and copy the content of this data register to another data register using
a. Byte movement
b. Word movement
2. Two types of instructions can be used to load a value into an address register, LEA and
MOVEA. Set the value of A1 to $400400 and $ABCD using the following instructions
a. LEA.
b. MOVEA.L
c. MOVEA.W
3. Write a program that will store 16 bit data in two registers and exchange the contents of
these registers using EXG instruction.
4. Write a program that stores the value of $12345678 into a data register and copy the
HIGH WORD in location $400450 and the LOW WORD in memory location $400600.
5. Locations $400440 and $400441 contain a word number. Write a program which will
load the contents of these memory locations in a data register and copy the content of
these memory into memory locations $400450 and $400451 respectively using the
following modes of addressing:
6. Location $400450 contains a long word number. Write a program which will load the
contents of this memory location in a data register and copy the content of this memory
into memory location $400454 using the following addressing modes:
REPORT SECTION
FACULTY OF ELECTRICAL
STUDENT
ENGINEERING
LAB REPORT
UNIVERSITI TEKNOLOGI MARA
Program: EE250 Sem : 4
Ownership : Center of Computer Engineering Studies (CCES)
FKE Doc.ID : Date Issued : 2009
Lab Instructor :
MICROPROCESSOR MODULE -
ADDRESSING MODES & DATA MOVEMENT INSTRUCTIONS ECE501
RESULTS:
1) For each of the exercise, tabulate the contents of the affected memory locations, status
register, address register and data register before and after program execution as shown in
Table 2.
Verification by Instructor
DISCUSSIONS:
1) Discuss the results obtained in the experiment for each exercise.
2) Explain the difference between the MOVEA.W and MOVEA.L instructions.
MICROPROCESSOR MODULE -
ADDRESSING MODES & DATA MOVEMENT INSTRUCTIONS ECE501
QUIZ:
A set of questions will be presented by lab instructor and students are expected to answer all
questions before concluding the experiment. This could be in the form of written or oral quiz.
CONCLUSION:
Conclude in detail the findings and the outcomes of this experiment. This should include the
summary of knowledge gained, comments and discussion of the results, errors and their
possible sources and how this experiment can be improved.
REFERENCES:
END
MICROPROCESSOR MODULE -
ADDRESSING MODES & DATA MOVEMENT INSTRUCTIONS ECE501
GRADING SECTION
FACULTY OF ELECTRICAL
STUDENT
ENGINEERING
LAB GRADE
UNIVERSITI TEKNOLOGI MARA
Program: EE250 Sem : 4
Ownership : Center of Computer Engineering Studies (CCES)
FKE Doc.ID : Date Issued : 2009
COMMENTS:
Assessor: Signature: