汇编语言MASM6.X三题编程

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:11:07
1 利用中断调用产生4秒延时
2 利用中断调用,在屏幕显示1~9随机数
3 编两个通用过程将AX中存放的二进制 数换成压缩型BCD码及将BCD码换成二进制数

运行时在屏幕右上角显示时间,按任意键退出。
(不要问我任意键是哪个键哦^_^)
data segment
str db ' : : $'
data ends

code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax

test:
mov ah,1
int 16h
jnz exit

mov ah,2
int 1ah

mov al,cl
mov ah,al
mov cl,4
shr ah,cl
or ah,30h
mov str+3,ah
and al,0fh
or al,30h
mov str+4,al

mov ah,ch
shr ah,cl
or ah,30h
mov str,ah
and ch,0fh
or ch,30h
mov str+1,ch

mov ah,dh
shr ah,cl
or ah,30h
mov str+6,ah
and dh,0fh
or dh,30h
mov str+7,dh

mov dh,0
mov dl,72
mov ah,2
int 10h

lea dx,str
mov ah,9
int 21h
jmp test

exit:
mov ah,4ch
int 21h
code ends
end start