ELET2100- MICROPROCESSORS I

COURSE TEST #1 - WEDNESDAY15th OCTOBER 2008

Time: (3:00 - 4:00 )PM

( 1 ) Your interrupt service routine for RST 6.5 is stored at 3456H. Explain how this routine is executed. [3]

When RST6.5 occurs, the CPU jumps to address 6.5 * 8 = 52 = 0034H. At that address must be the instruction JMP 3456H.

( 2 )How many I/O ports can the 8085 CPU address ? [1]

The 8085 CPU uses half the address bus to generate I/O addresses ie: 8-bits. Therefore, there can be 256 I/O ports.

( 3 )What is the function of the PC register in the 8085 CPU ? [1]

The Program Counter (PC) register holds the address of the next instruction to be executed.

( 4 )How many bytes of memory does each of the instructions below occupy ?

( i )MVIE, 7DH[ 2 bytes]

( ii )IN22H[ 2 bytes ]

(iii)RAR[ 1 byte ]

(iv)LXIB,1234H[ 3 bytes ] [2]

( 5 )Figure 1 below show two common cathode LED’s connected to Port 00 of the SDK-85 kit used in the lab. Write AL code to display the hex number F1.

[5]

Algorithm: (i) enable MSD (bit 7 =1) and segments “gefa” (bits 6, 5, 4, 0 = 1)

(ii) enable LSD (bit 7 = 0) and segments “fedcba” (bits 5, 4, 3, 2, 1, 0 = 1)

(iii) go to step (i)

MVIA, 0FFH; set all Port 00 bits to output

OUT02H; send to Control port

Here:MVIA, 11110001B ; F1H

OUT00H; send it

MVIA, 00111111B; 3FH

OUT00H; send it

JMPHere

( 6 )Figure 2 below shows an address decoder used to enable/select an IC in an 8085 system circuit. Determine an instruction that would enable/select the IC. [3]

CS requires a logic low therefore all input bits to NAND gate must be logic 1. IO/M pin = 1 for instructions OUT or IN. A1, A2, A3, A5, A6, A7 =1 and A4 =0 to satisfy requirements. Note that bit A0 is not included therefore A0 = 0 or 1 would suffice. Any of the statements below will work:

OUT0EEHor OUT 0EFH orIN 0EEHorIN 0EFH

( 7 )Identify the errors in the short sample of 8085 Assembly Language (AL) code below:

Line 1:MVIA, 34H

Line 2:MVIB, 123H

Line 3:ADD20H

Line 4:LXISP, 20C0H

Line 5:LXIH, ABCDH

Line 6:ADDH, SP

Line 7:OUTF70H [4]

Error - Line 2: 123H cannot fit into the 8-bit B-register

Error – Line 3: ADD r (r = register) … cannot use an immediate value (20H)

Error – Line 6: cannot ADD using H and SP registers

Error – Line 7: F70H too big for a Port address (maximum is FFH)

( 8 )Write a program to add the two hex numbers FA and 46 then store the sum at memory location 1298H and the Flag status at location 1297H. [4]

MVIA, FAH; one number to reg-A

ADI46H; add to other number, result in reg-A

STA1298H; reg-A contents to 1298H

PUSHPSW; reg-A & Flags to Stack

POPH; reg-A reg-H, Flags  reg-L

MOVA, L; copy Flags to reg-A

STA1297H; Flats to 1297H

( 9 )You are using the SDK-85 kit in the Lab. Write AL code to initialize the I/O ports as follows:

Port 00H  Input on bits 0-3, Output on bits 4-7

Port 01H  Input on bits 6-7, Output on bits 0-5

Port 21H  Input on all bits

Port 22H  Output on all bits

Port 23H  Output on all bits [3]

MVIA, 11110000B; F0H

OUT02H; to Control port of Port 00H

MVIA, 00111111B; 3FH

OUT03H; to Control port of Port 01H

MVIA, 00001110B; 0EH

OUT20H; to Control port of Ports 21H, 22H, 23H

( 10 )List the interrupts available on the 8085, in their order of priority. [3]

TRAP

RST 7.5

RST 6.5

RST 5.5

INTR

( 11 )What is the status of the Flag bits [all except the AC], after the following instructions,

Assume A = 43h, B = 34H, C = B4H, H = 20H, L = 60H, and all Flag bits are reset before each instruction:

( a )ADDC [1]

43 + B4 = F7H[ Z=0; CY=0; S=1; P=0 (odd); AC=0 ]

( b )ANAB [1]

43 & 34 = 00H[ Z=1, CY=0, S=0, P=1; AC=0 ]

( c )MOVH,A [1]

All Flags =0

( d )XRAA [1]

43  43 = 00H[ Z=1; CY=0; S=0; P=1; AC=0 ]

( e )DCXH [1]

H=H-1  1FH[ Z=0; CY=0; S=0; P=0; AC=0 ]

( 12 )The first Intel Pentium microprocessors had an address bus consisting of 24 pins. What would be the highestaddress in the memory system (in decimal) ? [1]

Highest address = 224 – 1 = 16,777,215 [ 16 MB = 000000H – FFFFFFH ]

Bonus mark:

The Intel 8085 CPU was introduced in what year ? (±2 years).[ 1976 ]

Maximum mark = 35