汇编语言改程序,走马灯【求助】急,最好有修改过程以方便理解,谢谢!
发布网友
发布时间:2022-06-02 06:09
我来回答
共2个回答
热心网友
时间:2023-10-31 08:47
;K0:ON,则LED0亮;
;K1:ON,则LED0 ~ LED1亮;
;K2:ON,则LED0 ~ LED2亮;
;K3:ON,则LED0 ~ LED3亮;
;K4:ON,则LED0 ~ LED4亮;
;K5:ON,则LED0 ~ LED5亮;
;K6:ON,则LED0 ~ LED6亮;
;K7:ON,则LED0 ~ LED7亮;
;其他情况,则LED0 ~ LED7全灭;
mode equ 82h ; 方式0,PA,PC输出,PB输入
PortA equ 8000h ; Port A
PortB equ 8001h ; Port B
PortC equ 8002h ; Port C
CAddr equ 8003h ; 控制字地址
code segment
assume cs:code
start proc near
Start:
mov al, mode
mov dx, CAddr
out dx, al ; 输出控制字
LOP1:
mov dx, PortB
in al, dx ; 读入PortB
MOV AH, AL ; 为零的位,表示Ki按下
MOV AL, 0 ; 全0,代表都亮
MOV CX, 8
LOP2:
ROL AH, 1
JNC DISP
ROR AL, 1
LOOP LOP2
DISP:
mov dx, PortA
out dx, al ; 输出PortA
mov ah, 200
call delay ; 延时
JMP LOP1
start endp
delay proc near
push ax
mov al,0
push cx
mov cx,ax
loop $
pop cx
pop ax
ret
delay endp
code ends
end start
热心网友
时间:2023-10-31 08:47
人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人人