Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

MODEL small .STACK 100h DATA TimePromt DB 'Is it after 12 noon (Y/N)?$ GoodMorningMessage DB 13,10, 'Good morning, world!',13,10,'$ GoodAfternoonMessage DB 13,10, 'Good afternoon, world!',13,10, '$' DefaultMessage DB 13,10, Good day, world, 10, 13,' .CODE start: mov ax, @data mov ds, ax mov dx, OFFSET TimePromt mov ah,9 int 21h mov ah, 1 int 21h or al, 20h cmp al, 'y je IsAfternoon cmp al, 'n je IsMorning mov dx, OFFSET DefaultHessage 5Afternoon : mov dx OFFSET GoodAfternoonMessage jmp DisplayGreeting IsHorning: mov dx, OFFSET GoodtiorningMessage DisplayGreeting: mov ah,9 int 21h mov ah, 4ch mov al,9 int 21h END start

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