E4.7 Write a subroutine that can multiply two 32-bit unsigned integers. Both the
ID: 3733726 • Letter: E
Question
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 first 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 find 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.sp clrb Idaa #20 psha ldaa #SEO #57000 sub abc sub abc pshd leas-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-8,sp ldd psha 800 #51020 pshx bsr pshd leas -10,spExplanation / Answer
1.
.model small
.data
mult1 dw 2521H
dw 3206H
mult2 dw 0A26H
dw 6400H
ans dw 0,0,0,0
.code
mov ax,@data
mov ds,ax
; LEA SI,ans
mov ax,mult1
mul mult2
mov ans,ax
mov ans+2,dx
mov ax,mult1+2
mul mult2
add ans+2,ax
adc ans+4,dx
adc ans+6,0
mov ax,mult1
mul mult2+2
add ans+2,ax
adc ans+4,dx
adc ans+6,0
mov ax,mult1+2
mul mult2+2
add ans+4,ax
adc ans+6,dx
mov ax,4C00h
int 21h
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.