-
Notifications
You must be signed in to change notification settings - Fork 1
/
UI.inc
786 lines (629 loc) · 15.9 KB
/
UI.inc
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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
drawImage PROC FAR ; SI => Offset File ;START_ROW => y ;START_COLUMN => X ;AUX_IMAGE_WIDTH => IMAGE_WIDTH ;AUX_IMAGE_HEIGHT => IMAGE_HEIGHT
PUSH DI BX
MOV CX,[START_COLUMN]
MOV DX,[START_ROW]
MOV BX,CX
ADD BX,[AUX_IMAGE_WIDTH]
MOV DI,DX
ADD DI,[AUX_IMAGE_HEIGHT]
MOV AX,DS
MOV ES,AX
MOV AH,0CH
DRAW_PIXELS_:
MOV AL,BYTE PTR [SI]
INC SI
CMP AL,250
JE SKIP_
INT 10H
SKIP_:
INC CX
CMP CX,BX
JNE DRAW_PIXELS_
MOV CX,[START_COLUMN]
INC DX
CMP DX,DI
JNE DRAW_PIXELS_
POP BX DI
RET
drawImage ENDP
setBackgroundColor PROC FAR
mov cx, 0 ;Column
mov dx, 0 ;Row
mov al, BackgroundColor
mov ah, 0ch ;Draw Pixel Command
Horizontal: int 10h
INC CX
CMP CX, SCREEN_WIDTH
JNZ Horizontal
MOV CX, 0
INC DX
CMP DX, SCREEN_HEIGHT
JNZ Horizontal
RET
setBackgroundColor ENDP
loadLogo proc
MOV DX, offset logo_name
MOV DI, offset file_handle
CALL openFile
MOV CX, logo_size
MOV DX, offset logo
MOV BX, [file_handle]
CALL ReadFileToMemory
RET
loadLogo endp
drawLogo PROC
MOV SI, offset logo
MOV [START_ROW], 31
MOV [START_COLUMN], 28
MOV [AUX_IMAGE_HEIGHT], logo_height
MOV [AUX_IMAGE_WIDTH], logo_width
CALL drawImage
RET
drawLogo ENDP
chooseCharacter PROC
MOV DX, offset choose_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, choose_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 99
MOV [START_COLUMN], 182
MOV [AUX_IMAGE_HEIGHT], choose_height
MOV [AUX_IMAGE_WIDTH], choose_width
CALL drawImage
RET
chooseCharacter ENDP
flameText PROC
MOV DX, offset FK_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, FK_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 206
MOV [START_COLUMN], 330
MOV [AUX_IMAGE_HEIGHT], FK_height
MOV [AUX_IMAGE_WIDTH], FK_width
CALL drawImage
RET
flameText ENDP
BloodyText PROC
MOV DX, offset BF_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, BF_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 280
MOV [START_COLUMN], 342
MOV [AUX_IMAGE_HEIGHT], BF_height
MOV [AUX_IMAGE_WIDTH], BF_width
CALL drawImage
RET
BloodyText ENDP
neptuneText PROC
MOV DX, offset Nep_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, Nep_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 349
MOV [START_COLUMN], 360
MOV [AUX_IMAGE_HEIGHT], Nep_height
MOV [AUX_IMAGE_WIDTH], Nep_width
CALL drawImage
RET
neptuneText ENDP
thunderText PROC
MOV DX, offset Thun_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, Thun_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 416
MOV [START_COLUMN], 323
MOV [AUX_IMAGE_HEIGHT], Thun_height
MOV [AUX_IMAGE_WIDTH], Thun_width
CALL drawImage
RET
thunderText ENDP
loadSmallOwl PROC
MOV DX, offset owlS_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, owlS_file_size
MOV DX, offset owlS_file
MOV BX, [file_handle]
CALL ReadFileToMemory
RET
loadSmallOwl ENDP
drawSmallOwl PROC
MOV SI, offset owlS_file
MOV AX, owl_current_row
MOV [START_ROW], AX
MOV [START_COLUMN], 80
MOV [AUX_IMAGE_HEIGHT], owlS_height
MOV [AUX_IMAGE_WIDTH], owlS_width
CALL drawImage
RET
drawSmallOwl ENDP
drawPage PROC
CALL setBackgroundColor
CALL drawLogo
CALL chooseCharacter
CALL drawWard
CALL drawSamer
CALL drawMays
CALL drawBassam
CALL flameText
CALL BloodyText
CALL neptuneText
CALL thunderText
Call drawSmallOwl
RET
drawPage ENDP
clearOwl PROC NEAR
mov cx, 80 ;Column
mov dx, owl_current_row ;Row
mov al, 42H ;Pixel color
mov ah, 0ch ;Draw Pixel Command
clear2: int 10h
INC CX
CMP CX, 106
JNZ clear2
MOV CX, 80
INC DX
MOV BX, DX
SUB BX, owlS_height
CMP BX, owl_current_row
JNZ clear2
RET
clearOwl ENDP
drawWard PROC
MOV DX, offset ward_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, ward_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV AX, ward_starting_row
MOV [START_ROW], AX
MOV AX, ward_starting_column
MOV [START_COLUMN], AX
MOV [AUX_IMAGE_HEIGHT], ward_height
MOV [AUX_IMAGE_WIDTH], ward_width
CALL drawImage
RET
drawWard ENDP
drawSamer PROC
MOV DX, offset samer_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, samer_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV AX, samer_starting_row
MOV [START_ROW], AX
MOV AX, samer_starting_column
MOV [START_COLUMN], AX
MOV [AUX_IMAGE_HEIGHT], samer_height
MOV [AUX_IMAGE_WIDTH], samer_width
CALL drawImage
RET
drawSamer ENDP
drawMays PROC
MOV DX, offset mays_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, mays_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV AX, mays_starting_row
MOV [START_ROW], AX
MOV AX, mays_starting_column
MOV [START_COLUMN], AX
MOV [AUX_IMAGE_HEIGHT], mays_height
MOV [AUX_IMAGE_WIDTH], mays_width
CALL drawImage
RET
drawMays ENDP
drawBassam PROC
MOV DX, offset bassam_file_name
MOV DI, offset file_handle
CALL openFile
MOV CX, bassam_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
CALL ReadFileToMemory
MOV SI, offset file_buffer
MOV AX, bassam_starting_row
MOV [START_ROW], AX
MOV AX, bassam_starting_column
MOV [START_COLUMN], AX
MOV [AUX_IMAGE_HEIGHT], bassam_height
MOV [AUX_IMAGE_WIDTH], bassam_width
CALL drawImage
RET
drawBassam ENDP
p2_SelectCharDown PROC
P2_CHECK_FIRST:
CMP owl_current_row, first_player
JNE P2_Check_second
CALL clearOwl
CMP player1_character, 2
JNE CONTINUE1
MOV owl_current_row, third_player
MOV player2_character, 3
CALL drawSmallOwl
JMP P2_EXIT_PROC
CONTINUE1:
MOV owl_current_row, second_player
MOV player2_character, 2
CALL drawSmallOwl
JMP P2_EXIT_PROC
P2_Check_second:
CMP owl_current_row, second_player
JNE P2_check_third
CALL clearOwl
CMP player1_character, 3
JNE CONTINUE2
MOV owl_current_row, fourth_player
MOV player2_character, 4
CALL drawSmallOwl
JMP P2_EXIT_PROC
CONTINUE2:
MOV owl_current_row, third_player
MOV player2_character, 3
CALL drawSmallOwl
JMP P2_EXIT_PROC
P2_Check_third:
CMP owl_current_row, third_player
JNE P2_check_fourth
CALL clearOwl
CMP player1_character, 4
JNE CONTINUE3
MOV owl_current_row, first_player
MOV player2_character, 1
CALL drawSmallOwl
JMP P2_EXIT_PROC
CONTINUE3:
MOV owl_current_row, fourth_player
MOV player2_character, 4
CALL drawSmallOwl
JMP P2_EXIT_PROC
P2_Check_fourth:
CALL clearOwl
CMP player1_character, 1
JNE CONTINUE4
MOV owl_current_row, second_player
MOV player2_character, 2
CALL drawSmallOwl
JMP P2_EXIT_PROC
CONTINUE4:
MOV owl_current_row, first_player
MOV player2_character, 1
CALL drawSmallOwl
P2_EXIT_PROC:
RET
p2_SelectCharDown ENDP
p2_SelectCharUp PROC
P2_CHECK_FIRST2:
CMP owl_current_row, first_player
JNE P2_Check_second2
CALL clearOwl
CMP player1_character, 4
JNE CONTINUE11
MOV owl_current_row, third_player
MOV player2_character, 3
CALL drawSmallOwl
JMP P2_EXIT_PROC2
CONTINUE11:
MOV owl_current_row, fourth_player
MOV player2_character, 4
CALL drawSmallOwl
JMP P2_EXIT_PROC2
P2_Check_second2:
CMP owl_current_row, second_player
JNE P2_check_third2
CALL clearOwl
CMP player1_character, 1
JNE CONTINUE22
MOV owl_current_row, fourth_player
MOV player2_character, 4
CALL drawSmallOwl
JMP P2_EXIT_PROC2
CONTINUE22:
MOV owl_current_row, first_player
MOV player2_character, 1
CALL drawSmallOwl
JMP P2_EXIT_PROC2
P2_Check_third2:
CMP owl_current_row, third_player
JNE P2_check_fourth2
CALL clearOwl
CMP player1_character, 2
JNE CONTINUE33
MOV owl_current_row, first_player
MOV player2_character, 1
CALL drawSmallOwl
JMP P2_EXIT_PROC2
CONTINUE33:
MOV owl_current_row, second_player
MOV player2_character, 2
CALL drawSmallOwl
JMP P2_EXIT_PROC2
P2_Check_fourth2:
CALL clearOwl
CMP player1_character, 3
JNE CONTINUE44
MOV owl_current_row, second_player
MOV player2_character, 2
CALL drawSmallOwl
JMP P2_EXIT_PROC2
CONTINUE44:
MOV owl_current_row, third_player
MOV player2_character, 3
CALL drawSmallOwl
P2_EXIT_PROC2:
RET
p2_SelectCharUp ENDP
selectCharDown PROC
CMP owl_current_row, first_player
JNE Check_second
CALL clearOwl
MOV owl_current_row, second_player
MOV player1_character, 2
CALL drawSmallOwl
JMP EXIT_PROC
Check_second:
CMP owl_current_row, second_player
JNE check_third
CALL clearOwl
MOV owl_current_row, third_player
MOV player1_character, 3
CALL drawSmallOwl
JMP EXIT_PROC
Check_third:
CMP owl_current_row, third_player
JNE check_fourth
CALL clearOwl
MOV owl_current_row, fourth_player
MOV player1_character, 4
CALL drawSmallOwl
JMP EXIT_PROC
Check_fourth:
CALL clearOwl
MOV owl_current_row, first_player
MOV player1_character, 1
CALL drawSmallOwl
EXIT_PROC:
RET
selectCharDown ENDP
selectCharUP PROC
CMP owl_current_row, first_player
JNE Check_second_UP
CALL clearOwl
MOV owl_current_row, fourth_player
MOV player1_character, 4
CALL drawSmallOwl
JMP EXIT_PROC2
Check_second_UP:
CMP owl_current_row, second_player
JNE Check_third_UP
CALL clearOwl
MOV owl_current_row, first_player
MOV player1_character, 1
CALL drawSmallOwl
JMP EXIT_PROC2
Check_third_UP:
CMP owl_current_row, third_player
JNE Check_fourth_UP
CALL clearOwl
MOV owl_current_row, second_player
MOV player1_character, 2
CALL drawSmallOwl
JMP EXIT_PROC2
Check_fourth_UP:
CALL clearOwl
MOV owl_current_row, third_player
MOV player1_character, 3
CALL drawSmallOwl
EXIT_PROC2:
RET
selectCharUP ENDP
drawWelcomePage PROC
CALL drawLogo
MOV DX, offset owl_file_name
MOV DI, offset file_handle
call openFile
MOV CX, owl_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 91
MOV [START_COLUMN], 265
MOV [AUX_IMAGE_HEIGHT], owl_height
MOV [AUX_IMAGE_WIDTH], owl_width
CALL drawImage
MOV DX, offset hey_file_name
MOV DI, offset file_handle
call openFile
MOV CX, hey_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 275
MOV [START_COLUMN], 101
MOV [AUX_IMAGE_HEIGHT], hey_height
MOV [AUX_IMAGE_WIDTH], hey_width
CALL drawImage
MOV DX, offset startBtn_file_name
MOV DI, offset file_handle
call openFile
MOV CX, startBtn_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 437
MOV [START_COLUMN], 499
MOV [AUX_IMAGE_HEIGHT], startBtn_height
MOV [AUX_IMAGE_WIDTH], startBtn_width
CALL drawImage
MOV DX, offset exitBtn_file_name
MOV DI, offset file_handle
call openFile
MOV CX, exitBtn_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 437
MOV [START_COLUMN], 34
MOV [AUX_IMAGE_HEIGHT], exitBtn_height
MOV [AUX_IMAGE_WIDTH], exitBtn_width
CALL drawImage
MOV DX, offset chatBtn_file_name
MOV DI, offset file_handle
call openFile
MOV CX, chatBtn_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 437
MOV [START_COLUMN], 280
MOV [AUX_IMAGE_HEIGHT], chatBtn_height
MOV [AUX_IMAGE_WIDTH], chatBtn_width
CALL drawImage
RET
drawWelcomePage ENDP
drawpPlayerInfo PROC
CALL drawLogo
MOV DX, offset owl_file_name
MOV DI, offset file_handle
call openFile
MOV CX, owl_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], 91
MOV [START_COLUMN], 265
MOV [AUX_IMAGE_HEIGHT], owl_height
MOV [AUX_IMAGE_WIDTH], owl_width
CALL drawImage
MOV DX, offset player1_file_name
MOV DI, offset file_handle
call openFile
MOV CX, player1_file_size
MOV DX, offset file_buffer
MOV BX, [file_handle]
call ReadFileToMemory
MOV SI, offset file_buffer
MOV [START_ROW], player1_y
MOV [START_COLUMN], player1_x
MOV [AUX_IMAGE_HEIGHT], player1_height
MOV [AUX_IMAGE_WIDTH], player1_width
CALL drawImage
; MOV DX, offset player2_file_name
; MOV DI, offset file_handle
; call openFile
; MOV CX, player2_file_size
; MOV DX, offset file_buffer
; MOV BX, [file_handle]
; call ReadFileToMemory
; MOV SI, offset file_buffer
; MOV [START_ROW], player2_y
; MOV [START_COLUMN], player2_x
; MOV [AUX_IMAGE_HEIGHT], player2_height
; MOV [AUX_IMAGE_WIDTH], player2_width
; CALL drawImage
RET
drawpPlayerInfo ENDP
clearUnderOwl PROC
mov cx, 0 ;Column
mov dx, 258 ;Row
mov al, BackgroundColor
mov ah, 0ch ;Draw Pixel Command
Horizontal_: int 10h
INC CX
CMP CX, SCREEN_WIDTH
JNZ Horizontal_
MOV CX, 0
INC DX
CMP DX, SCREEN_HEIGHT
JNZ Horizontal_
RET
clearUnderOwl ENDP
Choose PROC
MOV CL, 1
Check_Keypress:
MOV AH, 0
INT 16H
CMP AH, 1CH
JNE SELECT
CAll setBackgroundColor
JMP Check_for_player2
SELECT:
CMP AH, downArrow ;down arrow
JNE CHECK_UP
CALL selectCharDown
JMP LOOP_AGAIN
CHECK_UP:
CMP AH, upArrow
JNE LOOP_AGAIN
CALL selectCharUP
LOOP_AGAIN:
JMP Check_Keypress
Check_for_player2:
CMP player1_character, 1
JE start_from_samer
MOV owl_current_row, first_player
JMP Player2_options
start_from_samer:
MOV owl_current_row, second_player
Player2_options:
CALL drawPage
Check_Keypress2:
MOV AH, 0
INT 16H
CMP AH, 1CH
JNE SELECT2
CAll setBackgroundColor
JMP EXIT
SELECT2:
CMP AH, downArrow
JNE CHECK_UP2
CALL P2_selectCharDown
JMP LOOP_AGAIN2
CHECK_UP2:
CMP AH, upArrow
JNE LOOP_AGAIN2
CALL P2_selectCharUP
LOOP_AGAIN2:
JMP Check_Keypress2
EXIT:
RET
Choose ENDP