定时器延时 汇编 流水灯
时间: 2023-09-24 22:09:44 浏览: 113
用定时器做的流水灯
以下是基于8086汇编语言的定时器延时和流水灯程序:
```
.model small
.stack 100h
.data
.code
org 100h
delay macro time
mov cx, time
l1: mov dx, 0FFFFh
l2: dec dx
jnz l2
loop l1
endm
main proc
mov ax, @data
mov ds, ax
mov al, 10000000b
mov bl, 00000001b
mov cx, 8
l1: mov ah, al
mov dl, bl
mov ah, al
mov dl, bl
mov ah, al
mov dl, bl
mov ah, al
mov dl, bl
mov ah, al
mov dl, bl
mov ah, al
mov dl, bl
mov ah, al
mov dl, bl
delay 5000
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
mov ah, al
mov dl, 00h
delay 5000
shr al, 1
shl bl, 1
loop l1
mov ah, 4ch
int 21h
main endp
end main
```
这个程序实现了一个基本的流水灯效果,使用了定时器延时来控制灯的闪烁速度。
阅读全文