You would need to include irvine16.inc or add a stack
directive.
;;comments start with semi colons:
;;this longwinded program prints good morning or good afternoon
.code
Timepromt db ‘is it afternoon?(y/n)$’
GoodMorningMessage LABEL BYTE
DB 13,10,'Good morning, world!',13,10,'$'
Go odAfternoonMessage LABEL BYTE
DB 13,10,'Good afternoon, world!',13,10,'$'
.CODE
main proc near
mov ax,@data
mov ds,ax
;set DS to point to the data segment
mov dx,OFFSET
TimePrompt
;point to the time prompt
mov
ah,9
;DOS print string function #
int
21h &n
bsp;
;display the time prompt
mov
ah,1
;DOS get character function #
int
21h &n
bsp;
;get a single-character response
cmp al,'y'
;typed lowercase y for after noon?
jz IsAfternoon &nbs
p; ;yes, it's after
noon
cmp al,'Y'
;typed uppercase Y for after noon?
jnz IsMorning
;no, it's before noon
IsAfternoon:
mov dx,OFFSET
GoodAfternoonMessage
;point to the afternoon greeting
jmp DisplayGreeting
IsMorning:
mov dx,OFFSET
GoodMorningMessage
;point to the before noon greeting
DisplayGreeting:
mov
ah,9 &n bsp;
;DOS print string function #
int
21h
;display the appropriate greeting
mov ax,4c00h &nbs
p;
;DOS terminate program function #
int
21h
;terminate the program
main endp
end main