-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.asm
4754 lines (4169 loc) · 137 KB
/
main.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
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
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
INCLUDE MACROS.INC
.MODEL LARGE
.386
.STACK 64
.DATA
;-------------------- SERIAL CODES ---------------------
ATTACK_COORD_CODE EQU 1
ATTACK_RESULT_CODE EQU 2
MOVE_TO_NEXT_SCENE_CODE EQU 3
MOVE_TO_GAME_SCENE_CODE EQU 4
POWER_UP_ACTIVATION_CODE EQU 5
ATTACK_TWICE_CODE EQU 6
REVERSE_ATTACK_CODE EQU 7
DESTROY_RANDOM_SHIP_CODE EQU 8
DESTROY_RANDOM_SHIP_RESULT_CODE EQU 9
END_CODE EQU 33
GAME_INVITATION_CODE EQU 0FFH
CHAT_INVITATION_CODE EQU 0FEH
CANCEL_INVITATION_CODE EQU 0FDH
ACCEPT_INVITATION_CODE EQU 0FCH
REJECT_INVITATION_CODE EQU 0FBH
LEVEL1_CODE EQU 0F9H
LEVEL2_CODE EQU 0FAH ; LEVEL2 CODE MUST ALWAYS BE HIGHER THAN LEVEL 1 CODE BY 1
START_CHAT_CODE EQU 0F8H
USERNAME_CODE EQU 0F6H
REQUEST_TO_SEND_CODE EQU 0F5H
READY_TO_RECEIVE_CODE EQU 0F4H
ALL_DATA_SENT_CODE EQU 0F3H
EXIT_GAME_CODE EQU 0EEH
;-------------------- MISCELLANEOUS ----------------------
KEY_PRESSED DB ?
WAIT_FOR_THE_OTHER_PLAYER_MSG DB 45,"- Please wait the other player to press ENTER"
MY_INDEX EQU 1
OTHER_PLAYER_INDEX EQU 2
WAIT_TO_RECEIEVE_ATTACK_COORD DB 28,"WAIT TO RECEIEVE ATTACK COORD"
WAIT_TO_RECEIEVE_ATTACK_RESULT DB 29,"WAIT TO RECEIEVE ATTACK RESULT"
ATTACKX_STRING DB 2,?,?
ATTACKY_STRING DB 1,?
;---------------- INVITATIONS ---------------------------
GAME_MODE DB 0
PLAY_MODE EQU 1
CHAT_MODE EQU 2
IS_HOST DB ?
DUMMY_COUNTER DB ?
IS_GAME_STARTED DB 0
SEND_GAME_INVITATION_MSG DB 38,'- To send a game invitation press F2 -'
SEND_CHAT_INVITATION_MSG DB 38,'- To send a chat invitation press F3 -'
RECEIVED_GAME_INVITATION_MSG DB 80,'- You have received a game invitaiton, press ENTER to accept or SPACE to decline'
RECEIVED_CHAT_INVITATION_MSG DB 80,'- You have received a chat invitaiton, press ENTER to accept or SPACE to decline'
YOU_CANCELLED_MSG DB 39,'- You cancelled the invitation you sent'
INVITATION_ACCEPTED_MSG DB 52,'- Your invitation was accepted, press ENTER to start'
INVITATION_REJECTED_MSG DB 30,'- Your invitation was rejected'
INVITATION_CANCELLED_MSG DB 43,'- The invitation you received was cancelled'
YOU_ACCEPTED_MSG DB 51,'- You accepted the invitation, press ENTER to start'
YOU_REJECTED_MSG DB 29,'- You rejected the invitation'
SENT_GAME_INVITATION_MSG DB 66,'- You sent a game invitation, press SPACE to cancel the invitation'
SENT_CHAT_INVITATION_MSG DB 66,'- You sent a chat invitation, press SPACE to cancel the invitation'
HOST_CHOOSING_LEVEL DB 44,'- Please wait while the host chooses a level'
WAITING_FOR_USERNAME DB 45,'- Waiting for Player 2 to send their username'
;---------------- BUFFERS -------------------------------
; FIRST BYTE OF ANY BUFFER -> SIZE OF DATA CURRENTLY IN THE BUFFER
; BUFFERS SIZE NEEDS TO BE CHECKED
DATA_BUFFER_INDEX EQU 1
CHAT_BUFFER_INDEX EQU 2
BUFFER_SIZE EQU 100
SEND_DATA_BUFFER_FULL DB 0
SEND_CHAT_BUFFER_FULL DB 0
SERIAL_BYTE DB ?
DATA_RECEIVED_FLAG DB 0
SEND_DATA_BUFFER DB BUFFER_SIZE DUP(?)
SEND_DATA_BUFFER_PTR DW ? ; POINTS TO THE FIRST EMPTY BYTE IN THE SEND_DATA_BUFFER (CONTAINS THE OFFSET)
RECEIVE_DATA_BUFFER DB BUFFER_SIZE DUP(?)
SEND_CHAT_BUFFER DB BUFFER_SIZE DUP(?)
SEND_CHAT_BUFFER_PTR DW ? ; POINTS TO THE FIRST EMPTY BYTE IN THE SEND_CHAT_BUFFER (CONTAINS THE OFFSET)
RECEIVE_CHAT_BUFFER DB BUFFER_SIZE DUP(?)
BUFFER_INDEX DB ?
IS_CHAT_KEY DB ? ; 1:TRUE 0:FALSE
;---------------- STARTING PAGE -------------------------
WELCOME_MSG DB 24,'Welcome To Battleships !'
CONTROLLERS_MSG DB 10,'Controls: '
ARROWS_MSG DB 60,'ARROWS: For navigation (in the grid and power ups selection)'
TAB_MSG DB 46,'TAB: To enter and exit the power ups selection'
SPACE_MSG DB 40,'PLUS(+): To send an in-game chat message'
ENTER_MSG DB 64,'ENTER: To move throughout game stages and select different items'
;---------------- GENERAL MESSAGES -------------------------
PLAYER_TURN DB 34,"'s turn ! Wait for him to attack !"
CHOOSE_LEVEL_MSG DB 33,"- Press ENTER to choose a level !"
ATTACK_TIME_MSG DB 41,"- Attack time ! Press ENTER to continue !"
VIEW_SHIPS_MSG DB 97,"- Take a look at your ships to see the effect of your opponent's attack !"
DB " Press ENTER to ATTACK !"
WAIT_FOR_OTHER_ATTACK_MSG DB 23,"- Wait for the attack !"
;---------------- ATTACK -----------------------------------
SELECT_ATTACK_COLUMN_MSG DB 84,"- Navigate through columns and press ENTER "
DB "to select the column of the attacked cell"
FIRE_SLIDER_MSG DB 64,"- Press ENTER to stop the slider at the row of the attacked cell"
CELL_ALREADY_ATTACKED_MSG_ATTACKER DB 81,"- You attacked the cell that you already attacked before! Press ENTER to continue"
GRID_MISSED_MSG_ATTACKER DB 47,"- You missed the grid ! Press ENTER to continue"
ON_TARGET_MSG_ATTACKER DB 61,"- Your attack hit a ship ! Good job ! Press ENTER to continue"
NOT_ON_TARGET_MSG_ATTACKER DB 69,"- Your attack didn't hit a ship ! Hard Luck ! Press ENTER to continue"
CELL_ALREADY_ATTACKED_MSG_ATTACKED DB 92,"- The other player attacked a cell that he already attacked before ! Press ENTER to continue"
GRID_MISSED_MSG_ATTACKED DB 60,"- The other player missed the grid ! Press ENTER to continue"
ON_TARGET_MSG_ATTACKED DB 76,"- The other player's attack hit a ship ! Hard Luck ! Press ENTER to continue"
NOT_ON_TARGET_MSG_ATTACKED DB 83,"- The other player's attack didn't hit a ship ! Good Luck ! Press ENTER to continue"
ATTACKX DW ?
ATTACKY DW ?
IS_EVEN DB ?
IS_ONTARGET DB 0
IS_ATTACKED_BEFORE DB 0
IS_ON_GRID DB 1
PLAYER_ATTACKING DB 1
PLAYER_ATTACKED DB 2
GAME_END DB 0
SHIP_INDEX DB 0
SHIP_SIZE DW ?
;---------------- STATISTICS MENU - ------------------------;
TO_RESTART_GAME DB 33,"- To restart the game press ENTER"
TO_QUIT_GAME DB 28,"- To quit the game press ESC"
;---------------- STATUS BAR - ------------------------;
SCORE_CONSTANT_TEXT DB 10,"'s score: "
EMPTY_STRING DB 100,100 DUP(' ')
CONCATENATED_STRING DB 100,"- ",98 DUP(' ')
CHAT_CONSTANT DB 1,":"
CHAT_CONSTANT2 DB 2,"- "
;---------------- STANDALONE CHAT MODE ------------------------;
PLACE_TO_PRINT_NEXT_MSG DW ?
TYPE_HERE_MSG DB 12,"- Type here:"
MAX_MSG_LENGTH DB ?
MESSAGES_QUEUE1 DB 0,0,100,100 DUP('1')
MESSAGES_QUEUE2 DB 0,0,100,100 DUP('2') ;Player Index,Has msg,Size,Message
MESSAGES_QUEUE3 DB 0,0,100,100 DUP('3')
MESSAGES_QUEUE4 DB 0,0,100,100 DUP('4')
MESSAGES_QUEUE5 DB 0,0,100,100 DUP('5')
MESSAGES_QUEUE6 DB 0,0,100,100 DUP('6')
MESSAGES_QUEUE7 DB 0,0,100,100 DUP('7')
MESSAGES_QUEUE8 DB 0,0,100,100 DUP('8')
MESSAGES_QUEUE9 DB 0,0,100,100 DUP('9')
MESSAGES_QUEUEA DB 0,0,100,100 DUP('a')
MESSAGES_QUEUEB DB 0,0,100,100 DUP('b')
MESSAGES_QUEUEC DB 0,0,100,100 DUP('c')
MESSAGES_QUEUED DB 0,0,100,100 DUP('d')
MESSAGES_QUEUEE DB 0,0,100,100 DUP('e')
MESSAGES_QUEUEF DB 0,0,100,100 DUP('f')
;----------------------- NADER (EXPERIMENTAL) - ------------------------;
STATUS_TEST1 DB 35," is a good person and hates oatmeal"
STATUS_TEST2 DB 68,"- Please select the orientation of the highlighted ship on the right"
;---------------- CELLS SELECTOR------------------------;
SELECTOR_INITIAL_X1 EQU 20
SELECTOR_INITIAL_Y1 EQU 19
SELECTOR_INITIAL_X2 EQU 20
SELECTOR_INITIAL_Y2 EQU 19
SELECTOR_X1 DW ?
SELECTOR_Y1 DW ?
SELECTOR_X2 DW ?
SELECTOR_Y2 DW ?
SELECTOR_GRID_INITIAL_X1 EQU 0
SELECTOR_GRID_INITIAL_Y1 EQU 0
SELECTOR_GRID_X1 DW ?
SELECTOR_GRID_Y1 DW ?
SELECTOR_GRID_X2 DW ?
SELECTOR_GRID_Y2 DW ?
JUMP_COUNTER DW 1
UP_ORIENTATION DB ? ;ORIENTATION = 0 : INVALID
DOWN_ORIENTATION DB ? ; = 1 : VALID
LEFT_ORIENTATION DB ?
RIGHT_ORIENTATION DB ?
SELECTED_PLAYER_SHIPS DB ?
SELECTOR_STARTING_MSG DB 84,"- Please select the starting cell of the highlighted ship on the right (Press ENTER)"
ORIENTATION_SELECTION_MSG DB 82,"- Please select the orientation of the highlighted ship on the right (Press ENTER)"
NO_POSSIBLE_ORIENTATION DB 96,"- Sorry there is no possible orientation on this cell, press ENTER and choose another valid cell"
START_PLACING_SHIPS_MSG DB 88,"- You are going to place your ships (on the right) on the grid now, press ENTER to start"
ALL_SHIPS_PLACED_MSG DB 53,"- You placed all your ships ! Press ENTER to continue"
;---------------- COORDINATES TRANSFER PARAMETERS ----------
GRID1_X DW ?
GRID2_X DW ?
GRID1_Y DW ?
GRID2_Y DW ?
PIXELS1_X DW ?
PIXELS2_X DW ?
PIXELS1_Y DW ?
PIXELS2_Y DW ?
;---------------- GAME SCREEN ------------------------------ DONE
GAME_SCREEN_MAX_X EQU 799
GAME_SCREEN_MAX_Y EQU 479
;---------------- GRID ------------------------------------
GRID_SIZE_MAX EQU 400
GRID_SQUARE_SIZE_MAX EQU 44
GRID_SQUARE_SIZE DW ?
GRID_MAX_COORDINATE_MIN EQU 16
GRID_MAX_COORDINATE DW ?
GRID_CORNER1_X EQU 20
GRID_CORNER1_Y EQU 19
GRID_CORNER2_X EQU 460
GRID_CORNER2_Y EQU 459
GRID_CELLS_MAX_COORDINATE_MIN EQU 9
GRID_CELLS_MAX_COORDINATE DW ?
;---------------- COLUMN SELECTOR -------------------------- DONE
COLUMN_SELECTOR_ROW EQU GRID_CORNER2_Y+2
COLUMN_SELECTOR_CURRENT_COLUMN DW ?
COLUMN_SELECTOR_MIN_COLUMN DW ?
COLUMN_SELECTOR_MAX_COLUMN DW ?
;---------------- COLORS ----------------------------------------
VARIABLE_COLOR DB ?
BLACK EQU 00H
BLUE EQU 01H
GREEN EQU 02H
CYAN EQU 03H
RED EQU 04H
MAGENTA EQU 05H
BROWN EQU 06H
LIGHT_GRAY EQU 07H
DARK_GRAY EQU 08H
LIGHT_BLUE EQU 09H
LIGHT_GREEN EQU 0AH
LIGHT_CYAN EQU 0BH
LIGHT_RED EQU 0CH
LIGHT_MAGENTA EQU 0DH
YELLOW EQU 0EH
WHITE EQU 0FH
;---------------- DRAW RECTANGLE PARAMETERS ----------------------
X1 DW ?
X2 DW ?
Y1 DW ?
Y2 DW ?
;---------------- SLIDER DATA ------------------------------------ DONE
SLIDER_BAR_COLUMN EQU 470
SLIDER_COLUMN EQU 480
SLIDER_INITIAL_ROW EQU 473
SLIDER_CURRENT_ROW DW SLIDER_INITIAL_ROW
SLIDER_DIRECTION DB 0 ; 0 UP, 1 DOWN
SLIDER_MAX_UP EQU 5
SLIDER_MAX_DOWN EQU 473
;---------------- KEY SCAN CODES ------------------------------- DONE
SPACE_SCANCODE EQU 39H
F2_SCANCODE EQU 3CH
F3_SCANCODE EQU 3DH
EXIT_SCANCODE EQU 01H
ENTER_SCANCODE EQU 1CH
UP_SCANCODE EQU 48H
DOWN_SCANCODE EQU 50H
RIGHT_SCANCODE EQU 4DH
LEFT_SCANCODE EQU 4BH
BACK_SCANCODE EQU 0EH
P_SCANCODE EQU 19H
TAB_SCANCODE EQU 0FH
PLUS_ASCII_CODE EQU 2BH
;---------------- POWER UPS --------------------------------
POWER_UPS_CARD_WIDTH EQU 89 ; WITHOUT BORDERS
POWER_UPS_CARD_HEIGHT EQU 133 ; WITHOUT BORDERS
POWER_UPS_CARD_MARGIN EQU 15
POWER_UPS_CARD_X1 DW ?
POWER_UPS_CARD_Y1 DW ?
POWER_UPS_CARD_X2 DW ?
POWER_UPS_CARD_Y2 DW ?
; CARDS CORNERS (WITHOUT BORDERS)
POWER_UPS_CARD1_X1 EQU GRID_CORNER2_X +((GAME_SCREEN_MAX_X - GRID_CORNER2_X - POWER_UPS_CARD_WIDTH) / 2)
POWER_UPS_CARD1_X2 EQU POWER_UPS_CARD1_X1 + POWER_UPS_CARD_WIDTH - 1
POWER_UPS_CARD1_Y1 EQU GRID_CORNER1_Y + 2
POWER_UPS_CARD1_Y2 EQU POWER_UPS_CARD1_Y1 + POWER_UPS_CARD_HEIGHT - 1
POWER_UPS_CARD2_Y1 EQU POWER_UPS_CARD1_Y1 + POWER_UPS_CARD_HEIGHT + POWER_UPS_CARD_MARGIN + 4
POWER_UPS_CARD2_Y2 EQU POWER_UPS_CARD2_Y1 + POWER_UPS_CARD_HEIGHT - 1
POWER_UPS_CARD3_Y1 EQU POWER_UPS_CARD2_Y1 + POWER_UPS_CARD_HEIGHT + POWER_UPS_CARD_MARGIN + 4
POWER_UPS_CARD3_Y2 EQU POWER_UPS_CARD3_Y1 + POWER_UPS_CARD_HEIGHT - 1
TEMP DW ?
MY_POWER_UPS_IS_USED DB 0, 0, 1
MY_N_AVAILABLE_POWER_UPS DB 3
IS_MY_ATTACK_TWICE_ACTIVATED DB 0
IS_MY_REVERSE_ATTACK_ACTIVATED DB 0
IS_MY_DESTROY_SHIP_ACTIVATED DB 0
IS_OTHER_PLAYER_ATTACK_TWICE_ACTIVATED DB 0
IS_OTHER_PLAYER_REVERSE_ATTACK_ACTIVATED DB 0
IS_OTHER_PLAYER_DESTROY_SHIP_ACTIVATED DB 0
RANDOM_SHIP DB ?
RANDOM_PLAYER DB ?
RANDOM_NUMBER DB ?
DESTROY_SHIP_MSG DB 67,"- Use this to destroy ANY random ship (it can be a ship of yours !)"
ATTACK_TWICE_MSG DB 40,"- Use this to attack twice in one turn !"
REVERSED_ATTACK_MSG DB 74,"- Use this to redirect your opponent's next attack towards his own ships !"
IN_SECOND_ATTACK_MSG DB 70,"- You are now doing the extra attack, you cannot activate a power up !"
REVERSE_A_REVERSED_ATTACK_MSG DB 98,"- You and your opponent tried to reverse each other's attacks this turn ! "
DB "All reverses cancelled !"
YOUR_ATTACK_WAS_REVERSED_MSG DB 100,"- Looks like your opponent reversed your attack towards your ships !"
DB " Press ENTER to see the damage !"
OTHER_PLAYER_ACTIVATE_ATTACK_TWICE_MSG DB 49,"- The other player activate attack twice power up"
POWER_UP_INDEX DB ?
;---------------- MAIN MENU MESSAGES DATA FOR THE USER ------------ DONE
PLEASE_ENTER_YOUR_NAME_MSG DB 19H,'- Please enter your name:'
PLAYER1_MSG DB 8H ,'Player 1'
PLAYER2_MSG DB 8H ,'Player 2'
PRESS_ENTER_MSG DB 1DH,'- Press ENTER key to continue'
TO_START_GAME_MSG DB 1CH,'- To start the game press F2'
ENTER_LEVEL_MSG DB 1EH,'- Choose the game level 1 or 2'
TO_END_PROG_MSG DB 20H,'- To end the program press ESC -'
END_GAME_MSG DB 27,"- To end the game press ESC"
;---------------- COMMON DATA FOR BOTH PLAYERS -------------------
LEVEL DB 1
MSG_1 DB 1,'1'
MSG_2 DB 1,'2'
MSG_Dash DB 1,'-'
;---- NUMBER OF SHIPS AND CELLS ---------------------------------- DONE
N_SHIPS EQU 10 ; PLAYER 1 NUMBER OF SHIPS
TOTAL_N_CELLS EQU 32
;---------------- MY DATA ----------------------------------
My_USERNAME DB 16, ?, 16 DUP ('?')
MY_SCORE DB TOTAL_N_CELLS ; NUMBER OF REMAINING CELLS, INITIALLY TOTAL CELLS OF ALL SHIPS
MY_SCORE_STRING DB 2 DUP(?)
;-------- P1 ATTACKS ---------------------------------------------
;GRID CELLS THAT P1 ATTACKED (CELL1X, CELL1Y, CELL2X, CELL2Y, ..)
MY_ATTACKS_ONTARGET_NUM DW 0
MY_ATTACKS_ONTARGET DW (GRID_SIZE_MAX * 2) DUP('*')
MY_ATTACKS_MISSED_NUM DW 0
MY_ATTACKS_MISSED DW (GRID_SIZE_MAX * 2) DUP('*')
;-------- MY SHIPS DATA ------------------------------------------
SHIPS LABEL BYTE
SHIPS_POINTS DW N_SHIPS * 4 DUP(-2) ; FOR EACH SHIP STORE POINT1_X, POINT1_Y
; POINT2_X, POINT2_Y
SHIPS_SIZES DW 5, 4, 4, 4, 3, 3, 3, 2, 2, 2
; NUMBER OF REMAINING CELLS FOR EACH SHIP
SHIPS_IS_VERTICAL DW N_SHIPS DUP(1) ; IS THE SHIP VERTICAL? (0: HORIZONTAL, 1:VERTICAL)
SHIPS_REMAINING_CELLS DB 5, 4, 4, 4, 3, 3, 3, 2, 2, 2
;---------------- Other PLAYER DATA ----------------------------------
OTHER_PLAYER_USERNAME DB 16, ?, 16 DUP ('?')
OTHER_PLAYER_SCORE DB TOTAL_N_CELLS ; NUMBER OF REMAINING CELLS, INITIALLY TOTAL CELLS OF ALL SHIPS
OTHER_PLAYER_SCORE_STRING DB 2 DUP(?)
;-------- OTHER PLAYER ATTACKS ---------------------------------------------
;GRID CELLS THAT P2 ATTACKED (CELL1X, CELL1Y, CELL2X, CELL2Y, ..)
OTHER_PLAYER_ATTACKS_ONTARGET_NUM DW 0
OTHER_PLAYER_ATTACKS_ONTARGET DW (GRID_SIZE_MAX * 2) DUP('*')
OTHER_PLAYER_ATTACKS_MISSED_NUM DW 0
OTHER_PLAYER_ATTACKS_MISSED DW (GRID_SIZE_MAX * 2) DUP('*')
;-------- OTHER PLAYER DESTROYED SHIPS ---------------------------------------------
IS_DESTROYED DB ?
DESTROYED_X1 DW ?
DESTROYED_X2 DW ?
DESTROYED_Y1 DW ?
DESTROYED_Y2 DW ?
OTHER_PLAYER_DESTROYED_SHIPS DW N_SHIPS * 4 DUP(-2)
OTHER_PLAYER_DESTROYED_SHIPS_NUM DB 0
DESTROYED_SHIP_REMAINING_CELLS DB 0
DESTROYED_SHIP_ORIENTATION DW 0
DESTROYED_SHIP_SIZE DW 0
.CODE
MAIN PROC FAR
MOV AX, @DATA
MOV DS, AX
MOV ES, AX
INITIALIZE_PROGRAM
STARTING_PAGE
USER_NAMES
STARTING_POINT:
MAIN_MENU
GET_LEVEL
DRAW_STATUS_BAR_TEMPLATE
PLAYERS_PLACE_SHIPS
START_THE_GAME
INITIALIZE_CHAT_MODE:
STANDALONE_CHAT_MODE
PRE_EXIT_SCREEN:
DRAW_PRE_EXIT_SCREEN
THE_END:
EXIT_GAME
HLT
RET
MAIN ENDP
;-------------------------------------;
POWER_UP_PICKER_ PROC NEAR
; PARAMETERS
MOV CL, 1
MOV DL, 1
MOV DI, OFFSET MY_N_AVAILABLE_POWER_UPS
MOV BX, OFFSET MY_POWER_UPS_IS_USED
CMP BYTE PTR [DI], 0
JNZ DRAW_THE_CARDS
JMP END_PICKER
DRAW_THE_CARDS:
MOV DH, BYTE PTR [DI]
INC DH
DRAW_POWER_UP_CARD_BORDER CL, RED
; CL IS THE POSITION INDEX, WE NEED THE POWER UP INDEX
GET_POWER_UP_INDEX CL, BX
PRINT_POWER_UP_MSG POWER_UP_INDEX
PICKER_WAIT_KEY_PRESS:
WAIT_FOR_KEY
MOV AH , KEY_PRESSED
CMP AH, UP_SCANCODE
JZ MOVE_POWER_UP_UP
CMP AH, DOWN_SCANCODE
JZ MOVE_POWER_UP_DOWN
CMP AH, ENTER_SCANCODE
JZ ACTIVATE_POWER_UP
CMP AH, TAB_SCANCODE
JZ GO_BACK
CMP AH, BACK_SCANCODE
JZ GO_BACK
JMP PICKER_WAIT_KEY_PRESS
CHANGE_HIGHLIGHTED_POWER_UP:
GET_POWER_UP_INDEX CL, BX
PRINT_POWER_UP_MSG POWER_UP_INDEX
DRAW_POWER_UP_CARD_BORDER DL, BLACK
MOV DL, CL
DRAW_POWER_UP_CARD_BORDER CL, RED
JMP PICKER_WAIT_KEY_PRESS
MOVE_POWER_UP_UP:
DEC CL
CMP CL, 0
JNZ CHANGE_HIGHLIGHTED_POWER_UP
MOV CL, BYTE PTR [DI]
JMP CHANGE_HIGHLIGHTED_POWER_UP
MOVE_POWER_UP_DOWN:
INC CL
CMP CL, DH
JNZ CHANGE_HIGHLIGHTED_POWER_UP
MOV CL, 1
JMP CHANGE_HIGHLIGHTED_POWER_UP
ACTIVATE_POWER_UP:
; CL IS THE POSITION INDEX, WE NEED THE POWER UP INDEX
GET_POWER_UP_INDEX CL, BX
; SET AS USED
MOV AL, POWER_UP_INDEX
MOV AH, 0
DEC AX
ADD BX, AX
MOV BYTE PTR [BX], 1
; DECREMENT N_AVAILABLE_POWER_UPS
DEC BYTE PTR [DI]
; CHECH WHICH POWER UP
CMP POWER_UP_INDEX, 1
JZ ACTIVATE_DESTROY_SHIP
CMP POWER_UP_INDEX, 2
JZ ACTIVATE_ATTACK_TWICE
JMP ACTIVATE_REVERSED_ATTACK
ACTIVATE_DESTROY_SHIP:
DESTROY_RANDOM_SHIP_POWER_UP_ACTIVATED
JMP RETURN_TO_GAME
ACTIVATE_ATTACK_TWICE:
MY_ATTACK_TWICE_POWER_UP_ACTIVATED
JMP RETURN_TO_GAME
ACTIVATE_REVERSED_ATTACK:
;CMP IS_REVERSE_ATTACK_ACTIVATED, 1
;JZ REVERSE_A_REVERSED_ATTACK
;MOV IS_REVERSE_ATTACK_ACTIVATED ,1
JMP RETURN_TO_GAME
;REVERSE_A_REVERSED_ATTACK:
;MOV IS_REVERSE_ATTACK_ACTIVATED , 0
; MOV IS_REVERSE_COUNT, 0
;PRINT_NOTIFICATION_MESSAGE REVERSE_A_REVERSED_ATTACK_MSG, 1
;PRINT_NOTIFICATION_MESSAGE PRESS_ENTER_MSG, 2
; WAIT_FOR_ENTER_RR:
; MOV AH, 0
; INT 16H
; CMP AH, ENTER_SCANCODE
;JNZ WAIT_FOR_ENTER_RR
; JMP RETURN_TO_GAME
GO_BACK:
DRAW_POWER_UP_CARD_BORDER CL, BLACK
JMP END_PICKER
RETURN_TO_GAME:
CLEAR_POWER_UPS
DRAW_POWER_UPS
END_PICKER:
PRINT_NOTIFICATION_MESSAGE SELECT_ATTACK_COLUMN_MSG, 1
RET
POWER_UP_PICKER_ ENDP
;-------------------------------------;
CLEAR_POWER_UPS_ PROC NEAR
MOV PIXELS1_X, POWER_UPS_CARD1_X1
MOV PIXELS1_Y, POWER_UPS_CARD1_Y1
MOV PIXELS2_X, POWER_UPS_CARD1_X2
MOV PIXELS2_Y, POWER_UPS_CARD3_Y2
SUB PIXELS1_X, 2
SUB PIXELS1_Y, 2
ADD PIXELS2_X, 2
ADD PIXELS2_Y, 2
DRAW_RECTANGLE PIXELS1_X, PIXELS1_Y, PIXELS2_X, PIXELS2_Y, WHITE
RET
CLEAR_POWER_UPS_ ENDP
;-------------------------------------;
GET_POWER_UP_INDEX_ PROC NEAR
; PARAMETERS
; AH = POSITION INDEX
; BX = IS_USED OFFSET
; RETURNS
; POWER_UP_INDEX
MOV CL, AH
MOV AL, 0 ; COUNTER
MOV AH, 0 ; POWER UP INDEX
DEC BX
GET_POWER_UP_INDEX_LOOP:
INC BX
INC AH
CMP BYTE PTR [BX], 0
JNZ GET_POWER_UP_INDEX_LOOP
INC AL
CMP AL, CL
JNZ GET_POWER_UP_INDEX_LOOP
MOV POWER_UP_INDEX, AH
RET
GET_POWER_UP_INDEX_ ENDP
;-------------------------------------;
PRINT_POWER_UP_MSG_ PROC NEAR
; PARAMETERS
; AL = POWER_UP_INDEX
CMP AL, 1
JZ PRINT_DESTROY_SHIP_MSG
CMP AL, 2
JZ PRINT_ATTACK_TWICE_MSG
PRINT_NOTIFICATION_MESSAGE REVERSED_ATTACK_MSG, 1
JMP RETURN_TO_PICKER
PRINT_DESTROY_SHIP_MSG:
PRINT_NOTIFICATION_MESSAGE DESTROY_SHIP_MSG, 1
JMP RETURN_TO_PICKER
PRINT_ATTACK_TWICE_MSG:
PRINT_NOTIFICATION_MESSAGE ATTACK_TWICE_MSG, 1
RETURN_TO_PICKER:
RET
PRINT_POWER_UP_MSG_ ENDP
;-------------------------------------;
MY_ATTACK_TWICE_POWER_UP_ACTIVATED_ PROC NEAR
MOV IS_MY_ATTACK_TWICE_ACTIVATED , 1
SEND_POWER_UP_ACTIVATION ATTACK_TWICE_CODE
RET
MY_ATTACK_TWICE_POWER_UP_ACTIVATED_ ENDP
;-------------------------------------;
OTHER_PLAYER_ATTACK_TWICE_POWER_UP_ACTIVATED_ PROC NEAR
MOV IS_OTHER_PLAYER_ATTACK_TWICE_ACTIVATED , 1
PRINT_NOTIFICATION_MESSAGE OTHER_PLAYER_ACTIVATE_ATTACK_TWICE_MSG , 1
RET
OTHER_PLAYER_ATTACK_TWICE_POWER_UP_ACTIVATED_ ENDP
;-------------------------------------;
DESTROY_RANDOM_SHIP_POWER_UP_ACTIVATED_ PROC NEAR
MOV IS_MY_DESTROY_SHIP_ACTIVATED , 1
MOV AH,2CH ;GET TIME
INT 21H
MOV RANDOM_NUMBER, DH
MOV CL ,DH
MOV CH ,00H
MOV DL ,002
MOV AX , CX ;DIVIDE THE RANDOM NUMBER BY 2 TO GET RANDOM PLAYER
DIV DL
MOV RANDOM_PLAYER , AH
CMP RANDOM_PLAYER , 1
JZ DESTROY_OTHER_PLAYER_SHIP
CHOOSE_SHIP_AND_DESTROY_IT
SEND_POWER_UP_ACTIVATION DESTROY_RANDOM_SHIP_CODE
DRAW_ALL_DESTROYED_SHIPS
DRAW_ALL_X_SIGNS MY_INDEX
RET
DESTROY_OTHER_PLAYER_SHIP:
SEND_POWER_UP_ACTIVATION DESTROY_RANDOM_SHIP_CODE
RECEIEVE_DESTROYED_SHIP_POWER_UP_RESULT
DRAW_ALL_DESTROYED_SHIPS
DRAW_ALL_X_SIGNS MY_INDEX
RET
DESTROY_RANDOM_SHIP_POWER_UP_ACTIVATED_ ENDP
;--------------------------------------;
CHOOSE_SHIP_AND_DESTROY_IT_ PROC NEAR
MOV AH,2CH ;GET TIME
INT 21H
MOV RANDOM_NUMBER, DH
MOV CL ,DH
MOV CH ,00H
MOV DL ,0AH ;DIVIDE THE RANDOM NUMBER BY 10 TO GET RANDOM SHIP INDEX
MOV AX , CX
DIV DL
MOV RANDOM_SHIP , AH
MOV DL ,RANDOM_SHIP ;PUT THE RANDOM SHIP INDEX IN DX
MOV DH ,00
DESTROY_MY_SHIP:
;CHECK IF THE SHIP IS ALREADY DESTROYED
MOV BX, OFFSET SHIPS_REMAINING_CELLS
ADD BX, DX
MY_CHECK_ALREADY_DESTROYED:
CMP BYTE PTR[BX], 0
JNZ MY_SHIP_NOT_DESTROYED
INC DX
INC BX
CMP DX, 0AH
JNZ MY_CHECK_ALREADY_DESTROYED
MOV DX, 0
MOV BX, OFFSET SHIPS_REMAINING_CELLS
JMP MY_CHECK_ALREADY_DESTROYED
MY_SHIP_NOT_DESTROYED:
MOV BX, OFFSET OTHER_PLAYER_ATTACKS_ONTARGET ; DESTROY PLAYER MY SHIP --> ADD TO OTHER PLAYER ATTACKS
MOV AX, OTHER_PLAYER_ATTACKS_ONTARGET_NUM
MOV CL, 4 ; TWO POINTS FOR EACH ATTACK SO FOUR BYTES
MUL CL
ADD BX, AX ;BX --> THE START POINT WHERE SHOULD I PUT THE DESTROYED SHIP POINTS
MOV DI, OFFSET SHIPS_SIZES
MOV AX, DX
MOV CL, 2
MUL CL
ADD DI, AX
MOV AX, [DI]
MOV SHIP_SIZE, AX ;SHIP_SIZE --> THE SIZE OF THE SHIP
MOV DI, OFFSET SHIPS_REMAINING_CELLS
MOV AX, DX
ADD DI, AX ; DI --> REMAINING CELLS
MOV SI, OFFSET SHIPS_IS_VERTICAL
MOV AX, DX
MOV CL, 2
MUL CL
ADD SI, AX ;SI --> IS THE SHIP VERTICAL
MOV BP, OFFSET SHIPS_POINTS
MOV AX, DX
MOV CL, 8
MUL CL
ADD BP, AX ;BP --> THE START POINT OF THE SHIP
;INCREASE THE COUNT OF THE ATTACKS
MOV AX, SHIP_SIZE ;I EDITED THIS IF THERE WAS AN ERROR
ADD OTHER_PLAYER_ATTACKS_ONTARGET_NUM, AX
;DECREASE SCORE
MOV AL, BYTE PTR [DI]
MOV DESTROYED_SHIP_REMAINING_CELLS,AL
SUB MY_SCORE, AL
PRINT_MY_SCORE
;STARTING DESTROY THE SHIP
MOV AX , [SI]
MOV DESTROYED_SHIP_ORIENTATION, AX
MOV CX , SHIP_SIZE
MOV DESTROYED_SHIP_SIZE, CX
MOV BYTE PTR [DI], 0
CMP AX ,1
JZ THE_RANDOM_SHIP_IS_VERTICAL
THE_RANDOM_SHIP_IS_HORIZONTAL:
MOV DX , DS:[BP] ;DX ---> X OF THE SHIP
MOV AX , DS:[BP+2] ;AX ---> Y OF THE SHIP
MOV DESTROYED_X1, DX
MOV DESTROYED_Y1, AX
LOOP_ON_THE_HSHIP_CELLS:
MOV [BX] , DX
MOV [BX + 2], AX
INC DX
ADD BX , 4
DEC CX
JNZ LOOP_ON_THE_HSHIP_CELLS
JMP RANDOM_SHIP_DESTROYED
THE_RANDOM_SHIP_IS_VERTICAL:
MOV DX , DS:[BP] ;DX ---> X OF THE SHIP
MOV AX , DS:[BP+2] ;AX ---> Y OF THE SHIP
MOV DESTROYED_X1, DX
MOV DESTROYED_Y1, AX
LOOP_ON_THE_VSHIP_CELLS:
MOV [BX] , DX
MOV [BX + 2], AX
INC AX
ADD BX , 4
DEC CX
JNZ LOOP_ON_THE_VSHIP_CELLS
RANDOM_SHIP_DESTROYED:
RET
CHOOSE_SHIP_AND_DESTROY_IT_ ENDP
;--------------------------------------;
UPDATE_OTHER_PLAYER_RANDOM_DESTROYED_SHIP_ PROC NEAR
MOV BX, OFFSET MY_ATTACKS_ONTARGET ; DESTROY PLAYER OTHER PLAYER SHIP --> ADD TO MY ATTACKS
MOV AX, MY_ATTACKS_ONTARGET_NUM
MOV CL, 4 ; TWO POINTS FOR EACH ATTACK SO FOUR BYTES
MUL CL
ADD BX, AX ;BX --> THE START POINT WHERE SHOULD I PUT THE DESTROYED SHIP POINTS
;INCREASE THE COUNT OF THE ATTACKS
MOV AX, DESTROYED_SHIP_SIZE
ADD MY_ATTACKS_ONTARGET_NUM, AX
;DECREASE SCORE
MOV AL, DESTROYED_SHIP_REMAINING_CELLS
SUB OTHER_PLAYER_SCORE, AL
PRINT_OTHER_PLAYER_SCORE
;STARTING DESTROY THE SHIP
MOV SI, OFFSET OTHER_PLAYER_DESTROYED_SHIPS
MOV AL, OTHER_PLAYER_DESTROYED_SHIPS_NUM
MOV CL, 8 ; FOUR POINTS FOR EACH SHIP SO EIGHT BYTES
MUL CL
ADD SI, AX ;BX --> THE START POINT WHERE SHOULD I PUT THE DESTROYED SHIP POINTS
MOV AL,OTHER_PLAYER_DESTROYED_SHIPS_NUM
INC AL
MOV OTHER_PLAYER_DESTROYED_SHIPS_NUM, AL
MOV AX , DESTROYED_SHIP_ORIENTATION
MOV CX , DESTROYED_SHIP_SIZE
CMP AX ,1
JZ THE_RANDOM_SHIP_IS_VERTICAL1
THE_RANDOM_SHIP_IS_HORIZONTAL1:
MOV DX , DESTROYED_X1 ;DX ---> X OF THE SHIP
MOV AX , DESTROYED_Y1 ;AX ---> Y OF THE SHIP
MOV [SI], DX
MOV [SI + 2], AX
MOV [SI + 6], AX ;AS IT HORIZONTAL , SO THE SAME Y
LOOP_ON_THE_HSHIP_CELLS1:
MOV [BX] , DX
MOV [BX + 2], AX
INC DX
ADD BX , 4
DEC CX
JNZ LOOP_ON_THE_HSHIP_CELLS1
DEC DX
MOV [SI + 4], DX ;THE LAST X COORDINATE
JMP RANDOM_SHIP_DESTROYED1
THE_RANDOM_SHIP_IS_VERTICAL1:
MOV DX , DESTROYED_X1 ;DX ---> X OF THE SHIP
MOV AX , DESTROYED_Y1 ;AX ---> Y OF THE SHIP
MOV [SI], DX
MOV [SI + 2], AX
MOV [SI + 4], DX ;AS IT VERTICAL , SO THE SAME X
LOOP_ON_THE_VSHIP_CELLS1:
MOV [BX] , DX
MOV [BX + 2], AX
INC AX
ADD BX , 4
DEC CX
JNZ LOOP_ON_THE_VSHIP_CELLS1
DEC AX
MOV [SI + 6], AX ;THE LAST Y COORDINATE
RANDOM_SHIP_DESTROYED1:
RET
UPDATE_OTHER_PLAYER_RANDOM_DESTROYED_SHIP_ ENDP
;------------------------------------------;
DRAW_POWER_UPS_ PROC NEAR
; PARAMETERS: AL = PLAYER_NUMBER
; DRAW THE EMPTY CARDS
DRAW_POWER_UPS_CARDS
MOV BX, OFFSET MY_POWER_UPS_IS_USED
START_DRAWING_EMPTY_CARDS:
MOV CL, 1 ; POWER UP INDEX
MOV DL, 1 ; POSIION INDEX
DRAW_ALL_POWER_UPS:
CMP BYTE PTR [BX], 1
JZ NEXT_POWER_UP
DRAW_POWER_UP_GRAPHICS CL, DL
INC DL
NEXT_POWER_UP:
INC BX
INC CL
CMP CL, 4
JNZ DRAW_ALL_POWER_UPS
RET
DRAW_POWER_UPS_ ENDP
;-------------------------------------;
DRAW_POWER_UP_GRAPHICS_ PROC NEAR
; PARAMETERS
; AH = POWER UP INDEX, AL = POSITION INDEX
GET_POWER_UP_GRAPHICS_POSITION AL
CMP AH, 1
JZ DESTROY_SHIP_POWER_UP
CMP AH, 2
JZ ATTACK_TWICE_POWER_UP
DRAW_REVERSED_ATTACK_POWER_UP
JMP POWER_UP_DRAWN
DESTROY_SHIP_POWER_UP:
DRAW_DESTROY_SHIP_POWER_UP
JMP POWER_UP_DRAWN
ATTACK_TWICE_POWER_UP:
DRAW_ATTACK_TWICE_POWER_UP
POWER_UP_DRAWN:
RET
DRAW_POWER_UP_GRAPHICS_ ENDP
;-------------------------------------;
GET_POWER_UP_GRAPHICS_POSITION_ PROC NEAR
; PARAMETERS
; AL = POSITION INDEX
; RETURNS THE POSITION IN PIXELS1_X, PIXELS1_Y, PIXELS2_X, PIXELS2_Y
MOV PIXELS1_X, POWER_UPS_CARD1_X1
MOV PIXELS2_X, POWER_UPS_CARD1_X2
CMP AL, 1
JZ CARD1
CMP AL, 2
JZ CARD2
MOV PIXELS1_Y, POWER_UPS_CARD3_Y1
MOV PIXELS2_Y, POWER_UPS_CARD3_Y2
JMP ADD_MARGIN
CARD1:
MOV PIXELS1_Y, POWER_UPS_CARD1_Y1
MOV PIXELS2_Y, POWER_UPS_CARD1_Y2
JMP ADD_MARGIN
CARD2:
MOV PIXELS1_Y, POWER_UPS_CARD2_Y1
MOV PIXELS2_Y, POWER_UPS_CARD2_Y2
ADD_MARGIN:
; MARGIN
MOV AX, 28
ADD PIXELS1_X, AX
ADD PIXELS1_Y, AX
SUB PIXELS2_X, AX
SUB PIXELS2_Y, AX
RET
GET_POWER_UP_GRAPHICS_POSITION_ ENDP
;-------------------------------------;
DRAW_REVERSED_ATTACK_POWER_UP_ PROC NEAR
; DRAW ARROW 1
MOV CX, PIXELS1_X
ADD CX, 2
MOV DX, PIXELS1_Y
ADD DX, 20
MOV BX, 0
MOV AH, 0CH
MOV AL, BLACK
ARROW1_TIP1:
INT 10H
DEC DX
INT 10H
INC CX
INC BX
CMP BX, 5
JNZ ARROW1_TIP1
MOV BX, 0
MOV CX, PIXELS1_X
ADD CX, 2
MOV DX, PIXELS1_Y
ADD DX, 20
ARROW1_TIP2:
INT 10H
DEC DX
INT 10H
ADD DX, 2
INC CX
INC BX
CMP BX, 5
JNZ ARROW1_TIP2
MOV CX, PIXELS1_X
ADD CX, 2
MOV DX, PIXELS1_Y
ADD DX, 20
ARROW1_BODY:
INT 10H
DEC DX
INT 10H
INC DX
INC CX
CMP CX, PIXELS2_X
JNZ ARROW1_BODY
; DRAW ARROW 2
MOV CX, PIXELS2_X
MOV DX, PIXELS2_Y
SUB DX, 20
MOV BX, 0
ARROW2_TIP1:
INT 10H
DEC DX
INT 10H
DEC CX
INC BX
CMP BX, 5
JNZ ARROW2_TIP1
MOV BX, 0
MOV CX, PIXELS2_X
MOV DX, PIXELS2_Y
SUB DX, 20
ARROW2_TIP2:
INT 10H
DEC DX
INT 10H
ADD DX, 2
DEC CX
INC BX
CMP BX, 5
JNZ ARROW2_TIP2
MOV CX, PIXELS1_X
ADD CX, 2
MOV DX, PIXELS2_Y
SUB DX, 20
ARROW2_BODY:
INT 10H
DEC DX
INT 10H
INC DX
INC CX
CMP CX, PIXELS2_X
JNZ ARROW2_BODY
; DRAW WALL
MOV CX, PIXELS1_X
MOV DX, PIXELS1_Y
DRAW_WALL:
INT 10H
DEC CX
INT 10H
INC CX
INC DX
CMP DX, PIXELS2_Y
JNZ DRAW_WALL
RET
DRAW_REVERSED_ATTACK_POWER_UP_ ENDP
;-------------------------------------;
DRAW_ATTACK_TWICE_POWER_UP_ PROC NEAR
MOV AX, PIXELS2_Y
SUB AX, PIXELS1_Y
MOV BL, 2
DIV BL
MOV AH, 0
ADD AX, PIXELS1_Y
MOV TEMP, AX ; NOW TEMP = MIDDLE Y
; DRAW A 2
; DRAW 3 HORIZONTAL LINES
DRAW_RECTANGLE PIXELS1_X, PIXELS1_Y, PIXELS2_X, PIXELS1_Y, BLACK
DRAW_RECTANGLE PIXELS1_X, TEMP, PIXELS2_X, TEMP, BLACK