Hardware Reference
In-Depth Information
sub_x
deca
ldab
0,x
inx
loop
cmpb
0,x
ble
next
ldab
0,x
next
inx
deca
bne
loop
rts
E4.7 Write a subroutine that can multiply two 32-bit unsigned integers. Both the multiplicand
and the multiplier are passed to this subroutine in the stack. The caller pushes the multiplicand
into the stack fi rst and then pushes the multiplier. The pointer to the buffer to hold the product
is passed in index register X.
E4.8 Write a subroutine that can count the number of characters and words contained in a
given string. The pointer to the string to be examined is passed in X. The character count and
word count are returned in Y and B, respectively.
E4.9 Write a subroutine that can fi nd whether a given word is contained in a string. The pointer
to the word to be found and the pointer to the string to be searched are passed in X and Y, re-
spectively. This subroutine would return a 1 in B if the word is found in the string. Otherwise,
a 0 is returned in B.
E4.10 Draw the stack frame and enter the value of each stack slot (if it is known) at the end of
the following instruction sequence:
leas
2 2,sp
clrb
ldaa
#20
psha
ldaa
#$E0
psha
ldx
#$7000
pshx
jsr
sub_abc
sub_abc
pshd
leas
2 12,sp
E4.11 Draw the stack frame and enter the value of each stack slot (if it is known) at the end of
the following instruction sequence:
leas
2 8,sp
ldd
#$1020
psha
ldx
#$800
pshx
bsr
xyz
xyz
pshd
pshx
leas
2 10,sp
Search WWH ::




Custom Search