Docsity

EE 3750 - Homework 1 Solutions: 8086 Microprocessor Addressing and Instructions - Prof. J., Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EE 3750 โ€” HW 1 solutions 1
EE 3750 โ€” Homework 1 solutions
Fall 2009
1. (a) Let the effective address of variable blue be 42EH and let DS = 2A50H. What is
the corresponding physical address of blue, assuming real mode operation?
(b) Let the physical address of variable gold be 9B491H and let the effective address of
gold be 2171H. What are the corresponding contents of DS, assuming real mode operation?
(c) Assume protected mode operation. Let the effective address of variable tan be 2E04H
and let the base value in the descriptor to which DS points be 67C000H. What is the
corresponding physical address of tan?
All values are given in hex.
(a) DS shifted by 4 bits = 2A500
EA = + 42E
PA = 2A92E
(b) PA = 9B491
EA = โˆ’ 2171
DS shifted by 4 bits = 99320
DS = 9932
(c) base address = 67C000
EA = + 2E04
PA = 67EE04
2. Explain the sequence of operations performed by the 8086 while executing the
instruction ADD CH, [BX+DI]. (Be sure to include generation of effective and physical
memory address and what happens to both the source and destination operands.)
The 8086 calculates the 16-bit effective address of the source, [BX+DI], by adding the
contents of BX and the contents of DI, then passes this to the bus interface unit (BIU). The BIU
shifts the contents of DS to the left by 4 bits then adds it to the effective address to produce the
20-bit physical address. (DS is the default segment register for this addressing mode.) The 8086
places this physical address on the address bus and signals memory to perform a read. The
memory copies the byte in memory from the location indicated by the physical address to the
data bus. The 8086 takes this value from the data bus and adds it to the contents of register CH.
It then stores the sum in register CH and updates the flags.
pf2

Partial preview of the text

Download EE 3750 - Homework 1 Solutions: 8086 Microprocessor Addressing and Instructions - Prof. J. and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EE 3750 โ€” HW 1 solutions 1

EE 3750 โ€” Homework 1 solutions

Fall 2009

  1. (a) Let the effective address of variable blue be 42EH and let DS = 2A50H. What is the corresponding physical address of blue , assuming real mode operation? (b) Let the physical address of variable gold be 9B491H and let the effective address of gold be 2171H. What are the corresponding contents of DS, assuming real mode operation? (c) Assume protected mode operation. Let the effective address of variable tan be 2E04H and let the base value in the descriptor to which DS points be 67C000H. What is the corresponding physical address of tan? All values are given in hex. (a) DS shifted by 4 bits = 2A EA = + 42E PA = 2A92E (b) PA = 9B EA = โˆ’ 2171 DS shifted by 4 bits = 99320 DS = 9932 (c) base address = 67C EA = + 2E PA = 67EE
  2. Explain the sequence of operations performed by the 8086 while executing the instruction ADD CH, [BX+DI]. (Be sure to include generation of effective and physical memory address and what happens to both the source and destination operands.) The 8086 calculates the 16-bit effective address of the source, [BX+DI], by adding the contents of BX and the contents of DI, then passes this to the bus interface unit (BIU). The BIU shifts the contents of DS to the left by 4 bits then adds it to the effective address to produce the 20 - bit physical address. (DS is the default segment register for this addressing mode.) The 8086 places this physical address on the address bus and signals memory to perform a read. The memory copies the byte in memory from the location indicated by the physical address to the data bus. The 8086 takes this value from the data bus and adds it to the contents of register CH. It then stores the sum in register CH and updates the flags.

EE 3750 โ€” HW 1 solutions 2

  1. Specify an 8086 assembly language instruction for each of the following tasks: (a) copy the contents of AL into DH (b) move โˆ’814 into DX (c) copy the contents of the word in memory pointed to by DI into CX (d) copy the contents of the byte in memory pointed to by DI into BL (a) MOV DH, AL (b) MOV DX, - 814 (c) MOV CX, [DI] (d) MOV BL, [DI]
  2. All integers in this problem are written in hexadecimal. Let AX = 340E, BX = 2D11, CX = 4079, DX = 1ACC, DI = 312, SI = 393, CS = 4200, DS = 5E00, SS = B000, and the contents of the word in memory to which [DI+1AAH] points = 4C06. For each instruction below, (a) identify the addressing modes of both operands, (b) indicate the contents of the destination operand after the addition, (c) give the flag settings for CF, PF, AF, ZF, SF, and OF after the addition, and (d) write the machine code (see Brey, p. 801 for formats). ADD CX, [DI+1AAH] ADD DL, 0D7H (a) addressing modes ADD CX, [DI+1AAH] โ€” destination: register; source: register relative ADD DL, 0D7H โ€” destination: register; source: immediate (b) contents of destination ADD CX, [DI+1AAH] โ€” CX โ† 8C7F (= 4079 + 4C06) ADD DL, 0D7H โ€” DL โ† A3 (= CC + D7, carry discarded) (c) flags ADD CX, [DI+1AAH] โ€” CF = 0, PF = 0, AF = 0, ZF = 0, SF = 1, OF = 1 ADD DL, 0D7H โ€” CF = 1, PF = 1, AF = 1, ZF = 0, SF = 1, OF = 0 (d) machine code ADD CX, [DI+1AAH] โ€” 00000011 10001101 10101010 00000001 ADD DL, 0D7H โ€” 10000000 11000010 11010111