基于emu8086系统,根据输入的数字1—7,分别显示相应的英文星期名,如果输入其他字符,则提示错误输出,程序关闭
时间: 2024-03-12 08:46:48 浏览: 64
下面是一个基于emu8086系统的汇编语言程序,可以实现您提出的要求:
```
; 显示英文星期名程序
; 根据输入的数字1—7,分别显示相应的英文星期名,如果输入其他字符,则提示错误输出,程序关闭
DATA SEGMENT
prompt db '请输入1-7的数字:$'
error db '输入有误,请重新输入!$'
sun db 'Sunday$'
mon db 'Monday$'
tue db 'Tuesday$'
wed db 'Wednesday$'
thu db 'Thursday$'
fri db 'Friday$'
sat db 'Saturday$'
DATA ENDS
CODE SEGMENT
assume cs:CODE, ds:DATA
start:
mov ax, DATA
mov ds, ax
; 输出提示信息
mov ah, 09h
lea dx, prompt
int 21h
; 读取用户输入
mov ah, 01h
int 21h
cmp al, '1'
je sunday
cmp al, '2'
je monday
cmp al, '3'
je tuesday
cmp al, '4'
je wednesday
cmp al, '5'
je thursday
cmp al, '6'
je friday
cmp al, '7'
je saturday
jmp error_output
sunday:
mov ah, 09h
lea dx, sun
int 21h
jmp exit_program
monday:
mov ah, 09h
lea dx, mon
int 21h
jmp exit_program
tuesday:
mov ah, 09h
lea dx, tue
int 21h
jmp exit_program
wednesday:
mov ah, 09h
lea dx, wed
int 21h
jmp exit_program
thursday:
mov ah, 09h
lea dx, thu
int 21h
jmp exit_program
friday:
mov ah, 09h
lea dx, fri
int 21h
jmp exit_program
saturday:
mov ah, 09h
lea dx, sat
int 21h
jmp exit_program
error_output:
mov ah, 09h
lea dx, error
int 21h
exit_program:
mov ah, 4ch
int 21h
CODE ENDS
END start
```
程序的主要流程与前面给出的程序类似,区别在于使用了基于emu8086系统的指令集和调用方式。程序的运行方式是在emu8086系统中打开该程序文件,然后按F10运行即可。
阅读全文
相关推荐


















