DATA SEGMENT PORTA EQU 00H PORTB EQU 02H PORTC EQU 04H PORT_CON EQU 06H DATA ENDS CODE SEGMENT MOV AX,DATA MOV DS, AX ORG 0000H START: MOV DX, PORT_CON MOV AL, 10000010B; port C (output), port A (output) in mode 0 and PORT B (INPUT) in mode 0 OUT DX, AL ;MOV AL, 11000000B ;MOV DX, PORTA ;OUT DX,AL S0: MOV AL, 11000000B MOV DX, PORTA OUT DX,AL mov cx,50000 L0: loop L0 L00: in al, PORTB test al, 00000001 jz L00 S1: MOV AL, 11111001B MOV DX, PORTA OUT DX,AL mov cx,50000 L1: loop L1 L11: in al, PORTB test al, 00000001 jz L11 S2: MOV AL, 10100100B MOV DX, PORTA OUT DX,AL mov cx,50000 L2: loop L2 L22: in al, PORTB test al, 00000001 jz L22 S3: MOV AL, 10110000B MOV DX, PORTA OUT DX,AL mov cx,50000 L3: loop L3 L33: in al, PORTB test al, 00000001 jz L33 S4: MOV AL, 10011001B MOV DX, PORTA OUT DX,AL mov cx,50000 L4: loop L4 L44: in al, PORTB test al, 00000001 jz L44 S5: MOV AL, 10010010B MOV DX, PORTA OUT DX,AL mov cx,50000 L5: loop L5 L55: in al, PORTB test al, 00000001 jz L55 S6: MOV AL, 10000010B MOV DX, PORTA OUT DX,AL mov cx,50000 L6: loop L6 L66: in al, PORTB test al, 00000001 jz L66 S7: MOV AL, 11111000B MOV DX, PORTA OUT DX,AL mov cx,50000 L7: loop L7 L77: in al, PORTB test al, 00000001 jz L77 S8: MOV AL, 10000000B MOV DX, PORTA OUT DX,AL mov cx,50000 L8: loop L8 L88: in al, PORTB test al, 00000001 jz L88 S9: MOV AL, 10010000B MOV DX, PORTA OUT DX,AL mov cx,50000 L9: loop L9 L99: in al, PORTB test al, 00000001 jz L99 JMP S0 CODE ENDS END