Question

5. Assume double-word references to memory and that count is in ECX. Give a fragment of assembly code that implements the design structures shown. The code should flow the same as the design: a. Ifcoun> value then end if fa+b- count 0; b. Assume the character check is in AL Then Else end if f(ch 2 a) and (ch s z) check Y check N c. Assume ch is in AL then add 1 to lowerCount else f (ch 2 A) and (ch s z) then else end if add 1 tu upperCount; add I to otherCount; end if

In assembly code, and if you're writing it out please write neatly so I can be able to read it. Thank you.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) :-

        cmp ecx,[value]   ;; compare value with ecx (if count>value)
        jle endif
        mov ecx,0         ;; make count (ecx) 0
endif:

(b) :-

        push ecx
        mov ecx,[a]
        add ecx,[b]        ;; add a with b to compare (a+b)
        cmp ecx,[c]       ;; check condition (a+b == c)
        jne else           ;; jmp to else if (a+b) not equal to c (a+b != c )
        mov al,'Y'         ;; move 'Y' in al (check = 'Y')
        jmp endif
else:
        mov al,'N'         ;; move 'N' in al (check = 'N')
endif:
        pop ecx

(c) : -

        cmp al,'a'       ;; compare al with 'a'
        jl else          ;; jump to label (else) if al < 'a'
        cmp al,'z'       ;; compare al with 'z'
        jg else          ;; jump to label (else) if al > 'z'
if:     
        mov ecx,lowerCount
        inc dword[ecx]   ;; increament lowerCount by 1 (add 1 into lowerCount)
        jmp endif
else:
        cmp al,'A'       ;; compare al with 'A'
        jl else1         ;; jump to label (else1) if al < 'A'
        cmp al,'Z'       ;; compare al with 'Z'
        jg else1         ;; jump to label (else1) if al > 'Z'
innerif:        
        mov ecx,upperCount
        inc dword[ecx]   ;; increament upperCount by 1 (add 1 into upperCount)
        jmp endif
else1:  
        mov ecx,otherCount
        inc dword[ecx]   ;; increament otherCount by 1 (add 1 into otherCount)
        jmp endif
endif:
Add a comment
Know the answer?
Add Answer to:
In assembly code, and if you're writing it out please write neatly so I can be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT