-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstatus.asm
415 lines (343 loc) · 10.8 KB
/
status.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
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
INCLUDE macros.inc
EXTRN countSeconds:BYTE
EXTRN countMinutes:BYTE
EXTRN playerPoints1:BYTE
EXTRN playerPoints2:BYTE
EXTRN x1_Car1:WORD
EXTRN y1_Car1:WORD
EXTRN score1:BYTE
EXTRN score2:BYTE
EXTRN Name1:BYTE
EXTRN Name2:BYTE
EXTRN powerType1:BYTE
EXTRN powerType2:BYTE
EXTRN seconds:BYTE
EXTRN calledstatusbefore:BYTE
EXTRN FinishTime:BYTE
EXTRN ClearGamerOver:BYTE
EXTRN LeftDigit:BYTE
EXTRN RightDigit:BYTE
EXTRN TimeIsFinsihed:BYTE
EXTRN generateGameData:BYTE
public drawStatusBar,CHAR,printChatChar1,printChatChar2
.model HUGE
.stack 256h
.data
;FinishTime db "Game Over$"
;ClearGamerOver db " $"
chatY equ 23
cursor1X equ 3
cursor2X equ 23
c1Size db 0
c2Size db 0
CHAR db ?
maxSize equ 15
emptystring db maxSize dup(" "),"$"
score db "Score:",'$'
.code
printChatChar1 proc far
mov ax,@data
mov ds,ax
cmp CHAR,8
jne skipbackspace1
cmp c1Size,0
jz exit_1
dec c1Size
mov bh,0
mov ah,2
mov dl,cursor1X
add dl,c1Size
mov dh,chatY
int 10h
mov dl,' '
mov ah, 2
int 21h
exit_1:
ret
skipbackspace1: cmp CHAR,13
je clear1
cmp c1Size,maxSize
jne skipclear1
clear1:
mov bh,0
mov ah,2
mov dl,cursor1X
mov dh,chatY
int 10h
showmes emptystring
mov c1Size,0
cmp CHAR,13
jne skipclear1
ret
skipclear1:
mov bh,0
mov ah,2
mov dl,cursor1X
add dl,c1Size
mov dh,chatY
int 10h
mov dl,CHAR
mov ah, 2
int 21h
inc c1Size
ret
printChatChar1 endp
printChatChar2 proc far
mov ax,@data
mov ds,ax
cmp CHAR,8
jne skipbackspace2
cmp c2Size,0
jz exit_2
dec c2Size
mov bh,0
mov ah,2
mov dl,cursor2X
add dl,c2Size
mov dh,chatY
int 10h
mov dl,' '
mov ah, 2
int 21h
exit_2:
ret
skipbackspace2: cmp CHAR,13
je clear2
cmp c2Size,maxSize
jne skipclear2
clear2:
mov bh,0
mov ah,2
mov dl,cursor2X
mov dh,chatY
int 10h
showmes emptystring
mov c2Size,0
cmp CHAR,13
jne skipclear2
ret
skipclear2:
mov bh,0
mov ah,2
mov dl,cursor2X
add dl,c2Size
mov dh,chatY
int 10h
mov dl,CHAR
mov ah, 2
int 21h
inc c2Size
ret
printChatChar2 endp
drawpower proc
mov ah,0ch
cmp byte ptr [bx],0 ; if powerType is zero set to black i.e no power up
mov al,0
je skipcolorset
mov al,09h ;start color to range from light blue to Light Magenta
add al,byte ptr [bx]
sub al,2
skipcolorset:
; drawing star center line
mov bh,5
sub dx,2
drawcenter:
int 10h
inc dx
dec bh
jnz drawcenter
; drawing star right line 1
inc cx
mov bh,3
sub dx,3 ; reset to the midpoint
sub dx,1
drawrightline:
int 10h
inc dx
dec bh
jnz drawrightline
inc cx
sub dx,2 ; reset to the midpoint
int 10h ; draw last right pixel
; drawing star left line 1
sub cx,3
mov bh,3
sub dx,1
drawleftline:
int 10h
inc dx
dec bh
jnz drawleftline
dec cx
sub dx,2 ;reset to midpoint
int 10h ; draw last left pixel
ret
drawpower endp
drawStatusBar proc far
mov ax,@data
mov ds,ax
cmp calledstatusbefore,1
je skipinitialdrawings
mov calledstatusbefore,1
;---------------------------------------Screen Coloring------------------------------------------------;
;--------------------------------------status-----------------------------------------------------------;
; mov ah, 2ch
;int 21h
;mov seconds, dh
;mov calledstatusbefore,1
drawStatus: ;starting from row 171
mov ax, 0A000h
mov es,ax
mov di,51520
mov al,0fh
mov cx,320
rep stosb
mov ax, 0A000h
mov es,ax
mov di,51840
mov al,0h
mov cx,8960
rep stosb
mov bh,0
mov ah,2
mov dl,3
mov dh,21
int 10h
showmes Name1
mov bh,0
mov ah,2
mov dl,29
mov dh,21
int 10h
showmes Name2
skipinitialdrawings:
cmp countMinutes,0
jnz MinutesGreater
cmp countSeconds,0
jne MinutesGreater
jmp TimeEnd
MinutesGreater:
mov ah, 2ch
int 21h
cmp dh, seconds
jne skip
ret
skip:
mov seconds, dh
mov ah, 2
mov dl, countSeconds
cmp countSeconds,0
jne continue
mov countSeconds,59
dec countMinutes
continue:
cmp generateGameData,1
je take1
lea bx, powerType2
jmp skiptake1
take1: lea bx, powerType1
skiptake1: mov cx,90
mov dx,172
call drawpower
mov dx,178
mov ah,0ch
mov cx,20
mov bl,100
mov al,00
drawscore1back:
int 10h
inc cx
dec bl
jnz drawscore1back
mov cx,20
cmp score1,0
je skipdraw1
mov bl,score1
mov al,0FH
drawscore1:
int 10h
inc cx
dec bl
jnz drawscore1
skipdraw1:
cmp generateGameData,1
je take2
lea bx, powerType1
jmp skiptake2
take2: lea bx, powerType2
skiptake2: mov cx,300
mov dx,172
call drawpower
mov dx,178
mov ah,0ch
mov cx,220
mov bl,100
mov al,00
drawscore2back:
int 10h
inc cx
dec bl
jnz drawscore2back
mov cx,220
cmp score2,0
je skipdraw2
mov bl,score2
mov al,0FH
drawscore2:
int 10h
inc cx
dec bl
jnz drawscore2
skipdraw2:
jmp twoDigit
twoDigit:
mov bh,0
mov ah,2
mov dl,18
mov dh,20
int 10h
mov dl,48
int 21h
mov dl,countMinutes
add dl,48
int 21h
mov dl,58
int 21h
mov ah,0
mov al,countSeconds
mov bl,10
div bl
mov LeftDigit,al
mov RightDigit,ah
add LeftDigit,48 ;leftDigit Ascii
add RightDigit,48 ;rightDigit Ascii
mov dl,LeftDigit
mov ah,2
int 21h
mov dl,RightDigit
mov ah,2
int 21h
dec countSeconds
ret
TimeEnd:
mov bh,0
mov ah,2
mov dl,18
mov dh,20
int 10h
mov dl,48
int 21h
mov dl,countMinutes
add dl,48
int 21h
mov dl,58
int 21h
mov dl,48
int 21h
mov dl, countSeconds
add dl,48
int 21h
mov TimeIsFinsihed,1
ret
drawStatusBar endp
end