5.31.2007

七段数码管的另外一个想法

DATA SEGMENT
LEDtb db 3fh, 06h, 5bh, 4fh, 66h, 6dh, 7dh, 07h, 7fh, 6fh
buffer db 0, 0
data ends

code segment
assume cs:code,ds:data
START:
mov ax,data
mov ds,ax
mov dx, 28bh
mov al, 80h
out dx, al
mov bl, 10
mov si, 0
mov cx, 99
again1:
mov ax, si
div bl
mov buffer, al
mov buffer[1], ah
call print
inc si
loop again1
;mov dx, 28ah ;还不是很确定这几句要不要
;mov al, 0 ; 没有上机试验过
;out ax, al ;没有上机试验过
mov ah, 4ch
int 21h

print proc
push ax
push bx
push cx
push dx
mov cx, 55h
again2:
mov bx, offset LEDtb
mov al, buffer
xlat
mov dx, 288h
out dx, al
mov dx, 28ah
mov al, 02h
out dx, al
call delay
mov al, buffer[1]
xlat
mov dx, 288h
out dx, al
mov dx, 28ah
mov al, 01h
out dx, al
call delay
loop again2
pop dx
pop cx
pop bx
pop ax
ret
print endp


Delay proc
push cx
xor cx, cx
again3:
loop again3
pop cx
ret
Delay endp

CODE ENDS
END START

0 Comments: