关注,关注,关注-----------小弟愚昧还有点搞不懂????

tudou614 2003-03-31 09:00:02
dseg segment
count dw 1
mess db'The bell is ring !',0dh,0ah,'$'
dseg ends
main proc far
assume cs:cseg,ds:dseg,es:dseg
start:
push ds
sub ax,ax
push ax
mov ax,dseg
mov ds,ax
mov al,1ch
mov ah,35h
int 21h ;取中断
push es
push bx
push ds
mov dx,offset ring
mov ax,seg ring
mov ds,ax
mov al,1ch
mov ah,25h
int 21h ;设置中断
pop ds
in al,21h
and 11111110b
out 21h,al
sti
////////////////////////////////////////////////////////////////
mov dl,2000 ;这里开始到结束部分,每句--------给点解释
delay;mov si,3000
delay1;dec si
jnz delay1
dec di
jnz delay
pop dx
pop ds
mov al,1ch
mov ah,25h
int 21h
ret
main endp
ring proc far
push ds
push ax
push cx
push dx
mov ax,dseg
mov ds,ax
sti
dec count
jnz exit
mov dx,offset mess
mov ah,09h
int 21h
mov dx,100
in al,61h
and al,0fch
sound: xor al,02
out 61h,al
mov cx,140h
wait1: loop wait1
dec dx
jne sound
mov count ,182
exit: cli
pop dx
pop cx
pop ax
pop ds
iret
ring endp
cseg ends
end start
这是课本上的一个例子p217,
还有一个朋友给的解释2000*3000是什么??

...全文
24 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tudou614 2003-04-01
  • 打赏
  • 举报
回复
终于明白了
结帖了
mailxt 2003-04-01
  • 打赏
  • 举报
回复
mov dx,100 ;发声次数
in al,61h ;从端口61读取控制字
and al,0fch ;将控制字第0、1位置0
sound: xor al,02 ;将控制字第1位置1
out 61h,al ;将控制字输出到端口61发声
mov cx,140h ;控制发声时间的常数
tudou614 2003-04-01
  • 打赏
  • 举报
回复
我也知道是时间延迟,但是2000*3000,和定时器的每秒记数18.2次,到后面的10秒记182次之间有什么关系??
还有
mov dx,100
in al,61h
and al,0fch
sound: xor al,02
out 61h,al
mov cx,140h
这段到底是什么意思,每句都解释一下??
谢谢了!!!!!!!!
come_on_baby 2003-04-01
  • 打赏
  • 举报
回复

mov dl,2000
delay;mov si,3000
delay1;dec si
jnz delay1
dec di
jnz delay
上面的句子是为了在主程序里产生一定的时间延迟,因为如果你设置完了新的中断,一下子就执行了ret,那么新中断的效果就看不到了,因为1CH中断是每隔一段时间里执行一次.
pop dx
pop ds
mov al,1ch
mov ah,25h
int 21h
ret
这几句是还原中断并返回,因为我们的返回不是31H的驻留返回,所以程序所占的空间等下会被新的程序占用,所以就算我们不还原中断也是可以,但是自觉的还原中断是个好习惯.
下面是中断调用的程序ring,不会不懂吧,呵呵!@

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧