-
Notifications
You must be signed in to change notification settings - Fork 15
/
traffic_lights2.asm
100 lines (59 loc) · 1.16 KB
/
traffic_lights2.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
; Traffic ligts test 2 for
; c:\emu8086\devices\Traffic_Lights.exe
; This is just an example of how to set the lights,
; better if you run it in step-by-step mode.
; DO NOT RUN AT MAXIMUM SPEED, DO NOT USE REAL CARS.
;)
#start=Traffic_Lights.exe#
name "traffic2"
yellow_and_green equ 0000_0110b
red equ 0000_0001b
yellow_and_red equ 0000_0011b
green equ 0000_0100b
all_red equ 0010_0100_1001b
start:
nop
; 0,1,2
mov ax, green
out 4, ax
mov ax, yellow_and_green
out 4, ax
mov ax,red
out 4, ax
mov ax, yellow_and_red
out 4, ax
; 3,4,5
mov ax, green << 3
out 4, ax
mov ax, yellow_and_green << 3
out 4, ax
mov ax,red << 3
out 4, ax
mov ax, yellow_and_red << 3
out 4, ax
; 6,7,8
mov ax, green << 6
out 4, ax
mov ax, yellow_and_green << 6
out 4, ax
mov ax,red << 6
out 4, ax
mov ax, yellow_and_red << 6
out 4, ax
; 9,A,B
mov ax, green << 9
out 4, ax
mov ax, yellow_and_green << 9
out 4, ax
mov ax,red << 9
out 4, ax
mov ax, yellow_and_red << 9
out 4, ax
; all
mov ax, all_red
out 4, ax
mov ax, all_red << 1 ; all yellow
out 4, ax
mov ax, all_red << 2 ; all green :)
out 4, ax
jmp start