We know that JZ is used to determine the value of the ZF flag. The value of the ZF flag can only be 1 or 0. A jump occurs when using JZ or JNZ, which is unreasonable.
The program is compiled on x86, and the chip used is 8255. The function of the program is to use port b to read the state of the switch, and then output it to port A, where port A is connected to a small light bulb, and the light bulb is used to reflect the state of the switch. There are only two switches connected to port B. Kind of state.
The schematic diagram of the code and circuit is included below

CODES SEGMENT
ASSUME CS:CODES
START:
mov al,10000010b ; 设置为控制字,A口方式0输出,B口方式0输入
mov dx,41bh;41bh为控制寄存器的地址
out dx,al;将控制字送入到控制寄存器中,完成芯片的初始化操作
L1: mov dx,419h;419h为B口的地址
in al,dx;从B口读入开关的状态
mov dx,418h;418h为A口的地址
out dx,al;将从B口读入的数据,输出到A口,控制灯的亮灭
cmp al,0H
JZ AB
cmp al,0FFH
JZ AB
jmp L1
AB:MOV AH,4CH
INT 21H
CODES ENDS
END START