满意答案
ayhayh520
2013.01.12
采纳率:41% 等级:12
已帮助:13137人
; 本程序在MASMPlus 1.2集成环境下通过编译,经过调试,运行正确。
Code Segment
Assume CS:Code,DS:Code
; -------------------------------------
; 功能:显示指定地址(Str_Addr)的字符串
; 入口:
; Str_Addr=字符串地址(要求在数据段)
; 用法: Output Str_Addr
; 用法举例:Output PromptStr
Output MACRO Str_Addr
push ax
lea dx,Str_Addr
mov ah,9
int 21h
pop ax
EndM
; -------------------------------------
; 功能:把AX中的二进制无符号数转换成显式的十进制ASCII码,并送显示屏显示
; 入口:AX=二进制数
; 出口:在当前光标位置显示转换后的ASCII码数字
Dec_ASCII Proc Near
mov dh,10
div dh
or ax,3030h ;将两位十进制数转换成ASCII码
cmp al,30h
ja $+4
mov al,20h ;若十位数是0,以空格代替
push ax
mov ah,0eh
int 10h ;显示十位数
pop ax
xchg ah,al
mov ah,0eh
int 10h ;显示个位数
ret
Dec_ASCII EndP
; -------------------------------------
Commentators equ 9 ;评委人数
Contestants equ 23 ;参赛选手人数
Press_Key db 7,13,10,'The complated. Press any key to exit...$'
Start: push cs
pop ds ;使数据段与代码段同段
push cs
pop es ;使附加段与代码段同段
mov dl,11 ;除数
xor bh,bh
mov cx,Contestants ;参赛选手人数
@@Contestant: push cx
mov ax,Contestants+1
sub ax,cx
call Dec_ASCII ;显示参赛选手序号
mov ah,0eh
mov al,':'
int 10h
mov al,20h
int 10h
mov cx,Commentators ;评委人数
@@Commentator: xor al,al
out 43h,al
in al,40h
xor ah,ah
div dl
xchg ah,al ;舍弃商数,取余数,作为某评委的打分
xor ah,ah
call Dec_ASCII ;显示评委打分
mov ax,0e20h
int 10h ;空一格
int 10h ;空一格
loop @@Commentator
mov ax,0e0dh
int 10h
mov al,0ah
int 10h
pop cx
loop @@Contestant
; -------------------------------------
Exit_Proc: Output Press_Key ;提示操作完成,按任意键结束程序
mov ah,1
int 21h
mov ah,4ch ;结束程序
int 21h
Buffer: ;电话区号输入缓冲区
Code ENDS
END Start ;编译到此结束
01分享举报