-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPROJECT.asm
More file actions
1056 lines (962 loc) · 32.6 KB
/
PROJECT.asm
File metadata and controls
1056 lines (962 loc) · 32.6 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
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
;DOLEV RAZIEL'S ASSEMBLY 8086 PROJECT
;ROCKETS
;TEACHER: SERGE MENZON
P286N ;NEEDED for the pusha and popa commands
IDEAL
MODEL small
STACK 1000h
MAX_BMP_WIDTH = 320 ;the maximum height and length for a BMP IMAGE
MAX_BMP_HEIGHT = 200
SMALL_BMP_HEIGHT = 0
SMALL_BMP_WIDTH = 0
DATASEG
; --------------------------
;vars for the game itself
string db ' Press ENTER to start $'
string1 db 'Game starts in seconds$'
string2 db 'Rockets Survived: $'
AsarotNumber db '0' ;rockets survived
YehidotNumber db '0$' ;rockets survived
string3 db 'WELCOME TO MY GAME!$'
string4 db 'you have control, move the plane using$'
string5 db 'the WASD keys and avoid the missiles!$'
string6 db 'W - UP, A - LEFT, D - RIGHT, S - DOWN$'
string9 db 'you can press anytime Q to exit$'
string7 db 'Ready to play? press ENTER to start$'
string10 db 'OH NO, YOU FAILED$'
string11 db 'PRESS ENTER TO TRY AGAIN$'
string12 db 'PRESS Q TO QUIT THE GAME$'
;---------------------------
;vars to open the images needed
filename db 'newmenu.bmp',0
filename2 db 'boom.bmp', 0
OneBmpLine db MAX_BMP_WIDTH dup (0) ; One Color line read buffer
ScreenLineMax db MAX_BMP_WIDTH dup (0) ; One Color line read buffer
;BMP File data
FileHandle dw ?
Header db 54 dup(0)
Palette db 400h dup (0)
BmpFileErrorMsg db 'Error At Opening Bmp File .', 0dh, 0ah,'$'
ErrorFile db 0
BB db "BB..",'$'
BmpLeft dw ?
BmpTop dw ?
BmpColSize dw ?
BmpRowSize dw ?
;---------------------------
;SPRITES VARS: PLANE & ROCKETS
PlnMW equ 32
PlnMH equ 32
StartPlaneX dw 50
StartPlaneY dw 100
Plane DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,8,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,8,7,8,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,8,7,7,8,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,8,7,7,7,8,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,8,7,7,7,8,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 8,8,15,15,15,15,15,15,15,15,8,7,7,7,7,8
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 8,7,8,15,15,15,15,15,15,15,8,7,7,7,7,7
DB 8,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 8,7,7,8,15,15,15,15,15,15,15,8,7,7,7,7
DB 7,8,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 8,7,7,8,15,15,15,15,15,15,15,15,7,7,7,7
DB 7,7,8,15,15,8,8,8,15,15,15,15,15,15,15,15
DB 8,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8
DB 8,8,8,8,8,7,7,7,8,8,8,15,15,15,15,15
DB 15,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7
DB 7,7,7,7,8,8,8,8,8,7,7,8,8,8,15,15
DB 15,8,8,8,8,7,7,7,7,7,7,7,8,8,8,8
DB 8,8,8,7,7,7,7,7,7,7,7,7,7,7,8,8
DB 15,7,7,7,8,7,7,7,7,7,7,8,7,7,7,7
DB 7,7,7,8,7,7,7,7,7,7,7,8,8,8,15,15
DB 8,7,7,8,8,8,8,8,8,8,8,8,7,7,7,7
DB 7,7,8,8,8,8,8,8,8,8,8,15,15,15,15,15
DB 8,7,8,15,15,15,15,15,15,15,15,8,7,7,7,7
DB 7,8,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 8,8,15,15,15,15,15,15,15,15,8,7,7,7,7,7
DB 8,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 8,15,15,15,15,15,15,15,15,15,8,7,7,7,7,8
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,8,7,7,7,8,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,8,7,7,7,8,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,8,7,7,8,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,8,7,8,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,8,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
PlaneWhite DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
DB 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
RktML equ 48
RktMH equ 15
StartRocketX dw 280
StartRocketY dw 100
Rkt db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 6, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 115, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 14, 6, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 14, 6, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,12, 12, 12, 12, 12, 12, 4, 4, 4, 4, 15, 15, 15, 15, 15, 15
db 15, 15, 2, 2, 2, 0, 0, 0, 2, 6, 2, 2, 14, 2, 6, 115, 14, 6, 2, 2, 2, 115, 6, 6, 2, 14, 115, 2, 6, 14, 115, 2,15, 15, 14, 14, 14, 14, 12, 12, 12, 12, 4, 4, 4, 15, 15, 15
db 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 115, 6, 2, 2, 2, 14, 2, 6, 2, 6, 2, 2, 2, 2, 2,15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 4, 4, 4
db 15, 15, 2, 2, 2, 0, 0, 0, 2, 115, 2, 6, 115, 2, 6, 2, 6, 6, 14, 2, 2, 6, 6, 115, 14, 6, 115, 14, 115, 2, 6, 2,15, 15, 14, 14, 14, 14, 12, 12, 12, 12, 4, 4, 4, 15, 15, 15
db 15, 15, 15, 15, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,12, 12, 12, 12, 12, 12, 4, 4, 4, 4, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 14, 6, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 14, 6, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 115, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 6, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
RktWhite db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
db 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
ImageX dw ?
ImageY dw ?
ImageW dw ?
ImageH dw ?
ImageMaskOffset dw ?
Color db ?
; --------------------------
;variables for the timer
CLOCK equ es:6Ch ;real PC timer location on memory
seconds db '3$' ;3 seconds to print
;---------------------------
;for identificing the key pressed on the keyboard
;for saving the random number for the rockets
keyPress db ?
;the random number we will get will be stored here
rndNumberGot dw ?
;---------------------------
CODESEG
;==============================================================================
;========================== PROCEDURES AREA====================================
;==============================================================================
;==============================================================================
;===================================MACRO PROCEDURES
;===================================================
;The procedures here needed for the Plane and the Rockets print.
;RandomNumber - generates number between 0-3 (4 options) and the results determines the Y of the new Rocket.
MACRO DrawMImage ObjX,ObjY,ObjW,ObjH,Obj
pusha
mov AX, [ObjX]
mov [ImageX],AX
mov AX, [ObjY]
mov [ImageY],AX
mov AX, ObjW
mov [ImageW], AX
mov AX, ObjH
mov [ImageH], AX
mov [ImageMaskOffset], offset Obj
call DrawMovingImage
popa
ENDM DrawMImage
;---------------------------------------
proc DrawMovingImage
pusha
mov cx, [ImageW]
mov si, [ImageMaskOffset]
cycle:
mov al, [byte si]
pusha
call PutPixel
popa
inc si
inc [ImageX]
;dec dx
loop cycle
mov cx, [ImageW]
mov dx, [ImageW]
sub [ImageX], dx
inc [ImageY]
dec [ImageH]
jnz cycle
popa
ret
ENDP DrawMovingImage
;----------------------------------
proc PutPixel
pusha
mov bh,0h
mov cx,[ImageX]
mov dx,[ImageY]
mov ah,0Ch
int 10h
popa
ret
endp PutPixel
;----------------------------------------
proc randomNUMBER
pusha
call randomize
random_the_Y:
mov ax,160d
push ax
call random
cmp ax, 30
jl random_the_Y
mov [rndNumberGot],ax
popa
ret
endp randomNUMBER
;----------------------------------------
proc WhatY
pusha
mov [StartRocketX], 280
mov ax, [rndNumberGot]
mov [StartRocketY], ax
popa
ret
endp WhatY
;----------------------------------------
proc checkCollide
pusha
mov dx, [StartPlaneY]
mov cx, 0
Collision_Y_CHECK_LOOP_BELOW:
add dx, cx
cmp dx, [StartRocketY]
je collision_On_Y_CHECK_X
inc cx
cmp cx, 20
jne Collision_Y_CHECK_LOOP_BELOW
mov bx, [StartPlaneY]
mov cx, 20
Collision_Y_CHECK_LOOP_ABOVE:
add bx, cx
cmp bx, [StartRocketY]
je collision_On_Y_CHECK_X
dec cx
cmp cx, 0
jne Collision_Y_CHECK_LOOP_ABOVE
no_collision:
popa
ret
collision_On_Y_CHECK_X:
mov ax, [StartPlaneX]
mov cx, 10
check_X_loop:
add ax, cx
cmp ax, [StartRocketX]
je INSANE_COLLISION
dec cx
cmp cx,0
jne check_X_loop
no_collision2:
popa
ret
INSANE_COLLISION:
call you_lost_Screen
endp checkCollide
;==========================IMAGE-OPENING PROCEDURES
;==================================================
;The procedures here are for the BMP opening, reading and printing.
;MUST - For the Main Menue IMAGE PRINT.
proc OpenShowBmp near
push cx
push bx
call OpenBmpFile
cmp [ErrorFile],1
je @@ExitProc
call ReadBmpHeader
; from here assume bx is global param with file handle.
call ReadBmpPalette
call CopyBmpPalette
call ShowBMP
call CloseBmpFile
@@ExitProc:
pop bx
pop cx
ret
endp OpenShowBmp
;-------------------------------------------
proc OpenBmpFile near ;input dx filename to open
mov ah, 3Dh
xor al, al
int 21h
jc @@ErrorAtOpen
mov [FileHandle], ax
jmp @@ExitProc
@@ErrorAtOpen:
mov [ErrorFile],1
@@ExitProc:
ret
endp OpenBmpFile
;-------------------------------------------
proc CloseBmpFile near
pusha
mov ah,3Eh
mov bx, [FileHandle]
int 21h
popa
ret
endp CloseBmpFile
;-------------------------------------------
; Read 54 bytes the Header
proc ReadBmpHeader near
push cx
push dx
mov ah,3fh
mov bx, [FileHandle]
mov cx,54
mov dx,offset Header
int 21h
pop dx
pop cx
ret
endp ReadBmpHeader
;-------------------------------------------
proc ReadBmpPalette near ; Read BMP file color palette, 256 colors * 4 bytes (400h)
; 4 bytes for each color BGR + null)
push cx
push dx
mov ah,3fh
mov cx,400h
mov dx,offset Palette
int 21h
pop dx
pop cx
ret
endp ReadBmpPalette
;-------------------------------------------
; Will move out to screen memory the colors
; video ports are 3C8h for number of first color
; and 3C9h for all rest
proc CopyBmpPalette near
push cx
push dx
mov si,offset Palette
mov cx,256
mov dx,3C8h
mov al,0 ; black first
out dx,al ;3C8h
inc dx ;3C9h
CopyNextColor:
mov al,[si+2] ; Red
shr al,2 ; divide by 4 Max (cos max is 63 and we have here max 255 ) (loosing color resolution).
out dx,al
mov al,[si+1] ; Green.
shr al,2
out dx,al
mov al,[si] ; Blue.
shr al,2
out dx,al
add si,4 ; Point to next color. (4 bytes for each color BGR + null)
loop CopyNextColor
pop dx
pop cx
ret
endp CopyBmpPalette
;-------------------------------------------
proc ShowBMP
; BMP graphics are saved upside-down.
; Read the graphic line by line (BmpRowSize lines in VGA format),
; displaying the lines from bottom to top.
push cx
mov ax, 0A000h
mov es, ax
mov cx,[BmpRowSize]
mov ax,[BmpColSize] ; row size must dived by 4 so if it less we must calculate the extra padding bytes
xor dx,dx
mov si,4
div si
mov bp,dx
mov dx,[BmpLeft]
@@NextLine:
push cx
push dx
mov di,cx ; Current Row at the small bmp (each time -1)
add di,[BmpTop] ; add the Y on entire screen
; next 5 lines di will be = cx*320 + dx , point to the correct screen line
mov cx,di
shl cx,6
shl di,8
add di,cx
add di,dx
; small Read one line
mov ah,3fh
mov cx,[BmpColSize]
add cx,bp ; extra bytes to each row must be divided by 4
mov dx, offset ScreenLineMax
int 21h
; Copy one line into video memory
cld ; Clear direction flag, for movsb
mov cx,[BmpColSize]
mov si,offset ScreenLineMax
rep movsb ; Copy line to the screen
pop dx
pop cx
loop @@NextLine
pop cx
ret
endp ShowBMP
;==========================SCREEN-CLEANING PROCEDURES
;====================================================
Proc clearBLACK
pusha
mov ax, 00000h ;the color, black
xor bx,bx
xor dx,dx
screenLOOP:
mov [es:bx],ax
inc bx
cmp cx, bx
jne screenLOOP
popa
ret
endp clearBLACK
;---------------------------------
Proc clearWHITE
pusha
mov ax, 0FFFFh
xor bx,bx
xor dx,dx
mov cx ,200*320 ;כל הפיקסלים על המסך בגרפיק מוד
screenLOOP2:
mov [es:bx],ax
inc bx
cmp cx, bx
jne screenLOOP2
popa
ret
endp clearWHITE
;==================================TIMER PROCEDURES
;==================================================
proc ONEsecond
pusha ;דוחף למחסנית את כל האוגרים
mov ax, es
push ax
mov ax, 40h
mov es, ax
mov cx, 18 ;המעבד פועל בתדר של 18 טיקים בשניה
Delay:
mov ax, [CLOCK]
Tick:
cmp ax, [CLOCK]
je Tick
loop Delay
pop ax
mov es, ax
popa ;מוציא מהמחסנית הכל
ret
endp ONEsecond
;-----------------------------------------------
proc doing1tick
pusha ;דוחף למחסנית את כל האוגרים
mov ax, es
push ax
mov ax, 40h
mov es, ax
mov cx, 1 ;המעבד פועל בתדר של 18 טיקים בשניה
Delay2:
mov ax, [CLOCK]
Tick2:
cmp ax, [CLOCK]
je Tick2
loop Delay2
pop ax
mov es, ax
popa ;מוציא מהמחסנית הכל
ret
endp doing1tick
;==================================MODES PROCEDURES
;==================================================
proc graphic_mode
pusha
mov ax, 13h
int 10h
popa
ret
endp graphic_mode
;-----------------------------
proc text_mode
pusha
mov ah, 0
mov al, 2
int 10h
popa
ret
endp text_mode
;===================================GAME PROCEDURES
;==================================================
proc menu
pusha
mov [BmpLeft],0
mov [BmpTop],0
mov [BmpColSize], 320
mov [BmpRowSize] ,200
mov dx, offset filename
call OpenShowBmp
press_enter_to_start:
; print "press enter to start"
mov dl, 9 ; ציר איקס
mov dh, 21 ; ציר וואי
mov bx, 0
mov ah, 2h ;משמש להצבעה על המיקום שבחרנו
int 10h
mov dx, offset string
mov ah, 9h ;הוראת ההדפסה, עם אינטרפט 21
int 21h
checkENTER: ;until user presses enter
; Wait for key press - INT16H
mov ah,0
int 16h
cmp al, 0Dh ;the SCAN CODE OF ENTER KEY compared to AL, which stores the pressed key's ASCII code.
jne checkENTER
popa
ret
endp menu
;-------------------------------------------------------------------------
proc game_instructions
; Process BMP file AGAIN.
pusha
call graphic_mode
mov dl, 1 ; ציר איקס
mov dh, 3 ; ציר וואי
mov bx, 0
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string3 ;הוראת ההדפסה
mov ah, 9h
int 21h
mov dl, 1 ; ציר איקס
mov dh, 5 ; ציר וואי
mov bx, 0
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string4 ;הוראת ההדפסה
mov ah, 9h
int 21h
mov dl, 1 ; ציר איקס
mov dh, 7 ; ציר וואי
mov bx, 0
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string5 ;הוראת ההדפסה
mov ah, 9h
int 21h
mov dl, 1 ; ציר איקס
mov dh, 9 ; ציר וואי
mov bx, 0
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string6 ;הוראת ההדפסה
mov ah, 9h
int 21h
mov dl, 1 ; ציר איקס
mov dh, 13 ; ציר וואי
mov bx, 0
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string7 ;הוראת ההדפסה
mov ah, 9h
int 21h
mov dl, 1 ; ציר איקס
mov dh, 11 ; ציר וואי
mov bx, 0
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string9 ;הוראת ההדפסה
mov ah, 9h
int 21h
checkENTER2: ;until user presses enter
; Wait for key press - INT16H
mov ah,0
int 16h
cmp al, 0Dh ;the ASCII CODE OF ENTER KEY compared to AL, which stores the pressed key's ASCII code.
jne checkENTER2
popa
ret
endp game_instructions
;----------------------------------------------------------------------
proc game_starts_in
pusha
call graphic_mode
;printing the timer and "game starts in"
; print "game starts in"
mov dl, 7 ; ציר איקס
mov dh, 12 ; 12 בציר הוואי כדי שייצא באמצע
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string1 ;הוראת ההדפסה
mov ah, 9h
int 21h
mov cx, 4 ;4 שניות לתחילת המשחק
PRINTINGseconds:
; print the seconds
mov dl, 22 ; ציר איקס
mov dh, 12 ; 12 בציר הוואי כדי שייצא באמצע
mov bx, 0 ; לוודא שהאוגר לא מצביע על שום מקום אחר בזיכרון לנוחות בלבד
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset seconds ;הוראת ההדפסה
mov ah, 9h
int 21h
dec [byte ptr seconds]
call ONEsecond
loop PRINTINGseconds
popa
ret
endp game_starts_in
;--------------------------------------------
proc you_lost_Screen
pusha
call graphic_mode
mov [BmpLeft],80
mov [BmpTop], 0
mov [BmpColSize], 150
mov [BmpRowSize] ,150
mov dx, offset filename2
call OpenShowBmp
;string 10 - oh no you failed
mov dl, 10 ; ציר איקס
mov dh, 18 ;ציר וואי
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string10 ;הוראת ההדפסה
mov ah, 9h
int 21h
;rockets survived
mov dl, 9 ; ציר איקס
mov dh, 19 ;ציר וואי
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string2 ;הוראת ההדפסה
mov ah, 9h
int 21h
;number of rockets survived
mov dl, 27 ; ציר איקס
mov dh, 19 ; ציר וואי
mov ah, 2h ;מציאת מיקום ההדפסה
int 10h
mov dx, offset AsarotNumber ;הוראת ההדפסה
mov ah, 9h ;ההדפסה
int 21h
;press enter to start again
mov dl, 7 ; ציר איקס
mov dh, 21 ;ציר וואי
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string11 ;הוראת ההדפסה
mov ah, 9h
int 21h
;press q to quit
mov dl, 7 ; ציר איקס
mov dh, 22 ;ציר וואי
mov ah, 2h ;על מנת שידפיס בחלק הרצוי של המסך
int 10h
mov dx, offset string12 ;הוראת ההדפסה
mov ah, 9h
int 21h
checkWhichKEYpressed: ;until user presses enter
; Wait for key press - INT16H
mov ah,0
int 16h
cmp al, 0Dh ;the ASCII CODE OF ENTER KEY compared to AL, which stores the pressed key's ASCII code.
je CALL_game_starts_in
cmp al, 'q'
je call_to_exit
jne checkWhichKEYpressed
CALL_game_starts_in:
call play_again
call_to_exit:
call exit
popa
ret
endp you_lost_Screen
;--------------------------------------------
proc background_for_game
pusha
mov ax, 15
mov bx, 18*320
mov cx, 200*320
screenLOOP1:
mov [es:bx],ax
inc bx
cmp cx, bx
jne screenLOOP1
popa
ret
endp background_for_game
;---------------------------------------------
proc clear_plane_trail_W
pusha
DrawMImage StartPlaneX,StartPlaneY,PlnMW,PlnMH, PlaneWhite
popa
ret
endp clear_plane_trail_W
;---------------------------------------------
proc clear_plane_trail_A
pusha
DrawMImage StartPlaneX,StartPlaneY,PlnMW,PlnMH, PlaneWhite
popa
ret
endp clear_plane_trail_A
;---------------------------------------------
proc clear_plane_trail_S
pusha
DrawMImage StartPlaneX,StartPlaneY,PlnMW,PlnMH, PlaneWhite
popa
ret
endp clear_plane_trail_S
;---------------------------------------------
proc clear_plane_trail_D
pusha
DrawMImage StartPlaneX,StartPlaneY,PlnMW,PlnMH, PlaneWhite
popa
ret
endp clear_plane_trail_D
;---------------------------------------------
proc clear_rocket_trail
pusha
DrawMImage StartRocketX,StartRocketY,RktML,RktMH, RktWhite
popa
ret
endp clear_rocket_trail
;---------------------------------------------
proc scoreboard
pusha
;call clearBLACK needs to get the pixels needed to print on black.
;the parameter save on cx.
mov cx, 18*320
call clearBLACK
;printing your score text
mov dl, 1 ; ציר איקס
mov dh, 1 ; ציר וואי
mov ah, 2h ;מציאת מיקום ההדפסה
int 10h
mov dx, offset string2 ;הוראת ההדפסה
mov ah, 9h ;ההדפסה
int 21h
mov dl, 19 ; ציר איקס
mov dh, 1 ; ציר וואי
mov ah, 2h ;מציאת מיקום ההדפסה
int 10h
mov dx, offset AsarotNumber ;הוראת ההדפסה
mov ah, 9h ;ההדפסה
int 21h
popa
ret
endp scoreboard
;---------------------------------------------
proc IncreaseScore
;IncreaseScore Procedure Explainations
cmp [byte ptr YehidotNumber], '9' ;Checks if the yehidot number is 9.
jne DontIncreaseAsarot ;If yes, xor YehidotNumber, 0 and increase AsarotNumber by 1.
inc [byte ptr AsarotNumber] ;If no, just increase YehidotNumber by 1.
mov [byte ptr YehidotNumber], '0'
jmp asarot_radial
DontIncreaseAsarot:
inc [byte ptr YehidotNumber]
asarot_radial:
ret
endp IncreaseScore
;---------------------------------------------
proc planePrint
;print the plane
DrawMImage StartPlaneX,StartPlaneY,PlnMW,PlnMH, Plane
ret
endp planePrint
;===================================KEYS PROCEDURES
;==================================================
proc IsKeyPressed
pusha
mov ah, 0Bh
int 21h
cmp al,0
popa
ret
endp IsKeyPressed
;--------------------------------------------------
Proc movePlane
pusha
mov ah, 7h ;finding out which key presses - main difference between 7h and 1h
int 21h ;is that 7h does not shows the key pressed on the screen.
mov [keyPress], al
W_UP:
cmp [keyPress], 'w'
jne S_DOWN
call clear_plane_trail_W
sub [StartPlaneY], 10
jmp goOUT
S_DOWN:
cmp [keyPress], 's'
jne A_LEFT
call clear_plane_trail_S
add [StartPlaneY], 10
jmp goOUT
A_LEFT:
cmp [keyPress], 'a'
jne D_RIGHT
call clear_plane_trail_A
sub [StartPlaneX], 10
jmp goOUT
D_RIGHT:
cmp [keyPress], 'd'
jne ESC_OUT
call clear_plane_trail_D
add [StartPlaneX], 10
jmp goOUT
ESC_OUT:
cmp [keyPress], 'q'
je call_to_exit_2
jne goOUT
call_to_exit_2:
call exit
goOUT:
call scoreboard
call planePrint
popa
ret
endp movePlane
;------------------------------------------