Código ensamblador para un sistema de control de semáforos (8086)

; Define direcciones de memoria para control de semáforo TL_RED equ 00H TL_YELLOW equ 01H TL_GREEN equ 02H TL_CONTROL equ 03H ; Define puertos de salida OUTPUT_PORT equ 04H ; Constante de retardo DELAY_TIME equ 10000 org 100H main: mov al, TL_RED mov [TL_CONTROL], al jmp loop loop: mov al, [TL_CONTROL] cmp al, TL_RED je red cmp al, TL_YELLOW je yellow cmp al, TL_GREEN je green red: mov al, OUTPUT_PORT out al, 01H call delay mov al, OUTPUT_PORT out al, 00H mov al, TL_YELLOW mov [TL_CONTROL], al jmp loop yellow: mov al, OUTPUT_PORT out al, 01H call delay mov al, OUTPUT_PORT out al, 00H mov al, TL_GREEN mov [TL_CONTROL], al jmp loop green: mov al, OUTPUT_PORT out al, 01H call delay mov al, OUTPUT_PORT out al, 00H mov al, TL_RED mov [TL_CONTROL], al jmp loop delay: mov cx, DELAY_TIME xor dx, dx delay_loop: loop delay_loop ret