Hardware Reference
In-Depth Information
4.
Suppose that
CS
= 40,
DS
= 8000, and
IP
= 20.
a. What is the absolute address of the next instruction?
b. If
MOV
AX
, (2) is executed, which memory word is loaded into
AX
?
5.
A subroutine with three integer arguments is called following the calling sequence
described in the text, that is, the caller pushes the arguments onto the stack in reverse
order, then executes a
CALL
instruction. The callee then saves the old
BP
and sets the
new
BP
to point to the saved old one. Then the stack pointer is decremented to allocate
space for local variables. With these conventions, give the instruction needed to move
the first argument into
AX
.
6.
In Fig. C-1 the expression
de
hw
is used as an operand. This value is the difference
of two labels. Might there be circumstances in which
de
−
+
hw
could be used as a valid
operand? Discuss your answer.
7.
Give the assembly code for computing the expression:
x=a+b+2
8.
A C function is called by
foobar(x, y);
Give the assembly code for making this call.
9.
Write an assembly language program to accept input expressions consisting of an inte-
ger, an operator, and another integer and output the value of the expression. Allow the
+,
−
,
×
, and / operators..Pc