-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawing.inc
More file actions
346 lines (286 loc) · 5.14 KB
/
Drawing.inc
File metadata and controls
346 lines (286 loc) · 5.14 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
;-----------------MACROS------
ShowMessage MACRO MyMessage
mov ah,9h
mov dx,offset MyMessage
int 21h
ENDM ShowMessage
;--------------------------------
ShowThreeTimes MACRO MyMessage
LOCAL AGAIN
mov cx,3
mov ah,9h
mov dx,offset MyMessage
AGAIN:int 21h
LOOP AGAIN
ENDM ShowThreeTimes
;-------------------------------------------------
DrawTile MACRO posX posY Color1 Color2
LOCAL row
LOCAL column
LOCAL ColorChange
mov cx,posX ;Column
mov dx,posY ;Row
mov al,Color1 ;Pixel color
mov ah,0ch ;Draw Pixel Command
mov bl,0
row:
mov cx,posX
mov bh,0
column:
int 10h
inc cx
inc bh
cmp bh,10
jnz column
inc dx
inc bl
cmp bl,10
jnz row
ENDM DrawTile
;---------------------------------
DrawTileCode MACRO posX posY Code
pushA
LOCAL log
LOCAL logFront
LOCAL logRear
LOCAL water
LOCAL pavement
LOCAL frog
LOCAL road
LOCAL CarFront
LOCAL CarRear
LOCAL endPoint
LOCAL NoDraw
LOCAL row
LOCAL column
LOCAL ColorChange
mov al,0h
cmp code,0h
jz NoDraw
cmp Code,02h
jnz log
mov al,06h
log:
cmp Code,06h
jnz logFront
mov al,06h
logFront:
cmp Code,07h
jnz logRear
mov al,06h
logRear:
cmp Code,03h
jnz water
mov al,01h
water:
cmp Code,04h
jnz pavement
mov al,07h
pavement:
cmp Code,05h
jnz road
mov al,08h
road:
cmp Code,01h
jnz frog
mov al,010b
frog:
cmp Code,10
jnz endPoint
mov al,14
endPoint:
cmp Code,8
jnz CarFront
mov al,15
CarFront:
cmp Code,9
jnz CarRear
mov al,15
CarRear:
mov cx,posX ;Column
mov dx,posY ;Row
mov ah,0ch ;Draw Pixel Command
mov bl,0
row:
mov cx,posX
mov bh,0
column:
int 10h
inc cx
inc bh
cmp bh,10
jnz column
inc dx
inc bl
cmp bl,10
jnz row
NoDraw:
popA
ENDM DrawTileCode
;-----------------------------
;-----------------------------
InitializeArena MACRO
LOCAL PavementSet
LOCAL Water1Set
LOCAL RestSet
LOCAL RoadSet
LOCAL StartSet
LOCAL STATUS
pushA
;Setting status codes in the tiles
mov cx,0
mov bx,offset tiles
Status:
inc cx
mov [bx],0
inc bx
cmp cx,96
jnz Status
;Setting Water codes in the tiles
Water1Set:
inc cx
mov [bx],3
inc bx
cmp cx,288
jnz Water1Set
;Setting rest codes in the tiles
RestSet:
inc cx
mov [bx],4
inc bx
cmp cx,320
jnz RestSet
;Setting road codes in the tiles
RoadSet:
inc cx
mov [bx],5
inc bx
cmp cx,608
jnz RoadSet
;Setting pavement codes in the tiles
StartSet:
inc cx
mov [bx],4
inc bx
cmp cx,640
jnz StartSet
popA
ENDM InitializeArena
;-----------------------------
InitializeBlocks MACRO level
;Manualy creating endpoints
mov tiles + 100,10
mov tiles + 104,10
mov tiles + 111,10
mov tiles + 119,10
mov tiles + 123,10
;Manualy creating Logs
mov tiles + 140,7
mov tiles + 141,2
mov tiles + 142,2
mov tiles + 143,2
mov tiles + 144,2
mov tiles + 145,2
mov tiles + 146,2
mov tiles + 147,6
mov tiles + 177,7
mov tiles + 178,2
mov tiles + 179,2
mov tiles + 180,2
mov tiles + 181,2
mov tiles + 182,2
mov tiles + 183,2
mov tiles + 184,6
mov tiles + 200,7
mov tiles + 201,2
mov tiles + 202,2
mov tiles + 203,2
mov tiles + 204,2
mov tiles + 205,2
mov tiles + 206,2
mov tiles + 207,6
mov tiles + 225,7
mov tiles + 226,2
mov tiles + 227,2
mov tiles + 228,2
mov tiles + 229,2
mov tiles + 230,2
mov tiles + 231,2
mov tiles + 232,6
mov tiles + 280,7
mov tiles + 281,2
mov tiles + 282,2
mov tiles + 283,2
mov tiles + 284,2
mov tiles + 285,2
mov tiles + 286,2
mov tiles + 287,6
;Manualy creating Cars
mov tiles + 324,9
mov tiles + 325,8
mov tiles + 326,9
mov tiles + 394,9
mov tiles + 395,8
mov tiles + 396,9
mov tiles + 458,9
mov tiles + 459,8
mov tiles + 460,9
mov tiles + 535,9
mov tiles + 536,8
mov tiles + 537,9
mov tiles + 605,9
mov tiles + 606,8
mov tiles + 607,9
cmp level,2
jnz lvl1
mov tiles + 496,9
mov tiles + 497,8
mov tiles + 498,9
mov tiles + 359,9
mov tiles + 360,8
mov tiles + 361,9
mov tiles + 422,9
mov tiles + 423,8
mov tiles + 424,9
mov tiles + 571,9
mov tiles + 572,8
mov tiles + 573,9
jmp lvl2:
lvl1:
mov tiles + 101,10
mov tiles + 105,10
mov tiles + 112,10
mov tiles + 120,10
mov tiles + 124,10
mov tiles + 160,7
mov tiles + 161,2
mov tiles + 162,2
mov tiles + 163,2
mov tiles + 164,2
mov tiles + 165,2
mov tiles + 166,2
mov tiles + 167,6
lvl2:
ENDM InitializeBlocks
CLEAR_SCREEN_UP MACRO
mov ax,0600h ;Scroll Screen AH=06 (Scroll),AL=0 Entire Page
mov bh,07 ;Normal attributes
mov cx,0 ;from 0,0
mov dx,184FH ;To 18h,4fh
int 10h
ENDM CLEAR_SCREEN_UP
MOVECURSOR MACRO ROW,COL
mov bh,00
MOV DH,ROW
MOV DL,COL
MOV AH,2
INT 10H
ENDM MOVECURSOR
scroll MACRO from, to
mov ah,06h ;Scroll Screen AH=06 (Scroll)
mov al,01h
mov bh,07 ;Normal attributes
mov cx, from ;from 0,0
mov dx, to ;To 18h,4fh
int 10h
ENDM scroll