如何设置在汇编语言8086 1秒的延迟 [英] How to set 1 second time delay at assembly language 8086

查看:4891
本文介绍了如何设置在汇编语言8086 1秒的延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,我已经写了code是应该的输出结果为一组连接到并行端口的LED。当我跑了code将其pretty多什么也没做。我的教练告诉我,code跑太快了,我的眼睛没有看到发生了什么。

我发现有一对夫妇的方式做一个延时,我试图循环NOP但我想我真的不能确定是怎么回事。有没有更好的办法?

我这里有code的一部分,在那里我有一个时间延迟加入到:

 组织100HMOV AX,0
MOV DX,378
出DX,AX
MOV AX,1; 1MOV CX,1AH
start1st:
MOV AX,1
剩下:
出DX,AX
; -------------------------------->如何循环?
MOV BX,2
MUL BX
CMP AX,80H
JL左
十二月CX
CMP CX,0
JG start1st
;结束第1


解决方案

我终于结束了使用是NOP循环

 ;启动延迟MOV BP,43690
MOV SI,43690
DELAY2:
十二月基点
NOP
JNZ DELAY2
十二月SI
CMP SI,0
JNZ DELAY2
;端到端延迟

我用了两个寄存器我他们两个​​设置为任意高的值
其会不断循环,直到两个值变为零。

我这里使用的是什么 AAAA SI和BP ,我结束了大约1秒每延时循环。

感谢您的帮助球员,是的,我们仍然使用MS-DOS这个汇编语言课程:(

My problem is that I have written a code that is supposed to output a result into a set of LEDs connected to the parallel port. When I ran the code it pretty much did nothing. My instructor told me that the code ran too fast that my eyes did not see what happened.

I have found that there are a couple of ways to do a time delay, I have tried to loop the NOP but I think I cannot really determine what is going on. Is there any better way?

I have here a part of the code where I have to add a time delay into:

org 100h

mov ax, 0
mov dx, 378
out dx, ax
mov ax, 1  

; 1st

mov cx, 1ah
start1st:
mov ax, 1
left:
out dx, ax 
; --------------------------------> how to loop?
mov bx, 2
mul bx
cmp ax, 80h
jl left
dec cx
cmp cx,0
jg start1st
; end 1st 

解决方案

What i finally ended up using was the nop loop

; start delay

mov bp, 43690
mov si, 43690
delay2:
dec bp
nop
jnz delay2
dec si
cmp si,0    
jnz delay2
; end delay

I used two registers which I set them both to any high value and its gonna keep on looping until both values go to zero

What I used here was AAAA for both SI and BP, i ended up with roughly 1 second for each delay loop.

Thanks for the help guys, and yes, we still use MS DOS for this assembly language course :(

这篇关于如何设置在汇编语言8086 1秒的延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆