Vous êtes sur la page 1sur 9

FACULTY OF ELECTRICAL

STUDENT KIT
ENGINEERING
LAB MODULETM

UNIVERSITI TEKNOLOGI MARA


Program: EE250 Sem : 4
Ownership : Center of Computer Engineering Studies (CCES)
FKE Doc.ID : Date Issued : 2009

ELECTRICAL ENGINEERING LABORATORY I


COURSE CODE: ECE501

MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS


(M2)

Authors

Prepared by : Assoc. Prof Datin Dr. Wahidah Mansor Date : June 2009

1st Revision : Date :

2nd Revision : Date :

Endorsement by Center of Studies

Chair : Date :
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

Signature :

MODULE OUTCOMES:
Upon completion of this experiment, students should be able to:

MO1: Write the MC68000 assembly language programs using arithmetic, logic and bit
manipulation instructions.

THEORETICAL BACKGROUND:
The M68000 microprocessor supports a variety of data manipulation instructions such as integer
arithmetic, boolean, shift and rotate, bit manipulation and BCD instructions. The integer
arithmetic instructions include add (eg. ADD) and subtract (eg SUB), compare (eg. CMP),
multiply (eg. MULS, MULU), divide (e.g DIVU, DIVS), clear (e.g CLR) and negate (e.g. NEG)
instructions. The Boolean instructions are divided into three parts; logical instructions (e.g.
AND, ORI), set conditional instruction (Scc) and test instruction (TST).

The shift instructions allow data to be shifted one at a time in the left or right direction whereas
the rotate instructions perform circular operation. Examples of shift instructions are ASL, ASR,
LSL and LSR. The rotate instructions are ROL, ROR, ROXR and ROXL. Bit manipulation (eg.
BCHG, BCLR, BSET and BTST) provides the capability to set, clear, complement, or test
individual bit in the destination operand. The MC68000 also provides instructions for adding,
subtracting and negating BCD numbers; such as ABCD, NBCD and SBCD instructions.

PRE-LAB WORK:
Read the document, especially the Experimental Work section. Students should be able to write
a simple program by answering the following questions. Please ensure that your pre-lab findings
are verified by the instructor before you begin your experimental work.

1. Write and execute a program that add the numbers $26, $43, $B8 and $9E together. The result
must be stored in memory location $400500.

2. a) Write and execute the following program. Explain the result of each instruction.
ORG $400400
MOVE.W #$FF27, D2
MOVE.W #$FE5B, D3
SUB.W D2, D3
END
b) Change the instruction SUB.W to SUB.L for the program in 3 a) above, execute the
program and explain the difference in the results.
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

3. Examine the difference between DIVU and DIVS instructions by executing a program that
i) divides $FFFFFF88 by $00000014 using DIVS
ii) divides $000009C4 by $000001F4 using DIVU.
Explain on the results obtained.

4. Write, assemble and execute a program that complement the bits 2, 4, 8, 9, 12 and 15 in a data
register stored with $A2BDE589, leaving all other bits unchanged.

5. a) Write and execute a program that adds the numbers $34 and $68 using
(i) ABCD instruction.
(ii) ADD instruction.
Explain on the results obtained.

b) Change the ABCD instruction for the program in 5 a) with SBCD instruction. Write and
execute the program, explain on the results obtained.

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).

Procedure:

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.

Exercises:

1. Write and execute a program that add the four 8-bit numbers $25, $87, $AE and $F9 using:
Byte addition.
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

Word addition.
Long word addition
The result must be stored in memory location $400450.

2. Write and execute a program that will subtract $FF26 from $FE9A using
i). Word subtraction
ii). Long word subtraction.
Store the results in memory location $400500.

3. Write and execute a program that divides $0008B120 by $0000018C using DIVU.

4. Examine the function of the MULS and MULU instructions by executing a program that
multiply the numbers $FFF0 and $FFF6 using both instructions.

5. a) Write and execute a program that logically AND the high word of the numbers
$AB5E4865 and $4B9DA32C. Explain on the result obtained.
b) Modify Part 5 a) to perform a logical OR of the low word of the two numbers. Execute the
program.

6. Examine the difference in the results obtained after the ASL and LSL operations performed
three times on the low word of the number $654AE2D4.
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

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

COMPUTER ENGINEERING LABORATORY


COURSE CODE: ECE501
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS

NOTE: SUBMIT REPORT IMMEDIATELY AFTER THE LAB SESSION!


Prepared by : Student ID :
1.
2.
3.
4.
5.
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

Group : Lab Date : Submission Date :

Lab Instructor :

RESULTS:

TABLE 2 Examples of result


1) For
Before Program Execution After Program each
Execution of the
Registers/ Contents Registers/ Contents
Memory Memory
Locations Locations
D0
D1
A0
A1
SR
$400450
:
$400600
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.
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

Verification by Instructor

..........PLEASE SIGN ................................


(Name: )

DISCUSSIONS:
1) Discuss the results obtained in the experiment for each exercise.

2) For exercise 2 and 3, explain the differences in the results obtained when different types of sizes
are used in the program.

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:

1) Antonakos, J.L., The 68000 Microprocessor: Hardware and Software Principles &
Applications, Prentice-Hall, latest edition.
2) Subbarao, W.V., 16/32 Bit Microprocessors 68000/68010/ 68020. Mac Millan, latest edition.
3) Mimar, T., Programming and Designing with 68000 Family, Prentice-Hall, latest edition.

END
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS 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
MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS ECE501

COMPUTER ENGINEERING LABORATORY


COURSE CODE: ECE501

MICROPROCESSOR MODULE – ARITHMETIC & LOGIC OPERATIONS

NOTE: RETURN THE GRADED REPORT TO THE RESPECTIVE LAB


(DUE 2 WEEKS AFTER SUBMISSION DATE)

Parameter Marks Parameter Marks


Pre-Lab Work (15%) Quiz (15%)
Results (30%) Conclusion (10%)
Discussions (30%)
Group : Date : Total Marks (100%)
COMMENTS:

Assessor: Signature:

Vous aimerez peut-être aussi