EE 3750 — HW 2 solutions
1
EE 3750 — Homework 2 solutions
Spring 2004
1.
Given the register and memory contents listed below, list the changed registers and
memory locations and their contents after each instruction below executed in sequence.
You can
identify memory locations by variable name or effective address.
Contents:
All integers in this problem are written in hexadecimal.
Let AX = 9014, BX =
8B77, CX = 00C4, DX = 1744, SP = 266, SI = 362, DI = 440, DS = 5000, ES = 6500, contents
of the word at the top of the stack = 3234, contents of the word pointed to by DS:[SI+6] = 8080.
ADD AX, BX
ADC DX, CX
LEA DI, [SI+6]
STOSW
XCHG CH, CL
ADD AX, BX
:
AX
←
1B8B
ADC DX, CX
:
DX
←
1809
LEA DI, [SI+6]
:
DI
←
368
:
ES:[DI] (= 6500:0368)
←
1B8B; DI
←
36A, assuming DF = 0
(but if DF = 1, then DI
←
366)
XCHG CH, CL
:
CH
←
C4; CL
←
00
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentEE 3750 — HW 2 solutions
2
2.
In the following equation, variable Q is a word variable and all other variables are bytes.
Q
RS
T
UV
←
−
+
∗
(a)
Write an 8086 instruction sequence to compute the equation assuming that the values are given
as unsigned binary integers.
(b)
Write an 8086 instruction sequence to compute the equation assuming that the values are given
as signed binary integers.
(a)
MOV AL, R
SUB AL, S
; AL holds RS
MOV AH, 0
; division by bytesized divisor T will use dividend
AX, so pad value in AL with zeroes
DIV T
; AL holds quotient = (RS)/T; use DIV because
unsigned
ADD AL, U
; AL holds ((RS)/T)+U
MUL V
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 DeSouza
 Division, Chemical element, Trigraph, Front wheel drive vehicles

Click to edit the document details