code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov dx,28bh
mov al,80h
out dx,al
mov al,0
mov cl,0
l1: mov al,cl
add al,1
and al,0fh
mov cl,al
lea bx,led xlat
mov dx,288h
out dx,al
call delay(调用延时子程序)
mov ah,01h
int 16h
jz l1
mov ah,4ch
int 21h
delay proc near(延时子程序,习题里给出的)
code ends
end start
1月11上午考题
8253通道1,8255A口输出到LED上,第一个脉冲输出左边第一盏灯亮,第二个脉冲输出左边第二盏灯
亮,.......第8个脉冲输出右边第一盏灯亮
这是我做的答案,不知道对不对,希望大家帮忙指点一下:
code segment assume cs:code
start: mov dx,28bh mov al,82h out dx,al mov dx,283h mov al,50h out dx,al mov dx,281h mov al,08h out dx,al mov cl,07h mov ch,01h l1: mov dx,281h
in al,dx cmp al,cl jz l2 jmp l1 l2: mov al,ch mov dx,288h out dx,al shl ch,1 sub cl,1 jnz l1 mov ah,4ch int 21h code ends
相关推荐: