-
Notifications
You must be signed in to change notification settings - Fork 1
/
level2mod.asm
1435 lines (1074 loc) · 20.4 KB
/
level2mod.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
;a macro to print msgs
print macro string
pusha
lea dx, string
mov ah, 09h
int 21h
endm
; a macro for mouse cursor
mouse macro x, y
pusha
mov ah, 02h
mov bx, 0
mov dh, x
mov dl, y
int 10h
popa
endm
.model small
.stack 0100h
.data
key2 db 0
; for line 1
xaxis1L2 dw 50
yaxis1L2 dw 20
xaxis2L2 dw 80
yaxis2L2 dw 20
xaxis3L2 dw 110
yaxis3L2 dw 20
xaxis4L2 dw 140
yaxis4L2 dw 20
xaxis5L2 dw 170
yaxis5L2 dw 20
xaxis6L2 dw 200
yaxis6L2 dw 20
xaxis7L2 dw 230
yaxis7L2 dw 20
xaxis8L2 dw 260
yaxis8L2 dw 20
; for line2
x1L2 dw 60 ; x for x axis
y1L2 dw 37 ; y for y axis
x2L2 dw 90
y2L2 dw 37
x3L2 dw 120
y3L2 dw 37
x4L2 dw 150
y4L2 dw 37
x5L2 dw 180
y5L2 dw 37
x6L2 dw 210
y6L2 dw 37
x7L2 dw 240
y7L2 dw 37
;for line 3
xcord1L2 dw 77 ; x coordinate
ycord1L2 dw 52 ; y coordinate
xcord2L2 dw 107 ; x coordinate
ycord2L2 dw 52 ; y coordinate
xcord3L2 dw 137 ; x coordinate
ycord3L2 dw 52 ; y coordinate
xcord4L2 dw 167 ; x coordinate
ycord4L2 dw 52 ; y coordinate
xcord5L2 dw 197 ; x coordinate
ycord5L2 dw 52 ; y coordinate
;for line 4
xaL2 dw 98 ; xa for brick1
yaL2 dw 68 ; ya for brick1
xbL2 dw 115
ybL2 dw 68
xcL2 dw 130
ycL2 dw 68
xdL2 dw 195
ydL2 dw 68
;line 5
xeL2 dw 105
yeL2 dw 84
xfL2 dw 200
yfL2 dw 84
;---paddle
pxl2 dw 10 ; paddle on x axis
pyl2 dw 180 ; paddle on y axis
templ2 dw 180
tempxl2 dw 90
tempyl2 dw 180
temp3 dw 185
gamename db "/BRICK BREAKER\",'$'
gamename2 db"\ /",'$'
gamename3 db " ~~~~~~~~~~~~~",'$'
entername db"Player name: ",'$'
instruction1 db " INSTRUCTIONS:",'$'
instruction2 db "1.Hit the bricks with ball to break them", '$'
instruction3 db "2.The ball will be bounced using paddle",'$'
instruction4 db "3.The ball cannot touch the floor",'$'
instruction5 db "4.Break maximum bricks to earn score",'$'
instruction6 db "5.Enter your name to continue",'$'
;screen 2
play0 db "------",'$'
play db "| PLAY |",'$'
resume0 db"--------",'$'
resume db "| RESUME |", '$'
scoreboard0 db"-------------",'$'
scoreboard db "| SCORE BOARD |",'$'
exitmsg0 db"------",'$'
exitmsg db"| EXIT |", '$'
;BORDER1 DB"/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\",'$'
;BORDER2 DB"\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/",'$'
border1 db"/\/\ /\/\ /\/\ /\/\ /\/\ /\/\ /\/\ /\/\",'$'
border2 db"\ / \ / \ / \ / \ / \ / \ / \ /",'$'
border3 db" \/ \/ \/ \/ \/ \/ \/ \/",'$'
heart1 db"/\/\",'$'
heart2 db"\ /", '$'
heart3 db" \/", '$'
score1 db "Score: $"
pname1 db "Name: $"
Level2 db "Level:2 $"
username db 7 dup('$') ,'$'
.code
main proc
mov ax, @data
mov ds,ax
firstScreen:
call clearscreen
mov ah, 00h
mov al, 13h
int 10h
mov ah, 02h
mov bx, 0
mov dh, 1
mov dl, 13
int 10h
lea dx, gamename
mov ah, 09h
int 21h
mov ah, 02h
mov bx, 0
mov dh, 2
mov dl, 13
int 10h
print gamename2
mov ah, 02h
mov bx, 0
mov dh, 3
mov dl, 13
int 10h
print gamename3
mov ah, 02h
mov bx, 0
mov dh, 5
mov dl, 13
int 10h
print instruction1
mov ah, 02h
mov bx, 0
mov dh, 7
mov dl, 0
int 10h
print instruction2
mov ah, 02h
mov bx, 0
mov dh, 9
mov dl, 0
int 10h
print instruction3
mov ah, 02h
mov bx, 0
mov dh, 11
mov dl, 0
int 10h
print instruction4
mov ah, 02h
mov bx, 0
mov dh, 13
mov dl, 0
int 10h
print instruction5
mov ah, 02h
mov bx, 0
mov dh, 15
mov dl, 0
int 10h
print instruction6
mov ah, 02h
mov bx, 0
mov dh, 17
mov dl, 5
int 10h
lea dx, entername
mov ah, 09h
int 21h
lea dx,username
Mov ah, 3fh
Int 21h
call clearscreen
mouse 0, 0
print border1
mouse 1, 0
print border2
mouse 2, 0
print border3
mouse 4, 0
print heart1
mouse 5, 0
print heart2
mouse 6, 0
print heart3
mouse 8, 0
print heart1
mouse 9, 0
print heart2
mouse 10, 0
print heart3
mouse 12, 0
print heart1
mouse 13, 0
print heart2
mouse 14, 0
print heart3
mouse 16, 0
print heart1
mouse 17, 0
print heart2
mouse 18, 0
print heart3
mouse 20, 0
print heart1
mouse 21, 0
print heart2
mouse 22, 0
print heart3
;;;;;;;;;;;;;;;;
mouse 4, 196
print heart1
mouse 5, 196
print heart2
mouse 6, 196
print heart3
mouse 8, 196
print heart1
mouse 9, 196
print heart2
mouse 10, 196
print heart3
mouse 12, 196
print heart1
mouse 13, 196
print heart2
mouse 14, 196
print heart3
mouse 16, 196
print heart1
mouse 17, 196
print heart2
mouse 18, 196
print heart3
mouse 20, 196
print heart1
mouse 21, 196
print heart2
mouse 22, 196
print heart3
;print play
mouse 4, 16
print play0
mouse 5, 15
print play
mouse 6, 16
print play0
;print resume
mouse 9, 15
print resume0
mouse 10, 14
print resume
mouse 11, 15
print resume0
;print scoreBoard
mouse 14, 13
print scoreboard0
mouse 15, 12
print scoreboard
mouse 16, 13
print scoreboard0
;print exit
mouse 19, 16
print exitmsg0
mouse 20, 15
print exitmsg
mouse 21, 16
print exitmsg0
;call clearscreen
options:
mov ah,1
int 16h
;jz options
mov ah,00h
int 16h
cmp ah,4Bh
je firstScreen
;cmp ah,4Dh
;je right
cmp al,101
je Exit
cmp al, 112
je nextScreen
JNE options
nextScreen:
call clearscreen
mouse 1,1
print score1
mouse 1,12
mov dl,03 ; heart
mov ah,02
int 21h
mouse 1,13
mov dl,03 ; heart
mov ah,02
int 21h
mouse 1,14
mov dl,03 ; heart
mov ah,02
int 21h
mouse 1,18
print Level2
mouse 1,28
print pname1
mouse 1,33
mov si, offset username
mov cx, 7
hii:
mov ah, 02h
mov dl, [si]
inc si
int 21h
loop hii
;bricks-----------------------------
mov bx,0 ; counter
againl2:
mov xaxis1l2,50
mov bx,0
L1l2:
MOV AH, 0Ch
MOV AL, 01h ; Color Number
MOV CX, xaxis1l2 ; co-ordinates of X-axis
MOV DX, yaxis1l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis1l2
inc bx
cmp bx,30
je filll2
jne L1l2
filll2:
inc yaxis1l2
cmp yaxis1l2,35
je box1l2
jne againl2
;-------------------------------------
box1l2:
again1l2:
mov xaxis2l2,80
mov bx,0
L2l2:
MOV AH, 0Ch
MOV AL, 04h ; Color Number
MOV CX, xaxis2l2 ; co-ordinates of X-axis
MOV DX, yaxis2l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis2l2
inc bx
cmp bx,30
je colorl2
jne L2l2
colorl2:
inc yaxis2l2
cmp yaxis2l2,35
je box2l2
jne again1l2
;-----------------------------
box2l2:
again2l2:
mov xaxis3l2,110
mov bx,0
L3l2:
MOV AH, 0Ch
MOV AL, 0Eh ; Color Number
MOV CX, xaxis3l2 ; co-ordinates of X-axis
MOV DX, yaxis3l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis3l2
inc bx
cmp bx,30
je color1l2
jne L3l2
color1l2:
inc yaxis3l2
cmp yaxis3l2,35
je box3l2
jne again2l2
;--------------------------------------------
box3l2:
again3l2:
mov xaxis4l2,140
mov bx,0
L4l2:
MOV AH, 0Ch
MOV AL, 01h ; Color Number
MOV CX, xaxis4l2 ; co-ordinates of X-axis
MOV DX, yaxis4l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis4l2
inc bx
cmp bx,30
je color2l2
jne L4l2
color2l2:
inc yaxis4l2
cmp yaxis4l2,35
je box4l2
jne again3l2
;---------------------------------------
box4l2:
again4l2:
mov xaxis5l2,170
mov bx,0
L5l2:
MOV AH, 0Ch
MOV AL, 02h ; Color Number
MOV CX, xaxis5l2 ; co-ordinates of X-axis
MOV DX, yaxis5l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis5l2
inc bx
cmp bx,30
je color3l2
jne L5l2
color3l2:
inc yaxis5l2
cmp yaxis5l2,35
je box5l2
jne again4l2
;--------------------------------------
box5l2:
again5l2:
mov xaxis6l2,200
mov bx,0
L6l2:
MOV AH, 0Ch
MOV AL, 05h ; Color Number
MOV CX, xaxis6l2 ; co-ordinates of X-axis
MOV DX, yaxis6l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis6l2
inc bx
cmp bx,30
je color4l2
jne L6l2
color4l2:
inc yaxis6l2
cmp yaxis6l2,35
je box6l2
jne again5l2
;-----------------------------------------
box6l2:
again6l2:
mov xaxis7l2,230
mov bx,0
L7l2:
MOV AH, 0Ch
MOV AL, 02h ; Color Number
MOV CX, xaxis7l2 ; co-ordinates of X-axis
MOV DX, yaxis7l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis7l2
inc bx
cmp bx,30
je color5l2
jne L7l2
color5l2:
inc yaxis7l2
cmp yaxis7l2,35
je box7l2
jne again6l2
;---------------------------------
box7l2:
again7l2:
mov xaxis8l2,260
mov bx,0
L8l2:
MOV AH, 0Ch
MOV AL, 0Eh ; Color Number
MOV CX, xaxis8l2 ; co-ordinates of X-axis
MOV DX, yaxis8l2 ; co-ordinates of Y-axis
INT 10H
inc xaxis8l2
inc bx
cmp bx,30
je color6l2
jne L8l2
color6l2:
inc yaxis8l2
cmp yaxis8l2,35
je rec1l2
jne again7l2
;--------------------
rec1l2:
r1l2: ; r = repeat process
mov x1l2,60
mov bx,0
do1l2: ; do the process
MOV AH, 0Ch
MOV AL, 0Eh ; Color Number
MOV CX, x1l2 ; co-ordinates of X-axis
MOV DX, y1l2 ; co-ordinates of Y-axis
INT 10H
inc x1l2
inc bx
cmp bx,30
je c1l2 ; c for coloring
jne do1l2
c1l2:
inc y1l2
cmp y1l2,50
je rec2l2
jne r1l2
;--------------------
rec2l2:
r2l2:
mov x2l2,90
mov bx,0
do2l2: ; do the process
MOV AH, 0Ch
MOV AL, 02h ; Color Number
MOV CX, x2l2 ; co-ordinates of X-axis
MOV DX, y2l2 ; co-ordinates of Y-axis
INT 10H
inc x2l2
inc bx
cmp bx,30
je c2l2
jne do2l2
c2l2:
inc y2l2
cmp y2l2,50
je rec3l2
jne r2l2
;--------------------
rec3l2:
r3l2:
mov x3l2,120
mov bx,0
do3l2: ; do the process
MOV AH, 0Ch
MOV AL, 01h ; Color Number
MOV CX, x3l2 ; co-ordinates of X-axis
MOV DX, y3l2 ; co-ordinates of Y-axis
INT 10H
inc x3l2
inc bx
cmp bx,30
je c3l2
jne do3l2
c3l2:
inc y3l2
cmp y3l2,50
je rec4l2
jne r3l2
;----------------
rec4l2:
r4l2:
mov x4l2,150
mov bx,0
do4l2: ; do the process
MOV AH, 0Ch
MOV AL, 05h ; Color Number
MOV CX, x4l2 ; co-ordinates of X-axis
MOV DX, y4l2 ; co-ordinates of Y-axis
INT 10H
inc x4l2
inc bx
cmp bx,30
je c4l2
jne do4l2
c4l2:
inc y4l2
cmp y4l2,50
je rec5l2
jne r4l2
;----------------
rec5l2:
r5l2:
mov x5l2,180
mov bx,0
do5l2: ; do the process
MOV AH, 0Ch
MOV AL, 0Eh ; Color Number
MOV CX, x5l2 ; co-ordinates of X-axis
MOV DX, y5l2 ; co-ordinates of Y-axis
INT 10H
inc x5l2
inc bx
cmp bx,30
je c5l2
jne do5l2
c5l2:
inc y5l2
cmp y5l2,50
je rec6l2
jne r5l2
;----------------
rec6l2:
r6l2:
mov x6l2,210
mov bx,0
do6l2: ; do the process
MOV AH, 0Ch
MOV AL, 02h ; Color Number
MOV CX, x6l2 ; co-ordinates of X-axis
MOV DX, y6l2 ; co-ordinates of Y-axis
INT 10H
inc x6l2
inc bx
cmp bx,30
je c6l2
jne do6l2
c6l2:
inc y6l2
cmp y6l2,50
je rec7l2
jne r6l2
;----------------
rec7l2:
r7l2:
mov x7l2,240
mov bx,0
do7l2: ; do the process
MOV AH, 0Ch
MOV AL, 01h ; Color Number
MOV CX, x7l2 ; co-ordinates of X-axis
MOV DX, y7l2 ; co-ordinates of Y-axis
INT 10H
inc x7l2
inc bx
cmp bx,30
je c7l2
jne do7l2
c7l2:
inc y7l2
cmp y7l2,50
je brick1l2
jne r7l2
;-----------------------
brick1l2:
rep1l2:
mov xcord1l2,77
mov bx,0
make1l2: ; make the brick
MOV AH, 0Ch
MOV AL, 02h ; Color Number
MOV CX, xcord1l2 ; co-ordinates of X-axis
MOV DX, ycord1l2 ; co-ordinates of Y-axis
INT 10H
inc xcord1l2
inc bx
cmp bx,30
je clr1l2 ; colour the brick
jne make1l2
clr1l2:
inc ycord1l2
cmp ycord1l2,65
je brick2l2
jne rep1l2
;-----------------------
brick2l2:
rep2l2:
mov xcord2l2,107
mov bx,0
make2l2: ; make the brick
MOV AH, 0Ch
MOV AL, 01h ; Color Number
MOV CX, xcord2l2 ; co-ordinates of X-axis
MOV DX, ycord2l2 ; co-ordinates of Y-axis
INT 10H
inc xcord2l2
inc bx
cmp bx,30
je clr2l2 ; colour the brick
jne make2l2
clr2l2:
inc ycord2l2
cmp ycord2l2,65
je brick3l2
jne rep2l2
;-----------------------
brick3l2:
rep3l2:
mov xcord3l2, 137
mov bx,0
make3l2: ; make the brick
MOV AH, 0Ch
MOV AL, 05h ; Color Number
MOV CX, xcord3l2 ; co-ordinates of X-axis
MOV DX, ycord3l2 ; co-ordinates of Y-axis
INT 10H
inc xcord3l2
inc bx
cmp bx,30
je clr3l2; colour the brick
jne make3l2
clr3l2:
inc ycord3l2
cmp ycord3l2,65
je brick4l2
jne rep3l2
;-----------------------
brick4l2:
rep4l2:
mov xcord4l2,167
mov bx,0
make4l2: ; make the brick
MOV AH, 0Ch
MOV AL, 04h ; Color Number
MOV CX, xcord4l2 ; co-ordinates of X-axis
MOV DX, ycord4l2 ; co-ordinates of Y-axis
INT 10H
inc xcord4l2
inc bx
cmp bx,30
je clr4l2 ; colour the brick
jne make4l2
clr4l2:
inc ycord4l2
cmp ycord4l2,65
je brick5l2
jne rep4l2
;-----------------------
brick5l2:
rep5l2:
mov xcord5l2,197
mov bx,0
make5l2: ; make the brick
MOV AH, 0Ch
MOV AL, 01h ; Color Number
MOV CX, xcord5l2 ; co-ordinates of X-axis
MOV DX, ycord5l2 ; co-ordinates of Y-axis
INT 10H
inc xcord5l2
inc bx
cmp bx,40
je clr5l2 ; colour the brick
jne make5l2
clr5l2:
inc ycord5l2
cmp ycord5l2,65
je br1l2