Use the following and show the output. Make sure and show the final cursor locat
ID: 671323 • Letter: U
Question
Use the following and show the output. Make sure and show the final cursor location.
.data
Msg1 db 'This test is really'
Msg2 db 'hard!'
Msg3 db 13,10,10,'$'
Msg4 db 'I will get an '
Msg5 db 'A',13,'$'
.code
mov ah, 9
mov dx, offsetMsg1
int 21h
mov ah,9
mov, dx offset Msg2
int 21h
mov ah,9
mov dx, offset Msg4
int 21h
mov ah,9
mov dx, offset Msg2
int 21h
mov Msg5, 'F'
mov ah,9
mov dx, offset Msg4
int 21h
Output:
I am pretty positive the output is "This test is reallyhard! hard! hard! I will get an FI will get an A"
However, I am unsure how to get to that answer. I am fairly new to Assembly Language and am not sure how to go about reading this code. What is the print statement? What does offset, int 21h, and mov ah,9 do?
Explanation / Answer
.model tiny .data msg1 db 'XX,YY Section:001',0ah,0dh db 'EMAIL:xy987@scs.ryerson.ca', '$' msg2 db 'The GCD OF $' msg3 db ' AND $' msg4 db ' IS $' msg5 db 0ah,0dh,'$' msg6 db 'INPUT X:$' msg7 db 'INPUT Y:$' msg8 db 'DO YOU WANT TO CONTINUE(Yes/No):$' .stack 64 .code START: MOV AX,@DATA MOV DS,AX MOV DX,OFFSET MSG1 ; SHOW MY INFORMATION CALL DISPSTR CONTINUE:CALL NEWLINE CALL NEWLINE ;NEW LINE MOV DX, OFFSET MSG6 ;PROMPT INPUT X CALL DISPSTR CALL GETDGT ; GET X CALL NEWLINE ;NEW LINE MOV BX,AX ;MOV X TO BX MOV DX, OFFSET MSG7 ;PROMPT INPUT Y CALL DISPSTR CALL GETDGT ;GET Y CALL NEWLINE ;NEW LINE CALL SHOWGCD ;DISPLAY THEIR GCD MOV DX, OFFSET MSG8 ;CONTINUE? CALL DISPSTR QUERY: MOV AH,8 INT 21H CMP AL,'y' JE CONTINUE ;IF IT IS 'y', THEN CONTINUE CMP AL,'Y' JE CONTINUE ;IF IT IS 'Y', THEN CONTINUE CMP AL,0DH ;IF IT IS 'ENTER' ,THEN CONTINUE JE CONTINUE CMP AL,'n' ;IF IT IS 'n', QUIT JE EXIT CMP AL,'N' ;IF IT IS 'N', QUIT JE EXIT JMP QUERY ;JUMP TO QUERY EXIT: MOV AX,4C00H ;QUIT INT 21H ;******************************************* ;FUNCTION NEWLINE ;INPUT:NONE ;RETURN:NONE ;RESULT:MOVE THE CURSOR TO A NEW LINE NEWLINE PROC PUSH AX PUSH DX MOV DX, OFFSET MSG5 MOV AH,9 ;DISPLAY A MESSAGE INT 21H POP DX POP AX RET ENDP ;*******************************************
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.