-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathiofun.inc
More file actions
145 lines (142 loc) · 3.18 KB
/
Copy pathiofun.inc
File metadata and controls
145 lines (142 loc) · 3.18 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
;Data Segment
DATASEG
;For Buffer
buffer_io db 0
;For Marker
markerCol_io dw 0
markerRow_io dw 0
CODESEG
;Getting IO function
proc getData_io
mov ah, 0h
int 16h
cmp ah, 20h
ja undefinedKey@getData
xor bh, bh
mov bl, ah
shl bx, 1
jmp [word binds_io + bx]
;User Inputing Undefined Key
undefinedKey@getData:
jmp getData_io
;Key Bindings
binds_io:
dw undefinedKey@getData ; UNDEFINED
dw quit@userAction ; Esc[1d]
dw 15d dup(undefinedKey@getData) ; UNDEFINED
dw markerUp@userAction ; W[17d]
dw 10d dup(undefinedKey@getData) ; UNDEFINED
dw submit@userAction ; Enter[28d]
dw undefinedKey@getData ; UNDEFINED
dw markerLeft@userAction ; A[30d]
dw markerDown@userAction ; S[31d]
dw markerRight@userAction ; D[32d]
endp
;Reading User Input
proc userAction
;User Finished Input
quit@userAction:
mov dx, offset byUser
jmp exit_msg
;Submiting User Input
submit@userAction:
ret
;Markering Up User Action
markerUp@userAction:
mov si, [markerRow_io]
mov di, [markerCol_io]
cmp si, 0d
je exit@markerUp
;Markering by Blue Square
decRow@markerUp:
call getColor_graph
call markCube_graph
dec si
mov al, [markColor_graph]
call markCube_graph
mov [markerCol_io], di
mov [markerRow_io], si
;Finished Markering
exit@markerUp:
jmp getData_io
;Markering Down User Action
markerDown@userAction:
mov si, [markerRow_io]
mov di, [markerCol_io]
cmp si, 7d
je exit@markerDown
;Markering by Red Square
incRow@markerDown:
call getColor_graph
call markCube_graph
inc si
mov al, [markColor_graph]
call markCube_graph
mov [markerCol_io], di
mov [markerRow_io], si
;Finished Markering
exit@markerDown:
jmp getData_io
;Markering user action that to the right
markerRight@userAction:
mov si, [markerRow_io]
mov di, [markerCol_io]
cmp di, 7d
je incRow@markerRight
;For Every Columns
incCol@markerRight:
call getColor_graph
call markCube_graph
inc di
mov al, [markColor_graph]
call markCube_graph
mov [markerCol_io], di
jmp exit@markerRight
;For Every Rows
incRow@markerRight:
cmp si, 7d
je exit@markerRight
call getColor_graph
call markCube_graph
inc si
xor di, di
mov al, [markColor_graph]
call markCube_graph
mov [markerCol_io], di
mov [markerRow_io], si
jmp exit@markerRight
;Exiting
exit@markerRight:
jmp getData_io
;Markering Action to the Left
markerLeft@userAction:
mov si, [markerRow_io]
mov di, [markerCol_io]
cmp di, 0d
je decRow@markerLeft
;For Every Columns
decCol@markerLeft:
call getColor_graph
call markCube_graph
dec di
mov al, [markColor_graph]
call markCube_graph
mov [markerCol_io], di
jmp exit@markerLeft
;For Every Rows
decRow@markerLeft:
cmp si, 0d
je exit@markerLeft
call getColor_graph
call markCube_graph
dec si
mov di, 7d
mov al, [markColor_graph]
call markCube_graph
mov [markerCol_io], di
mov [markerRow_io], si
jmp exit@markerLeft
;Exiting Function
exit@markerLeft:
jmp getData_io
endp