[汇编] 从键盘输入一个一位数字,然后响铃n声

时间:2022-03-04 16:16:32
 ; multi-segment executable file template.

 data segment

 ends

 stack segment
dw dup()
ends code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax ; add your code here
BEGIN:
MOV AH, ;从键盘输入一个字符的DOS调用AL存放输入的字符
INT 21H
SUB AL, '' ;输入的是字符需要转化为数字
JB STOP ;输入字符<''吗?;below
CMP AL, ;输入字符>''吗?;above
JA STOP
CBW ;AL扩展到AH
MOV CX, AX ;响铃次数N
JCXZ STOP
BELL:
MOV DL, 07H ;准备响铃
MOV AH, ;显示一个字符的DOS调用,实际为响铃
INT 21H
LOOP BELL
STOP: RET ; wait for any key....
mov ah,
int 21h mov ax, 4c00h ; exit to operating system.
int 21h
ends end start ; set entry point and stop the assembler.