; Définition adresses mémoire pour contrôle feux tricolores
TL_ROUGE equ 00H
TL_JAUNE equ 01H
TL_VERT equ 02H
TL_CONTROL equ 03H
; Définition ports E/S
OUTPUT_PORT equ 04H
; Constante de temporisation
DELAY_TIME equ 10000
org 100H
main:
mov al, TL_ROUGE
mov [TL_CONTROL], al
jmp loop
loop:
mov al, [TL_CONTROL]
cmp al, TL_ROUGE
je red
cmp al, TL_JAUNE
je yellow
cmp al, TL_VERT
je green
red:
mov al, OUTPUT_PORT
out al, 01H
call delay
mov al, OUTPUT_PORT
out al, 00H
mov al, TL_JAUNE
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_VERT
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_ROUGE
mov [TL_CONTROL], al
jmp loop
delay:
mov cx, DELAY_TIME
xor dx, dx
delay_loop:
loop delay_loop
ret