1) Ask user to enter their name. What is your name? Eric 2) Use the name to repl
ID: 3735178 • Letter: 1
Question
1) Ask user to enter their name. What is your name? Eric
2) Use the name to replace world in the greeting message
Explanation / Answer
.MODEL small
.STACK 100h
.DATA
TimePrompt DB 'Is it after 12 noon (Y/N)?$'
NamePrompt DB 'What is your name?$'
GoodMorningMessage DB 13,10, 'Good Morning, World!, This is '+NamePrompt, 13,10, '$'
GoodAfternoonMessage DB 13,10, 'Good Afternoon, World!, This is '+NamePrompt, 13,10, '$'
DefaultMessage DB 13,10, 'Good day, World!, This is '+NamePrompt, 10, 13, '$'
.CODE
move ax, @data
mov ds, ax
mov dx, OFFSET TimePrompt
mov dn, OFFSET NamePrompt
mov ah, 9
int 21h
mov ah, 1
int 21h
or a1, 20h
cmp a1, 'y'
je IsAfternoon
cmp a1, 'n'
je IsMorning
mov dx, OFFSET DefalutMessage
IsAfternoon:
mov dx, OFFSET GoodAfternoonMessage
jmp DisplayGreeting
IsMorning:
mov dx,OFFSET GoodMorningMessage
DisplayGreeting:
mova ah, 9
int 21h
mova ah, 4ch
mov a1, 0
int 21h
END start
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.