-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmacros.inc
831 lines (731 loc) · 19.1 KB
/
macros.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
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
;macros are used as wrappers for procedures with the same name
;they have mainly two functionalities 1- Save the registers state before and after invoking a procedure
;------------------------------------ 2- Routing the parameters to certain registers known by the corresponding procedure
;-------------------------------------------------------------------;
EVENORODD MACRO NUMBER
PUSHA
MOV BX, NUMBER
CALL EVENORODD_
POPA
ENDM EVENORODD
;-------------------------------------------------------------------;
PRINT_MESSAGE MACRO MYMESSAGE , LOCATION,COLOR
PUSHA
MOV DX,LOCATION
MOV BP, OFFSET MYMESSAGE
MOV SI, COLOR
CALL PRINT_MESSAGE_
POPA
ENDM PRINTMESSAGE
;-------------------------------------------------------------------;
CLEAR_SCREEN MACRO
PUSHA
CALL CLEAR_SCREEN_
POPA
ENDM CLEARSCREEN
;-------------------------------------------------------------------;
GET_USER_NAME MACRO USER_NAME
PUSHA
MOV DI, OFFSET USER_NAME
CALL GET_USER_NAME_
POPA
ENDM GETUSERNAME
;-------------------------------------------------------------------;
USER_NAMES MACRO
PUSHA
CALL USER_NAMES_
POPA
ENDM GETUSERNAME
;-------------------------------------------------------------------;
MAIN_MENU MACRO
PUSHA
CALL MAIN_MENU_
POPA
ENDM MAINMENU
;-------------------------------------------------------------------;
INITIALIZE_PROGRAM MACRO
PUSHA
CALL INITIALIZE_PROGRAM_
POPA
ENDM INITALIZEPROGRAM
;-------------------------------------------------------------------;
GET_LEVEL MACRO
PUSHA
CALL GET_LEVEL_
POPA
ENDM GETLEVEL
;-------------------------------------------------------------------;
PIXELS_TO_GRID MACRO PixelX, PixelY, GridX, GridY
PUSHA
Mov CX, PixelX
Mov BX, PixelY
Mov SI, offset GridX
Mov DI, offset GridY
CALL PIXELS_TO_GRID_
POPA
ENDM PIXELS_TO_GRID
;-------------------------------------------------------------------;
Draw_All_Ships_ON_GRID MACRO
PUSHA
CALL Draw_All_Ships_ON_GRID_
POPA
ENDM Draw_All_Ships_ON_GRID
;-------------------------------------------------------------------;
DRAW_ALL_DESTROYED_SHIPS MACRO
PUSHA
CALL DRAW_ALL_DESTROYED_SHIPS_
POPA
ENDM DRAW_ALL_DESTROYED_SHIPS
;------------------------------------------------------------------;
Draw_X_Sign MACRO GRIDX_ ,GRIDY_ ,Color
PUSHA
MOV AX, GRIDX_
MOV GRID1_X, AX
MOV AX, GRIDY_
MOV GRID1_Y, AX
Mov Al,Color
Mov Variable_Color, Al
CALL Draw_X_Sign_
POPA
ENDM Draw_X_Sign
;-------------------------------------------------------------------;
Draw_All_X_Signs MACRO PLAYER_NUMBER
PUSHA
Mov AL, PLAYER_NUMBER
CALL Draw_All_X_Signs_
POPA
ENDM Draw_All_X_Signs
;-------------------------------------------------------------------;
CELL_HAS_SHIP MACRO GRIDX_ ,GRIDY_
PUSHA
MOV AX, GRIDX_
MOV GRID1_X, AX
MOV AX, GRIDY_
MOV GRID1_Y, AX
CALL CELL_HAS_SHIP_
POPA
ENDM CELL_HAS_SHIP
;-------------------------------------------------------------------;
Is_Cell_Attacked_Before MACRO
PUSHA
CALL Is_CELL_Attacked_Before_
POPA
ENDM Is_CELL_Attacked_Before
;-------------------------------------------------------------------;
Update_ATTACKS_DATA MACRO
PUSHA
CALL Update_ATTACKS_DATA_
POPA
ENDM Update_ATTACKS_DATA
;-------------------------------------------------------------------;
ATTACKED_CHECK_CELL_AND_Update_ATTACKS_DATA MACRO
PUSHA
CALL ATTACKED_CHECK_CELL_AND_Update_ATTACKS_DATA_
POPA
ENDM ATTACKED_CHECK_CELL_AND_Update_ATTACKS_DATA
;-------------------------------------------------------------------;
ATTACKER_Update_ATTACKS_DATA MACRO
PUSHA
CALL ATTACKER_Update_ATTACKS_DATA_
POPA
ENDM ATTACKER_Update_ATTACKS_DATA
;-------------------------------------------------------------------;
Get_CELL_FROM_PLAYER MACRO GRIDX_,GRIDY_
PUSHA
MOV SI, offset GRIDX_
MOV DI,offset GRIDY_
CALL Get_CELL_FROM_PLAYER_
POPA
ENDM Get_CELL_FROM_PLAYER
;-------------------------------------------------------------------;
IS_IT_THE_END MACRO
PUSHA
CALL IS_IT_THE_END_
POPA
ENDM IS_IT_THE_END
;-------------------------------------------------------------------;
REFRESH_DATA MACRO
PUSHA
CALL REFRESH_DATA_
POPA
ENDM REFRESH_DATA
;-------------------------------------------------------------------;
START_THE_GAME MACRO
PUSHA
CALL START_THE_GAME_
POPA
ENDM START_THE_GAME
;-------------------------------------------------------------------;
SCENE1_PLAYER_ATTACKS MACRO
PUSHA
CALL SCENE1_PLAYER_ATTACKS_
POPA
ENDM SCENE1_PLAYER_ATTACKS
;-------------------------------------------------------------------;
SCENE2_PLAYER_WATCHES MACRO
PUSHA
CALL SCENE2_PLAYER_WATCHES_
POPA
ENDM SCENE2_PLAYER_WATCHES
;-------------------------------------------------------------------;
MY_ATTACK_TWICE_POWER_UP_ACTIVATED MACRO
PUSHA
CALL MY_ATTACK_TWICE_POWER_UP_ACTIVATED_
POPA
ENDM MY_ATTACK_TWICE_POWER_UP_ACTIVATED
;-------------------------------------------------------------------;
OTHER_PLAYER_ATTACK_TWICE_POWER_UP_ACTIVATED MACRO
PUSHA
CALL OTHER_PLAYER_ATTACK_TWICE_POWER_UP_ACTIVATED_
POPA
ENDM OTHER_PLAYER_ATTACK_TWICE_POWER_UP_ACTIVATED
;-------------------------------------------------------------------;
DESTROY_RANDOM_SHIP_POWER_UP_ACTIVATED MACRO
PUSHA
CALL DESTROY_RANDOM_SHIP_POWER_UP_ACTIVATED_
POPA
ENDM DESTROY_RANDOM_SHIP_POWER_UP_ACTIVATED
;-------------------------------------------------------------------;
CHOOSE_SHIP_AND_DESTROY_IT MACRO
PUSHA
CALL CHOOSE_SHIP_AND_DESTROY_IT_
POPA
ENDM CHOOSE_SHIP_AND_DESTROY_IT
;-------------------------------------------------------------------;
STARTING_PAGE MACRO
PUSHA
CALL STARTING_PAGE_
POPA
ENDM STARTING_PAGE
;-------------------------------------------------------------------;
WAIT_FOR_KEY MACRO
PUSHA
CALL WAIT_FOR_KEY_
POPA
ENDM WAIT_FOR_KEY
;-------------------------------------------------------------------;
SEND_ATTACK_COORD MACRO
PUSHA
CALL SEND_ATTACK_COORD_
POPA
ENDM SEND_ATTACK_COORD
;-------------------------------------------------------------------;
RECEIEVE_ATTACK_COORD MACRO
PUSHA
CALL RECEIEVE_ATTACK_COORD_
POPA
ENDM RECEIEVE_ATTACK_COORD
;------------------------------------------------------------------;
SEND_ATTACK_RESULT MACRO
PUSHA
CALL SEND_ATTACK_RESULT_
POPA
ENDM SEND_ATTACK_RESULT
;-------------------------------------------------------------------;
RECEIEVE_ATTACK_RESULT MACRO
PUSHA
CALL RECEIEVE_ATTACK_RESULT_
POPA
ENDM RECEIEVE_ATTACK_RESULT
;-------------------------------------------------------------------;
MOVE_TO_NEXT_SCENE MACRO
PUSHA
CALL MOVE_TO_NEXT_SCENE_
POPA
ENDM MOVE_TO_NEXT_SCENE
;------------------------------------------------------------------;
SEND_POWER_UP_ACTIVATION MACRO POWER_UP_CODE_
PUSHA
MOV AL, POWER_UP_CODE_
CALL SEND_POWER_UP_ACTIVATION_
POPA
ENDM SEND_POWER_UP_ACTIVATION
;-------------------------------------------------------------------;
ACTIVATE_OTHER_PLAYER_POWER_UP MACRO
PUSHA
CALL ACTIVATE_OTHER_PLAYER_POWER_UP_
POPA
ENDM ACTIVATE_OTHER_PLAYER_POWER_UP
;-------------------------------------------------------------------;
UPDATE_OTHER_PLAYER_RANDOM_DESTROYED_SHIP MACRO
PUSHA
CALL UPDATE_OTHER_PLAYER_RANDOM_DESTROYED_SHIP_
POPA
ENDM UPDATE_OTHER_PLAYER_RANDOM_DESTROYED_SHIP
;-------------------------------------------------------------------;
RECEIEVE_DESTROYED_SHIP_POWER_UP_RESULT MACRO
PUSHA
CALL RECEIEVE_DESTROYED_SHIP_POWER_UP_RESULT_
POPA
ENDM RECEIEVE_DESTROYED_SHIP_POWER_UP_RESULT
;-------------------------------------------------------------------;
SEND_DESTROYED_SHIP_POWER_UP_RESULT MACRO
PUSHA
CALL SEND_DESTROYED_SHIP_POWER_UP_RESULT_
POPA
ENDM SEND_DESTROYED_SHIP_POWER_UP_RESULT
;-------------------------------------------------------------------;
MY_REVERSE_ATTACK_POWER_UP_ACTIVATED MACRO
PUSHA
CALL MY_REVERSE_ATTACK_POWER_UP_ACTIVATED_
POPA
ENDM MY_REVERSE_ATTACK_POWER_UP_ACTIVATED
;-------------------------------------------------------------------;
PRINT_ATTACK_MSG MACRO ATTACKED_OR_ATTACKER
PUSHA
MOV AL, ATTACKED_OR_ATTACKER
CALL PRINT_ATTACK_MSG_
POPA
ENDM PRINT_ATTACK_MSG
;-----------------------------;
IS_CELL_ON_GRID MACRO
PUSHA
CALL IS_CELL_ON_GRID_
POPA
ENDM IS_CELL_ON_GRID
;-----------------------------;
PLACE_SHIPS_ON_GRID MACRO
PUSHA
CALL PLACE_SHIPS_ON_GRID_
POPA
ENDM PLACE_SHIPS_ON_GRID
;-----------------------------;
ORDER_CELL_SELECTOR_POINTS MACRO IS_VERTICAL
PUSHA
MOV AL, IS_VERTICAL
CALL ORDER_CELL_SELECTOR_POINTS_
POPA
ENDM ORDER_CELL_SELECTOR_POINTS
;-----------------------------;
DRAW_SELECTION_SHIPS MACRO
PUSHA
CALL DRAW_SELECTION_SHIPS_
POPA
ENDM DRAW_SELECTION_SHIPS
;-----------------------------;
INITIALIZE_SHIPS_ARRAY MACRO
PUSHA
CALL INITIALIZE_SHIPS_ARRAY_
POPA
ENDM INITIALIZE_SHIPS_ARRAY
;-----------------------------;
DRAW_SELECTION_SHIP MACRO INDEX, SIZE, BORDER_COLOR
PUSHA
MOV AX, INDEX
MOV BX, SIZE
MOV CL, BORDER_COLOR
CALL DRAW_SELECTION_SHIP_
POPA
ENDM DRAW_SELECTION_SHIP
;-----------------------------;
DRAW_SHIP MACRO POINT1_X, POINT1_Y, POINT2_X, POINT2_Y, SHIP_COLOR, BORDER_COLOR
PUSHA
MOV AX, POINT1_X
MOV BX, POINT1_Y
MOV CX, POINT2_X
MOV SI, POINT2_Y
MOV DL, BORDER_COLOR
MOV DH, SHIP_COLOR
CALL DRAW_SHIP_
POPA
ENDM DRAW_SHIP
;-----------------------------;
GRID_TO_PIXELS MACRO GRID1_X_, GRID1_Y_, GRID2_X_, GRID2_Y_
PUSHA
MOV AX, GRID1_X_
MOV GRID1_X, AX
MOV AX, GRID1_Y_
MOV GRID1_Y, AX
MOV AX, GRID2_X_
MOV GRID2_X, AX
MOV AX, GRID2_Y_
MOV GRID2_Y, AX
CALL GRID_TO_PIXELS_
POPA
ENDM GRID_TO_PIXELS
;-----------------------------;
DRAW_RECTANGLE MACRO CORNER1X, CORNER1Y, CORNER2X, CORNER2Y, COLOR
PUSHA
PUSH AX
MOV AX, CORNER1X
MOV X1, AX
MOV AX, CORNER1Y
MOV Y1, AX
MOV AX, CORNER2X
MOV X2, AX
MOV AX, CORNER2Y
MOV Y2, AX
POP AX
MOV AL, COLOR
CALL DRAW_RECTANGLE_
POPA
ENDM DRAW_RECTANGLE
;-----------------------------;
CLEAR_GAME_SCREEN MACRO COLOR
PUSHA
MOV AL, COLOR
CALL CLEAR_GAME_SCREEN_
POPA
ENDM CLEAR_GAME_SCREEN
;-----------------------------;
DRAW_GRID MACRO
PUSHA
CALL DRAW_GRID_
POPA
ENDM DRAW_GRID
;-----------------------------;
DRAW_SLIDER MACRO SLIDER_ROW, COLOR
PUSHA
MOV DI, SLIDER_ROW
MOV AL, COLOR
CALL DRAW_SLIDER_
POPA
ENDM DRAW_SLIDER
;-----------------------------;
DRAW_COLUMN_SELECTOR MACRO COLUMN_SELECTOR_COLUMN, COLOR
PUSHA
MOV DI, COLUMN_SELECTOR_COLUMN
MOV AL, COLOR
CALL DRAW_COLUMN_SELECTOR_
POPA
ENDM DRAW_COLUMN_SELECTOR
;-----------------------------;
DRAW_SLIDER_BAR MACRO
PUSHA
CALL DRAW_SLIDER_BAR_
POPA
ENDM DRAW_SLIDER_BAR_MACRO
;-----------------------------;
FIRE_SLIDER MACRO
PUSHA
CALL FIRE_SLIDER_
POPA
ENDM FIRE_SLIDER
;-----------------------------;
SET_LEVEL_SETTINGS MACRO LEVEL
PUSHA
MOV AL, LEVEL
CALL SET_LEVEL_SETTINGS_
POPA
ENDM SET_LEVEL_SETTINGS
;-----------------------------;
GET_ATTACK_COLUMN MACRO
PUSHA
CALL GET_ATTACK_COLUMN_
POPA
ENDM GET_ATTACK_COLUMN
;------------------------------;
GET_ATTACK_COORDINATES MACRO
PUSHA
CALL GET_ATTACK_COORDINATES_
POPA
ENDM GET_ATTACK_COORDINATES
;-----------------------------;
DRAW_DESTROY_SHIP_POWER_UP MACRO
PUSHA
CALL DRAW_DESTROY_SHIP_POWER_UP_
POPA
ENDM DRAW_DESTROY_SHIP_POWER_UP
;-----------------------------;
DRAW_ATTACK_TWICE_POWER_UP MACRO
PUSHA
CALL DRAW_ATTACK_TWICE_POWER_UP_
POPA
ENDM DRAW_ATTACK_TWICE_POWER_UP
;-----------------------------;
DRAW_REVERSED_ATTACK_POWER_UP MACRO
PUSHA
CALL DRAW_REVERSED_ATTACK_POWER_UP_
POPA
ENDM DRAW_REVERSED_ATTACK_POWER_UP
;-----------------------------;
GET_POWER_UP_GRAPHICS_POSITION MACRO POSITION_INDEX
PUSHA
MOV AL, POSITION_INDEX
CALL GET_POWER_UP_GRAPHICS_POSITION_
POPA
ENDM GET_POWER_UP_GRAPHICS_POSITION
;-----------------------------;
DRAW_POWER_UPS_CARDS MACRO
PUSHA
CALL DRAW_POWER_UPS_CARDS_
POPA
ENDM DRAW_POWER_UPS_CARDS
;-----------------------------;
DRAW_POWER_UP_GRAPHICS MACRO POWER_UP_INDEX, POSITION_INDEX
PUSHA
MOV AH, POWER_UP_INDEX
MOV AL, POSITION_INDEX
CALL DRAW_POWER_UP_GRAPHICS_
POPA
ENDM DRAW_POWER_UP_GRAPHICS
;-----------------------------;
DRAW_POWER_UPS MACRO
PUSHA
CALL DRAW_POWER_UPS_
POPA
ENDM DRAW_POWER_UPS
;-----------------------------;
DRAW_POWER_UP_CARD_BORDER MACRO POSITION_INDEX, COLOR
PUSHA
MOV AH, POSITION_INDEX
MOV AL, COLOR
CALL DRAW_POWER_UP_CARD_BORDER_
POPA
ENDM DRAW_POWER_UP_CARD_BORDER
;-----------------------------;
POWER_UP_PICKER MACRO
PUSHA
CALL POWER_UP_PICKER_
POPA
ENDM POWER_UP_PICKER
;-----------------------------;
PRINT_POWER_UP_MSG MACRO POWER_UP_INDEX
PUSHA
MOV AL, POWER_UP_INDEX
CALL PRINT_POWER_UP_MSG_
POPA
ENDM PRINT_POWER_UP_MSG
;-----------------------------;
GET_POWER_UP_INDEX MACRO POSITION_INDEX, IS_USED_OFFSET
PUSHA
MOV BX, IS_USED_OFFSET
MOV AH, POSITION_INDEX
CALL GET_POWER_UP_INDEX_
POPA
ENDM GET_POWER_UP_INDEX
;-----------------------------;
CLEAR_POWER_UPS MACRO
PUSHA
CALL CLEAR_POWER_UPS_
POPA
ENDM CLEAR_POWER_UPS
;-----------------------------;
PRESS_ENTER_TO_CONTINUE MACRO
PUSHA
CALL PRESS_ENTER_TO_CONTINUE_
POPA
ENDM PRESS_ENTER_TO_CONTINUE
;-----------------------------;
PLAYERS_PLACE_SHIPS MACRO
PUSHA
CALL PLAYERS_PLACE_SHIPS_
POPA
ENDM PLAYERS_PLACE_SHIPS
;-----------------------------;
SEND_BYTE MACRO
PUSHA
CALL SEND_BYTE_
POPA
ENDM SEND_BYTE
;-----------------------------;
RECEIVE_BYTE MACRO
PUSHA
CALL RECEIVE_BYTE_
POPA
ENDM RECEIVE_BYTE
;-----------------------------;
INITIALIZE_SERIAL_PORT MACRO
PUSHA
CALL INITIALIZE_SERIAL_PORT_
POPA
ENDM INITIALIZE_SERIAL_PORT
;-----------------------------;
SEND_DATA MACRO BUFFER_INDEX
PUSHA
MOV AL, BUFFER_INDEX
CALL SEND_DATA_
POPA
ENDM SEND_DATA
;-----------------------------;
RECEIVE_DATA MACRO
PUSHA
CALL RECEIVE_DATA_
POPA
ENDM RECEIVE_DATA
;-----------------------------;
ADD_BYTE_TO_SEND_BUFFER MACRO BYTE_, BUFFER_INDEX
PUSHA
MOV BH, BYTE_
MOV SERIAL_BYTE, BH
MOV BL, BUFFER_INDEX
CALL ADD_BYTE_TO_SEND_BUFFER_
POPA
ENDM ADD_BYTE_TO_SEND_BUFFER
;-----------------------------;
ADD_WORD_TO_SEND_BUFFER MACRO WORD_, BUFFER_INDEX
PUSHA
MOV AX, WORD_
MOV SERIAL_BYTE, AL
MOV BL, BUFFER_INDEX
CALL ADD_BYTE_TO_SEND_BUFFER_
MOV AX, WORD_
MOV SERIAL_BYTE, AH
MOV BL, BUFFER_INDEX
CALL ADD_BYTE_TO_SEND_BUFFER_
POPA
ENDM ADD_WORD_TO_SEND_BUFFER
;-----------------------------;
REMOVE_BYTE_FROM_SEND_BUFFER MACRO BUFFER_INDEX
PUSHA
MOV BL, BUFFER_INDEX
CALL REMOVE_BYTE_FROM_SEND_BUFFER_
POPA
ENDM REMOVE_BYTE_FROM_SEND_BUFFER
;-----------------------------;
CHECK_FOR_INLINE_CHAT_KEY MACRO SCANCODE, ASCII_CODE
PUSHA
MOV AH, SCANCODE
MOV AL, ASCII_CODE
CALL CHECK_FOR_INLINE_CHAT_KEY_
POPA
ENDM CHECK_FOR_INLINE_CHAT_KEY
;-----------------------------;
CLEAR_RECEIVE_BUFFER MACRO BUFFER_INDEX
PUSHA
MOV AL, BUFFER_INDEX
CALL CLEAR_RECEIVE_BUFFER_
POPA
ENDM CLEAR_RECEIVE_BUFFER
;-----------------------------;
SEND_EXIT_GAME MACRO
PUSHA
CALL SEND_EXIT_GAME_
JMP PRE_EXIT_SCREEN
POPA
ENDM SEND_EXIT_GAME
;-----------------------------;
;-------------------------------------------;
;------------ STATUSBAR MACROS -------------;
;-------------------------------------------;
DRAW_STATUS_BAR_TEMPLATE MACRO ;DRAWS STATUSBAR WITH DEFAULT PLAYERS NAMES
PUSHA
CALL DRAW_STATUS_BAR_TEMPLATE_
POPA
ENDM DRAW_STATUS_BAR_TEMPLATE
;------------------------------------------------------------------------;
DRAW_NOTIFICATION_BAR MACRO
PUSHA
CALL DRAW_NOTIFICATION_BAR_
POPA
ENDM DRAW_NOTIFICATION_BAR
;------------------------------------------------------------------------;
PRINT_NOTIFICATION_MESSAGE MACRO STATUS_TEXT, INDEX
PUSHA
MOV AX,1301H
MOV BX,000FH
MOV DX,2200H
ADD DH,INDEX
MOV BP, OFFSET EMPTY_STRING+1
MOV CX,0
MOV CL, EMPTY_STRING
INT 10H
MOV BP, OFFSET STATUS_TEXT
CALL PRINT_NOTIFICATION_MESSAGE_
POPA
ENDM PRINT_NOTIFICATION_MESSAGE
;------------------------------------------------------------------------;
PRINT_MY_SCORE MACRO
PUSHA
CALL PRINT_MY_SCORE_
POPA
ENDM PRINT_PLAYER1_SCORE
;------------------------------------------------------------------------;
PRINT_OTHER_PLAYER_SCORE MACRO
PUSHA
CALL PRINT_OTHER_PLAYER_SCORE_
POPA
ENDM PRINT_PLAYER2_SCORE
;------------------------------------------------------------------------;
;-------------------------------------------;
;--------------- GRID MACROS ---------------;
;-------------------------------------------;
CELLS_SELECTOR MACRO SHIP_SIZE
PUSHA
MOV CX,SHIP_SIZE
CALL CELLS_SELECTOR_
POPA
ENDM CELLS_SELECTOR
;------------------------------------------------------------------------;
CLEAR_GRID MACRO
PUSHA
CALL CLEAR_GRID_
POPA
ENDM CLEAR_GRID
;------------------------------------------------------------------------;
CALCULATE_SELECTOR_INITIAL_POSITION MACRO
PUSHA
CALL CALCULATE_SELECTOR_INITIAL_POSITION_
POPA
ENDM CALCULATE_SELECTOR_INITIAL_POSITION
;------------------------------------------------------------------------;
POSSIBLE_ORIENTATIONS_CHECKER MACRO
PUSHA
CALL POSSIBLE_ORIENTATIONS_CHECKER_
POPA
ENDM POSSIBLE_ORIENTATIONS_CHECKER
;------------------------------------------------------------------------;
STAT_SCREEN MACRO
PUSHA
CALL STAT_SCREEN_
POPA
ENDM STAT_SCREEN
;------------------------------------------------------------------------;
CONCATENATE MACRO STRING,PLAYER_NUMBER
PUSHA
MOV BX, OFFSET STRING
MOV AL, PLAYER_NUMBER
CALL CONCATENATE_
POPA
ENDM CONCATENATE
;------------------------------------------------------------------------;
DRAW_PRE_EXIT_SCREEN MACRO
PUSHA
CALL DRAW_PRE_EXIT_SCREEN_
POPA
ENDM DRAW_PRE_EXIT_SCREEN
;------------------------------------------------------------------------;
EXIT_GAME MACRO
PUSHA
CALL EXIT_GAME_
POPA
ENDM EXIT_GAME
;------------------------------------------------------------------------;
PRINT_INLINE_CHAT_MESSAGE MACRO STATUS_TEXT, INDEX
PUSHA
MOV BX, OFFSET STATUS_TEXT
MOV AL, INDEX
CALL PRINT_INLINE_CHAT_MESSAGE_
POPA
ENDM PRINT_INLINE_CHAT_MESSAGE
;------------------------------------------------------------------------;
;-------------------------------------------;
;--------------- CHAT MACROS ---------------;
;-------------------------------------------;
STANDALONE_CHAT_MODE MACRO
PUSHA
CALL STANDALONE_CHAT_MODE_
POPA
ENDM STANDALONE_CHAT_MODE
;------------------------------------------------------------------------;
CHECK_IF_CHAT_KEY MACRO ASCII_KEY
PUSHA
MOV BL,ASCII_KEY
CALL CHECK_IF_CHAT_KEY_
POPA
ENDM CHECK_IF_CHAT_KEY
;------------------------------------------------------------------------;
ADD_TO_MSGS_QUEUE MACRO PLAYER_INDEX,MESSAGE
PUSHA
MOV AH,PLAYER_INDEX
MOV BP, OFFSET MESSAGE
CALL ADD_TO_MSGS_QUEUE_
POPA
ENDM ADD_TO_MSGS_QUEUE
;------------------------------------------------------------------------;
PRINT_MSGS_QUEUE MACRO
PUSHA
CALL PRINT_MSGS_QUEUE_
POPA
ENDM PRINT_MSGS_QUEUE
;------------------------------------------------------------------------;