Demo entry 6314799

c

   

Submitted by anonymous on Oct 28, 2016 at 13:17
Language: C++. Code size: 864 Bytes.

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

 end start 

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).