Docsity

CMP Instruction - Microprocessor Systems - Exam, Exams of Microprocessors

Toggle sidebar
bg1
Cork Institute of Technology
Higher Certificate in Engineering in Electronic Engineering – Award
(NFQ Level 6)
Summer 2007
MICROPROCESSOR SYSTEMS
(Time: 3 Hours)
Answer Question 1 [40 marks] and any
three other questions [20 marks each]
Maximum available marks is 100
Examiners: Mr. J. J. O’Sullivan
Mr. D. Denieffe
Dr. R. Ó Dúbhghaill
Q1 (a) List the main parts of a microcomputer and state the function of each.
(b) In relation to computer programming, explain what is meant by assembly language.
List a number of advantages of using this type of programming language.
(c) How many hex digits in a byte, a word, a longword? - explain fully.
Below is a line of memory data as printed out on the Flight-68K computer:
400500: 427B 017D 1111 0000 FC4E 2E5F 16AE 52BC
Write down the following:
i) the word at $40050A
ii) the byte at $400503
iii) the longword at $400506
iv) the byte at $40050C
(d) Why is the two’s complement number system used for signed numbers in a computer?
List in ascending order of magnitude the following 16-bit two’s complement values:
F172 5D4A 0000 9B1D 1AC3 B42E
(e) Assuming the value in A0 is $00400506, describe fully, in your own words, the
operation specified by the instruction MOVE.W (A0)+,D0
Name all addressing modes found in the instructions below:
i)
MOVE.W #$7B2,D0
ii)
MOVE.B $400500,2(A0)
(f) Explain briefly how the CMP instruction works.
If D0.W = $8765 and D1.W = $5678, state whether or not the program will branch to
LABEL when the following segment is executed. Explain your conclusion fully.
CMP.W D1,D0
BGT LABEL
(g) What do you understand by the term parallel input/output port?
Draw a circuit diagram of an elementary parallel output port and give a brief
description of its action.
pf3
pf4
pf5

Partial preview of the text

Download CMP Instruction - Microprocessor Systems - Exam and more Exams Microprocessors in PDF only on Docsity!

Cork Institute of Technology

Higher Certificate in Engineering in Electronic Engineering – Award

(NFQ Level 6)

Summer 2007

MICROPROCESSOR SYSTEMS

(Time: 3 Hours)

Answer Question 1 [40 marks] and any three other questions [20 marks each] Maximum available marks is 100

Examiners: Mr. J. J. O’Sullivan Mr. D. Denieffe Dr. R. Ó Dúbhghaill

Q1 (a) List the main parts of a microcomputer and state the function of each.

(b) In relation to computer programming, explain what is meant by assembly language. List a number of advantages of using this type of programming language.

(c) How many hex digits in a byte, a word, a longword? - explain fully. Below is a line of memory data as printed out on the Flight-68K computer: 400500: 427B 017D 1111 0000 FC4E 2E5F 16AE 52BC Write down the following: i) the word at $40050A ii) the byte at $ iii) the longword at $ iv) the byte at $40050C

(d) Why is the two’s complement number system used for signed numbers in a computer? List in ascending order of magnitude the following 16-bit two’s complement values: F172 5D4A 0000 9B1D 1AC3 B42E

(e) Assuming the value in A0 is $00400506, describe fully, in your own words, the operation specified by the instruction MOVE.W (A0)+,D Name all addressing modes found in the instructions below: i) MOVE.W #$7B2,D ii) (^) MOVE.B $400500,2(A0)

(f) Explain briefly how the CMP instruction works. If D0.W = $8765 and D1.W = $5678, state whether or not the program will branch to LABEL when the following segment is executed. Explain your conclusion fully. CMP.W D1,D BGT LABEL

(g) What do you understand by the term parallel input/output port? Draw a circuit diagram of an elementary parallel output port and give a brief description of its action.

(h) What is meant by a programmable input/output (PIO) chip? Draw a simplified block diagram showing the internal structure of such a device. State whether this is intended for serial or parallel operation.

(i) What pins would you expect to find on a 4kBit nibble-organised RAM chip - show and explain all working.

(j) What is the purpose of a stack in a computer? If a 1KByte stack was to be set up in a 68000-based computer at $4007FE, determine the address of the location at the other end of this stack - show and explain all working.

[4 marks each – 40 marks in total]

Q2 (a) Write a subroutine for the Flight-68K computer that will generate a fixed delay of one second - show and explain all working. The following information may be needed - Execution times: SUB.L = 16 mpu cycles, BNE = 10 mpu cycles Flight-68K master clock: 8MHz [6 marks]

(b) Assuming your name is stored in memory as a table of ASCII bytes starting at $400500, write an assembly language program to slowly print out your name on the Flight-68K VDU, with a delay of one second between each character. For printing, use the subroutine OUTCH in system ROM at $2338. (Note that OUTCH requires the ASCII character to be passed in D0).

i) Write a short paragraph to outline your plan for the program. [4 marks] ii) Draw a flowchart for the main program. [4 marks] iii) With the aid of the accompanying 68000 instruction set, write the main program in assembly language with appropriate comments. [6 marks]

Q3 (a) Draw a detailed block diagram showing the internal structure of the 68000 MPU, and describe the function of each block. [10 marks]

(b) The following is a line of code from a 68000 program listing: 00400400 4240 CLR.W D Analyse this line of code and identify and explain the following terms: opcode mnemonic operand [3 marks]

(c) What is meant by the term fetch-execute cycle as applied to the execution of program instructions? [3 marks]

(d) Making reference to the block diagram in (a), describe in your own words, the fetch-execute cycle for the instruction in (b) above. [4 marks]

A 1 -A 23

D 0 -D 15

LDS

AS

DTACK

R/W

RESET

D 0 -D 15 D^0 -D^7

D 0 -D 7

DTACK

R/W

RESET

A 5 -A 23 A^1 -A^4 RS 1 -RS 4

CS MC MPU

Addressdecoder

X 1 X 2

MC DUART

SEN

IP 0 -IP 5

OP 0 -OP 7

RX D B

TX DB

RX D A

TX DA

Figure 1

(c) Table 1 below shows a subroutine called INCH, written to input a character via Port A of the DUART. In relation to the overall task being performed, fully explain the function of each line of the routine. [4 marks]

INCH MOVEA.L #$A00001,A

WAIT MOVE.B 2(A0),D

LSR.B #1,D

BCC WAIT

MOVE.B 6(A0),D

RTS

Table 1

The following information from the Flight-68K manual may be of help to you:

DUART base address: $A Port A status register: $A Port A Rx buffer register: $A

Port A Status Register

Break Frame Parity Overrun TxEMT TxRDY FFULL RxRDY

7 6 5 4 3 2 1 0 SRA

Higher Certificate in Engineering in Electronic Engineering

MICROPROCESSOR SYSTEMS

Summer 2007

BEFORE-AND-AFTER SHEET

Question 4(d)

Name: _______________________ Return with your answer book

X N Z V C

0 1 0 1 0

Registers before Flags before Instruction Registers after Flags after D0: 87654321 D1: 12345678 D0: D7494B7E D1: 2E8AB D0: 264B396D D1: 62B4939A

D0: DCBA

1 0 0 1 0 X N Z V C 1 1 0 1 0 X N Z V C

X N Z V C 1 1 0 1 0

MOVE.L D0,D

ADD.W D0,D

CMP.B D1,D

OR.B #$F0,D

D0: D1:

X N Z V C

D0: D1:

X N Z V C

D0: D1:

X N Z V C

D0: X^ N^ Z^ V^ C

D0: 4D5B61E0 X^ N^ Z^ V^ C 1 1 0 1 0

LSL.B #3,D0 D0: X^ N^ Z^ V^ C