-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9objtxt.bas
953 lines (730 loc) · 31.6 KB
/
9objtxt.bas
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
;***************************************************************
;
; Multisprite: 9 Objects With Coordinates
;
;
; By Duane Alan Hahn (Random Terrain) using hints, tips,
; code snippets, and more from AtariAge members such as
; batari, SeaGtGruff, RevEng, Robert M, Atarius Maximus,
; jrok, Nukey Shay, supercat, and GroovyBee.
;
; Score coordinate code provided by bogax.
;
;```````````````````````````````````````````````````````````````
;
; Instructions
;
; There are 6 sprites (player0 at the top, down to player5 at
; the bottom), 2 missiles (missile0 above missile1) and 1 ball
; on the screen. Hold down the fire button and press the
; joystick up or down to select an object. Hold down the fire
; button and move the joystick left or right to change the size
; of the currently selected object.
;
; To move the currently selected object, release the fire
; button and press the joystick in any direction.
;
;```````````````````````````````````````````````````````````````
;
; If this program will not compile for you, get the latest
; version of batari Basic:
;
; http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#gettingstarted
;
;***************************************************************
;***************************************************************
;
; Kernel setup.
;
includesfile multisprite_bankswitch.inc
set kernel multisprite
set romsize 16k
;***************************************************************
;
; Variable aliases go here (DIMs).
;
; You can have more than one alias for each variable.
; If you use different aliases for bit operations,
; it's easier to understand and remember what they do.
;
; I start variable aliases with one underscore so I won't
; have to worry that I might be using bB keywords by mistake.
; I also start labels with two underscores for the same
; reason. The second underscore also makes labels stand out
; so I can tell at a glance that they are labels and not
; variables.
;
; Use bit operations any time you need a simple off/on
; variable. One variable essentially becomes 8 smaller
; variables when you use bit operations.
;
; I start my bit aliases with "_Bit" then follow that
; with the bit number from 0 to 7, then another underscore
; and the name. Example: _Bit0_Reset_Restrainer
;
;```````````````````````````````````````````````````````````````
; Switches between sprites, missiles, and the ball.
;
dim _Current_Object = a
;```````````````````````````````````````````````````````````````
; Width of sprites.
;
dim _Sprite_Size0 = b
dim _Sprite_Size1 = c
dim _Sprite_Size2 = d
dim _Sprite_Size3 = e
dim _Sprite_Size4 = f
dim _Sprite_Size5 = g
;```````````````````````````````````````````````````````````````
; Width of missiles.
;
dim _Missile0_Width = l
dim _Missile1_Width = m
;```````````````````````````````````````````````````````````````
; Width of ball.
;
dim _Ball_Width = n
;```````````````````````````````````````````````````````````````
; Object jiggle counter.
;
dim _Jiggle_Counter = o
;```````````````````````````````````````````````````````````````
; Remembers NUSIZ0.
;
dim _P0_NUSIZ = p
;```````````````````````````````````````````````````````````````
; Bits for various jobs.
;
dim _Bit0_Reset_Restrainer = t
dim _Bit1_Joy0_Restrainer = t
dim _Bit2_Activate_Jiggle = t
dim _Bit3_Flip_p0 = t
;```````````````````````````````````````````````````````````````
; Remembers position of jiggled object.
;
dim _Memx = x
dim _Memy = y
;```````````````````````````````````````````````````````````````
; Makes better random numbers.
;
dim rand16 = z
;```````````````````````````````````````````````````````````````
; Splits up the score into 3 parts.
;
dim _sc1 = score
dim _sc2 = score+1
dim _sc3 = score+2
;***************************************************************
;
; Constants for the 9 objects.
;
const _Sprite0 = 0
const _Sprite1 = 1
const _Sprite2 = 2
const _Sprite3 = 3
const _Sprite4 = 4
const _Sprite5 = 5
const _Missile0 = 6
const _Missile1 = 7
const _Ball = 8
;***************************************************************
;
; Text minikernel stuff
;
dim TextIndex = w
const noscore = 1
const textbank = 3
const p0_text = 0
const p1_text = 12
const p2_text = 24
const p3_text = 36
const p4_text = 48
const p5_text = 60
const m0_text = 72
const m1_text = 84
const ball_text = 96
const fontstyle = SQUISH ; Shorter font to save lines
const screenheight = 80
pfheight = 7
TextColor = $0F
playfield:
................
................
................
................
................
................
................
................
................
................
................
end
;***************************************************************
;***************************************************************
;
; PROGRAM START/RESTART
;
;
__Start_Restart
;***************************************************************
;
; Displays the screen to avoid going over 262.
;
drawscreen
;***************************************************************
;
; Sprite shapes.
;
player0:
%00001111
%00000110
%11111111
%00111110
%11111111
%00000110
%00001111
end
player1:
%00000011
%00000110
%00011111
%11111110
%00011111
%00000110
%00000011
end
player2:
%00001111
%00000110
%11111110
%00001111
%11111110
%00000110
%00001111
end
player3:
%00111110
%00000111
%00011110
%11111110
%00011110
%00000111
%00111110
end
player4:
%00001111
%00000110
%00011110
%11111111
%00011110
%00000110
%00001111
end
player5:
%00011111
%00000100
%11111110
%00111110
%11111110
%00000100
%00011111
end
;***************************************************************
;
; Object placement.
;
player0x = 77 : player0y = 80
player1x = 85 : player1y = player0y - 16
player2x = 85 : player2y = player1y - 14
player3x = 85 : player3y = player2y - 14
player4x = 85 : player4y = player3y - 14
player5x = 85 : player5y = player4y - 14
missile0x = 98 : missile0y = 78
missile1x = 98 : missile1y = missile0y - 15
ballx = 98 : bally = missile1y - 15
;***************************************************************
;
; Makes all sprites face the same way.
;
_NUSIZ1{3} = 0 : NUSIZ2{3} = 0 : NUSIZ3{3} = 0
NUSIZ4{3} = 0 : NUSIZ5{3} = 0
;***************************************************************
;
; Mutes volume of both sound channels.
;
AUDV0 = 0 : AUDV1 = 0
;***************************************************************
;
; Clears 25 of the normal 26 variables (fastest way).
; The variable z is used for random numbers in this program
; and clearing it would mess up those random numbers.
;
a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 0 : h = 0 : i = 0
j = 0 : k = 0 : l = 0 : m = 0 : n = 0 : o = 0 : p = 0 : q = 0 : r = 0
s = 0 : t = 0 : u = 0 : v = 0 : w = 0 : x = 0 : y = 0
;***************************************************************
;
; Sets repetition restrainer for the reset switch.
; (Holding it down won't make it keep resetting.)
;
_Bit0_Reset_Restrainer{0} = 1
;***************************************************************
;
; Sets starting width for missiles and ball.
;
_Missile0_Width = 0 : _Missile1_Width = 0 : _Ball_Width = 0
;***************************************************************
;***************************************************************
;
; MAIN LOOP (MAKES THE PROGRAM GO)
;
;
__Main_Loop
;***************************************************************
;
; Sets colors.
;
COLUP0 = $08 : COLUP1 = $BA : _COLUP1 = $1A : COLUP2 = $3A : COLUP3 = $6A
COLUP4 = $8A : COLUP5 = $CA : COLUBK= 0 : COLUPF = $4A
;***************************************************************
;
; Fire button section.
;
;```````````````````````````````````````````````````````````````
; Turns off joystick repetition restrainer bit and skips this
; section if button is not pressed.
;
if !joy0fire then _Bit1_Joy0_Restrainer{1} = 0 : goto __Skip_Fire_Button
;```````````````````````````````````````````````````````````````
; Turns off joystick repetition restrainer bit if joystick not
; moved.
;
if !joy0up && !joy0down && !joy0left && !joy0right then _Bit1_Joy0_Restrainer{1} = 0
;```````````````````````````````````````````````````````````````
; Skips everything if joystick already moved.
;
if _Bit1_Joy0_Restrainer{1} then goto __Skip_Movement
;```````````````````````````````````````````````````````````````
; Switches object if joystick is moved up or down.
;
if joy0up then _Bit1_Joy0_Restrainer{1} = 1 : _Bit2_Activate_Jiggle{2} = 1 : _Jiggle_Counter = 0 : _Current_Object = _Current_Object - 1 : if _Current_Object >= 250 then _Current_Object = 8
if joy0down then _Bit1_Joy0_Restrainer{1} = 1 : _Bit2_Activate_Jiggle{2} = 1 : _Jiggle_Counter = 0 : _Current_Object = _Current_Object + 1 : if _Current_Object >= 9 then _Current_Object = 0
;```````````````````````````````````````````````````````````````
; Skips ahead if joystick not moved left.
;
if !joy0left then goto __Skip_Size_Decrease
;```````````````````````````````````````````````````````````````
; Turns on joystick repetition restrainer bit.
;
_Bit1_Joy0_Restrainer{1} = 1
;```````````````````````````````````````````````````````````````
; Decreases size of appropriate object.
;
if _Current_Object = _Sprite0 then _Sprite_Size0 = _Sprite_Size0 - 1 : if _Sprite_Size0 >= 250 then _Sprite_Size0 = 2
if _Current_Object = _Sprite1 then _Sprite_Size1 = _Sprite_Size1 - 1 : if _Sprite_Size1 >= 250 then _Sprite_Size1 = 2
if _Current_Object = _Sprite2 then _Sprite_Size2 = _Sprite_Size2 - 1 : if _Sprite_Size2 >= 250 then _Sprite_Size2 = 2
if _Current_Object = _Sprite3 then _Sprite_Size3 = _Sprite_Size3 - 1 : if _Sprite_Size3 >= 250 then _Sprite_Size3 = 2
if _Current_Object = _Sprite4 then _Sprite_Size4 = _Sprite_Size4 - 1 : if _Sprite_Size4 >= 250 then _Sprite_Size4 = 2
if _Current_Object = _Sprite5 then _Sprite_Size5 = _Sprite_Size5 - 1 : if _Sprite_Size5 >= 250 then _Sprite_Size5 = 2
if _Current_Object = _Missile0 then _Missile0_Width = _Missile0_Width - 1 : if _Missile0_Width = 255 then _Missile0_Width = 3
if _Current_Object = _Missile1 then _Missile1_Width = _Missile1_Width - 1 : if _Missile1_Width = 255 then _Missile1_Width = 3
if _Current_Object = _Ball then _Ball_Width = _Ball_Width - 1 : if _Ball_Width = 255 then _Ball_Width = 3
goto __Skip_Size_Increase
__Skip_Size_Decrease
;```````````````````````````````````````````````````````````````
; Skips ahead if joystick not moved right.
;
if !joy0right then goto __Skip_Size_Increase
;```````````````````````````````````````````````````````````````
; Turns on joystick repetition restrainer bit.
;
_Bit1_Joy0_Restrainer{1} = 1
;```````````````````````````````````````````````````````````````
; Increases size of appropriate object.
;
if _Current_Object = _Sprite0 then _Sprite_Size0 = _Sprite_Size0 + 1 : if _Sprite_Size0 >= 3 then _Sprite_Size0 = 0
if _Current_Object = _Sprite1 then _Sprite_Size1 = _Sprite_Size1 + 1 : if _Sprite_Size1 >= 3 then _Sprite_Size1 = 0
if _Current_Object = _Sprite2 then _Sprite_Size2 = _Sprite_Size2 + 1 : if _Sprite_Size2 >= 3 then _Sprite_Size2 = 0
if _Current_Object = _Sprite3 then _Sprite_Size3 = _Sprite_Size3 + 1 : if _Sprite_Size3 >= 3 then _Sprite_Size3 = 0
if _Current_Object = _Sprite4 then _Sprite_Size4 = _Sprite_Size4 + 1 : if _Sprite_Size4 >= 3 then _Sprite_Size4 = 0
if _Current_Object = _Sprite5 then _Sprite_Size5 = _Sprite_Size5 + 1 : if _Sprite_Size5 >= 3 then _Sprite_Size5 = 0
if _Current_Object = _Missile0 then _Missile0_Width = _Missile0_Width + 1 : if _Missile0_Width >= 4 then _Missile0_Width = 0
if _Current_Object = _Missile1 then _Missile1_Width = _Missile1_Width + 1 : if _Missile1_Width >= 4 then _Missile1_Width = 0
if _Current_Object = _Ball then _Ball_Width = _Ball_Width + 1 : if _Ball_Width >= 4 then _Ball_Width = 0
__Skip_Size_Increase
;```````````````````````````````````````````````````````````````
; Skips object movement section.
;
goto __Skip_Movement
__Skip_Fire_Button
;***************************************************************
;
; Moves selected object when fire button is not pressed.
;
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not sprite0.
;
if _Current_Object > _Sprite0 then goto __Skip_Sprite0_Movement
;```````````````````````````````````````````````````````````````
; Moves sprite0 if joystick is moved.
;
if joy0up then if player0y <= 81 then player0y = player0y + 1
if joy0down then if player0y >= 2 + player0height then player0y = player0y - 1
if joy0left then if player0x >= 1 then player0x = player0x - 1 : _Bit3_Flip_p0{3} = 0
if joy0right then temp5 = _Data_Sprite0_Width[_Sprite_Size0] : if player0x <= temp5 then player0x = player0x + 1 : _Bit3_Flip_p0{3} = 1
goto __Skip_Movement
__Skip_Sprite0_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not sprite1.
;
if _Current_Object > _Sprite1 then goto __Skip_Sprite1_Movement
;```````````````````````````````````````````````````````````````
; Moves sprite1 if joystick is moved.
;
if joy0up then if player1y <= 75 then player1y = player1y + 1
if joy0down then if player1y >= player1height then player1y = player1y - 1
if joy0left then if player1x >= 9 then player1x = player1x - 1 : _NUSIZ1{3} = 0 : _NUSIZ1{6} = 0
if joy0right then temp5 = _Data_1to5_Width[_Sprite_Size1] : if player1x <= temp5 then player1x = player1x + 1 : _NUSIZ1{3} = 1 : _NUSIZ1{6} = 1
goto __Skip_Movement
__Skip_Sprite1_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not sprite2.
;
if _Current_Object > _Sprite2 then goto __Skip_Sprite2_Movement
;```````````````````````````````````````````````````````````````
; Moves sprite2 if joystick is moved.
;
if joy0up then if player2y <= 75 then player2y = player2y + 1
if joy0down then if player2y >= player2height then player2y = player2y - 1
if joy0left then if player2x >= 9 then player2x = player2x - 1 : NUSIZ2{3} = 0 : NUSIZ2{6} = 0
if joy0right then temp5 = _Data_1to5_Width[_Sprite_Size2] : if player2x <= temp5 then player2x = player2x + 1 : NUSIZ2{3} = 1 : NUSIZ2{6} = 1
goto __Skip_Movement
__Skip_Sprite2_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not sprite3.
;
if _Current_Object > _Sprite3 then goto __Skip_Sprite3_Movement
;```````````````````````````````````````````````````````````````
; Moves sprite3 if joystick is moved.
;
if joy0up then if player3y <= 75 then player3y = player3y + 1
if joy0down then if player3y >= player3height then player3y = player3y - 1
if joy0left then if player3x >= 9 then player3x = player3x - 1 : NUSIZ3{3} = 0 : NUSIZ3{6} = 0
if joy0right then temp5 = _Data_1to5_Width[_Sprite_Size3] : if player3x <= temp5 then player3x = player3x + 1 : NUSIZ3{3} = 1 : NUSIZ3{6} = 1
goto __Skip_Movement
__Skip_Sprite3_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not sprite4.
;
if _Current_Object > _Sprite4 then goto __Skip_Sprite4_Movement
;```````````````````````````````````````````````````````````````
; Moves sprite4 if joystick is moved.
;
if joy0up then if player4y <= 75 then player4y = player4y + 1
if joy0down then if player4y >= player4height then player4y = player4y - 1
if joy0left then if player4x >= 9 then player4x = player4x - 1 : NUSIZ4{3} = 0 : NUSIZ4{6} = 0
if joy0right then temp5 = _Data_1to5_Width[_Sprite_Size4] : if player4x <= temp5 then player4x = player4x + 1 : NUSIZ4{3} = 1 : NUSIZ4{6} = 1
goto __Skip_Movement
__Skip_Sprite4_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not sprite5.
;
if _Current_Object > _Sprite5 then goto __Skip_Sprite5_Movement
;```````````````````````````````````````````````````````````````
; Moves sprite5 if joystick is moved.
;
if joy0up then if player5y <= 75 then player5y = player5y + 1
if joy0down then if player5y >= player5height then player5y = player5y - 1
if joy0left then if player5x >= 9 then player5x = player5x - 1 : NUSIZ5{3} = 0 : NUSIZ5{6} = 0
if joy0right then temp5 = _Data_1to5_Width[_Sprite_Size5] : if player5x <= temp5 then player5x = player5x + 1 : NUSIZ5{3} = 1 : NUSIZ5{6} = 1
goto __Skip_Movement
__Skip_Sprite5_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not missile0.
;
if _Current_Object <> _Missile0 then goto __Skip_Missile0_Movement
;```````````````````````````````````````````````````````````````
; Moves missile0 if joystick is moved.
;
if joy0up then if missile0y <= 79 then missile0y = missile0y + 1
if joy0down then if missile0y >= 3 then missile0y = missile0y - 1
if joy0left then if missile0x >= 2 then missile0x = missile0x - 1
if joy0right then temp5 = _Data_M_B_x_Size[_Missile0_Width] : if missile0x <= temp5 then missile0x = missile0x + 1
goto __Skip_Movement
__Skip_Missile0_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not missile1.
;
if _Current_Object <> _Missile1 then goto __Skip_Missile1_Movement
;```````````````````````````````````````````````````````````````
; Moves missile1 if joystick is moved.
;
if joy0up then if missile1y <= 79 then missile1y = missile1y + 1
if joy0down then if missile1y >= 3 then missile1y = missile1y - 1
if joy0left then if missile1x >= 2 then missile1x = missile1x - 1
if joy0right then temp5 = _Data_M_B_x_Size[_Missile1_Width] : if missile1x <= temp5 then missile1x = missile1x + 1
goto __Skip_Movement
__Skip_Missile1_Movement
;```````````````````````````````````````````````````````````````
; Skips ahead if current object is not the ball.
;
if _Current_Object <> _Ball then goto __Skip_Movement
;```````````````````````````````````````````````````````````````
; Moves ball if joystick is moved.
;
if joy0up then if bally <= 79 then bally = bally + 1
if joy0down then if bally >= 3 then bally = bally - 1
if joy0left then if ballx >= 2 then ballx = ballx - 1
if joy0right then temp5 = _Data_M_B_x_Size[_Ball_Width]: if ballx <= temp5 then ballx = ballx + 1
__Skip_Movement
goto __Bank_2 bank2
;***************************************************************
;
; Missile/ball x size data.
;
data _Data_M_B_x_Size
158, 157, 155, 151
end
;***************************************************************
;
; Sprite width data.
;
data _Data_Sprite0_Width
150, 141, 125
end
;***************************************************************
;
; Sprite width data.
;
data _Data_1to5_Width
158, 150, 134
end
bank 2
__Bank_2
;****************************************************************
;
; Flips player0 sprite when necessary.
;
if _Bit3_Flip_p0{3} then REFP0 = 8
;***************************************************************
;
; Sets the size of all sprites.
;
;```````````````````````````````````````````````````````````````
; Clears sprite0 width, but leaves the missile0 stuff alone.
;
_P0_NUSIZ = _P0_NUSIZ & %11111000
;```````````````````````````````````````````````````````````````
; Sets sprite0 width from data.
;
_P0_NUSIZ = _P0_NUSIZ | _Data_Sprite_Size[_Sprite_Size0]
;```````````````````````````````````````````````````````````````
; Puts sprite0 data into NUSIZ0.
;
NUSIZ0 = _P0_NUSIZ
;```````````````````````````````````````````````````````````````
; Clears sprite widths, but leaves the missile1 stuff alone,
; then sets sprite widths.
;
_NUSIZ1 = _NUSIZ1 & %11111000 : _NUSIZ1 = _NUSIZ1 | _Data_Sprite_Size[_Sprite_Size1]
NUSIZ2 = NUSIZ2 & %11111000 : NUSIZ2 = NUSIZ2 | _Data_Sprite_Size[_Sprite_Size2]
NUSIZ3 = NUSIZ3 & %11111000 : NUSIZ3 = NUSIZ3 | _Data_Sprite_Size[_Sprite_Size3]
NUSIZ4 = NUSIZ4 & %11111000 : NUSIZ4 = NUSIZ4 | _Data_Sprite_Size[_Sprite_Size4]
NUSIZ5 = NUSIZ5 & %11111000 : NUSIZ5 = NUSIZ5 | _Data_Sprite_Size[_Sprite_Size5]
;****************************************************************
;
; Sets the width of missile0.
;
;```````````````````````````````````````````````````````````````
; Clears missile0 width, but leaves the sprite stuff alone.
;
_P0_NUSIZ = _P0_NUSIZ & %11001111
;```````````````````````````````````````````````````````````````
; Sets missile0 width from data.
;
_P0_NUSIZ = _P0_NUSIZ | _Data_MB_Width[_Missile0_Width]
;```````````````````````````````````````````````````````````````
; Puts data into NUSIZ0.
;
NUSIZ0 = _P0_NUSIZ
;***************************************************************
;
; Sets the width of missile1.
;
;```````````````````````````````````````````````````````````````
; Gets the correct missile1 width from data.
;
temp5 = _Data_MB_Width[_Missile1_Width]
;```````````````````````````````````````````````````````````````
; Clears missile1 width, but leaves the sprite stuff alone,
; then sets missile1 width.
;
NUSIZ1 = NUSIZ1 & %11001111 : NUSIZ1 = NUSIZ1 | temp5
_NUSIZ1 = _NUSIZ1 & %11001111 : _NUSIZ1 = _NUSIZ1 | temp5
NUSIZ2 = NUSIZ2 & %11001111 : NUSIZ2 = NUSIZ2 | temp5
NUSIZ3 = NUSIZ3 & %11001111 : NUSIZ3 = NUSIZ3 | temp5
NUSIZ4 = NUSIZ4 & %11001111 : NUSIZ4 = NUSIZ4 | temp5
NUSIZ5 = NUSIZ5 & %11001111 : NUSIZ5 = NUSIZ5 | temp5
;***************************************************************
;
; Sets the width of the ball.
;
;```````````````````````````````````````````````````````````````
; Puts ball width data into CTRLPF.
;
CTRLPF = _Data_MB_Width[_Ball_Width] + 1
;***************************************************************
;
; Object jiggle check.
;
; Activates object jiggle if new object has been selected.
;
;```````````````````````````````````````````````````````````````
; Skip this section if object has not been changed.
;
if !_Bit2_Activate_Jiggle{2} then goto __Skip_Object_Jiggle
;```````````````````````````````````````````````````````````````
; Skips ahead if object is jiggling.
;
if _Jiggle_Counter >= 1 then goto __Skip_Memory
if _Current_Object = _Sprite0 then _Memx = player0x : _Memy = player0y : TextIndex = p0_text
if _Current_Object = _Sprite1 then _Memx = player1x : _Memy = player1y : TextIndex = p1_text
if _Current_Object = _Sprite2 then _Memx = player2x : _Memy = player2y : TextIndex = p2_text
if _Current_Object = _Sprite3 then _Memx = player3x : _Memy = player3y : TextIndex = p3_text
if _Current_Object = _Sprite4 then _Memx = player4x : _Memy = player4y : TextIndex = p4_text
if _Current_Object = _Sprite5 then _Memx = player5x : _Memy = player5y : TextIndex = p5_text
if _Current_Object = _Missile0 then _Memx = missile0x : _Memy = missile0y : TextIndex = m0_text
if _Current_Object = _Missile1 then _Memx = missile1x : _Memy = missile1y : TextIndex = m1_text
if _Current_Object = _Ball then _Memx = ballx : _Memy = bally : TextIndex = ball_text
__Skip_Memory
;```````````````````````````````````````````````````````````````
; Increases the object jiggle counter.
;
_Jiggle_Counter = _Jiggle_Counter + 1
;```````````````````````````````````````````````````````````````
; Applies jiggle to the currently selected object.
;
if _Current_Object = _Sprite0 then temp5 = 255 + (rand&3) : player0x = player0x + temp5: temp5 = 255 + (rand&3) : player0y = player0y + temp5
if _Current_Object = _Sprite1 then temp5 = 255 + (rand&3) : player1x = player1x + temp5: temp5 = 255 + (rand&3) : player1y = player1y + temp5
if _Current_Object = _Sprite2 then temp5 = 255 + (rand&3) : player2x = player2x + temp5: temp5 = 255 + (rand&3) : player2y = player2y + temp5
if _Current_Object = _Sprite3 then temp5 = 255 + (rand&3) : player3x = player3x + temp5: temp5 = 255 + (rand&3) : player3y = player3y + temp5
if _Current_Object = _Sprite4 then temp5 = 255 + (rand&3) : player4x = player4x + temp5: temp5 = 255 + (rand&3) : player4y = player4y + temp5
if _Current_Object = _Sprite5 then temp5 = 255 + (rand&3) : player5x = player5x + temp5: temp5 = 255 + (rand&3) : player5y = player5y + temp5
if _Current_Object = _Missile0 then temp5 = 255 + (rand&3) : missile0x = missile0x + temp5: temp5 = 255 + (rand&3) : missile0y = missile0y + temp5
if _Current_Object = _Missile1 then temp5 = 255 + (rand&3) : missile1x = missile1x + temp5: temp5 = 255 + (rand&3) : missile1y = missile1y + temp5
if _Current_Object = _Ball then temp5 = 255 + (rand&3) : ballx = ballx + temp5: temp5 = 255 + (rand&3) : bally = bally + temp5
;```````````````````````````````````````````````````````````````
; Stops jiggling and restores position of the selected object
; if counter limit has been reached.
;
if _Jiggle_Counter <= 4 then goto __Skip_Object_Jiggle
_Bit2_Activate_Jiggle{2} = 0 : _Jiggle_Counter = 0
if _Current_Object = _Sprite0 then player0x = _Memx : player0y = _Memy
if _Current_Object = _Sprite1 then player1x = _Memx : player1y = _Memy
if _Current_Object = _Sprite2 then player2x = _Memx : player2y = _Memy
if _Current_Object = _Sprite3 then player3x = _Memx : player3y = _Memy
if _Current_Object = _Sprite4 then player4x = _Memx : player4y = _Memy
if _Current_Object = _Sprite5 then player5x = _Memx : player5y = _Memy
if _Current_Object = _Missile0 then missile0x = _Memx : missile0y = _Memy
if _Current_Object = _Missile1 then missile1x = _Memx : missile1y = _Memy
if _Current_Object = _Ball then ballx = _Memx : bally = _Memy
__Skip_Object_Jiggle
;***************************************************************
;
; Puts temp4 in the three score digits on the left side.
;
if _Current_Object = _Sprite0 then scorecolor = $08 : temp4 = player0x
if _Current_Object = _Sprite1 then scorecolor = $1A : temp4 = player1x
if _Current_Object = _Sprite2 then scorecolor = $3A : temp4 = player2x
if _Current_Object = _Sprite3 then scorecolor = $6A : temp4 = player3x
if _Current_Object = _Sprite4 then scorecolor = $8A : temp4 = player4x
if _Current_Object = _Sprite5 then scorecolor = $CA : temp4 = player5x
if _Current_Object = _Missile0 then scorecolor = $5A : temp4 = missile0x
if _Current_Object = _Missile1 then scorecolor = $BA : temp4 = missile1x
if _Current_Object = _Ball then scorecolor = $4A : temp4 = ballx
_sc1 = 0 : _sc2 = _sc2 & 15
if temp4 >= 100 then _sc1 = _sc1 + 16 : temp4 = temp4 - 100
if temp4 >= 100 then _sc1 = _sc1 + 16 : temp4 = temp4 - 100
if temp4 >= 50 then _sc1 = _sc1 + 5 : temp4 = temp4 - 50
if temp4 >= 30 then _sc1 = _sc1 + 3 : temp4 = temp4 - 30
if temp4 >= 20 then _sc1 = _sc1 + 2 : temp4 = temp4 - 20
if temp4 >= 10 then _sc1 = _sc1 + 1 : temp4 = temp4 - 10
_sc2 = (temp4 * 4 * 4) | _sc2
;***************************************************************
;
; Puts temp4 in the three score digits on the right side.
;
if _Current_Object = _Sprite0 then temp4 = player0y
if _Current_Object = _Sprite1 then temp4 = player1y
if _Current_Object = _Sprite2 then temp4 = player2y
if _Current_Object = _Sprite3 then temp4 = player3y
if _Current_Object = _Sprite4 then temp4 = player4y
if _Current_Object = _Sprite5 then temp4 = player5y
if _Current_Object = _Missile0 then temp4 = missile0y
if _Current_Object = _Missile1 then temp4 = missile1y
if _Current_Object = _Ball then temp4 = bally
_sc2 = _sc2 & 240 : _sc3 = 0
if temp4 >= 100 then _sc2 = _sc2 + 1 : temp4 = temp4 - 100
if temp4 >= 100 then _sc2 = _sc2 + 1 : temp4 = temp4 - 100
if temp4 >= 50 then _sc3 = _sc3 + 80 : temp4 = temp4 - 50
if temp4 >= 30 then _sc3 = _sc3 + 48 : temp4 = temp4 - 30
if temp4 >= 20 then _sc3 = _sc3 + 32 : temp4 = temp4 - 20
if temp4 >= 10 then _sc3 = _sc3 + 16 : temp4 = temp4 - 10
_sc3 = _sc3 | temp4
;***************************************************************
;
; Displays the screen.
;
drawscreen
;***************************************************************
;
; Reset switch check and end of main loop.
;
; Any Atari 2600 program should restart when the reset
; switch is pressed. It is part of the usual standards
; and procedures.
;
;```````````````````````````````````````````````````````````````
; Turns off reset restrainer bit and jumps to beginning of
; main loop if the reset switch is not pressed.
;
if !switchreset then _Bit0_Reset_Restrainer{0} = 0 : goto __Main_Loop bank1
;```````````````````````````````````````````````````````````````
; Jumps to beginning of main loop if the reset switch hasn't
; been released after being pressed.
;
if _Bit0_Reset_Restrainer{0} then goto __Main_Loop bank1
;```````````````````````````````````````````````````````````````
; Restarts the program.
;
goto __Start_Restart bank1
;***************************************************************
;
; Sprite size data.
;
data _Data_Sprite_Size
0, 5, 7
end
;***************************************************************
;
; Missile/ball width data.
;
data _Data_MB_Width
$00, $10, $20, $30
end
bank 3
data text_strings
__P, __0, _sp, __O, __B, __J, __E, __C, __T, _sp, _sp, _sp
__P, __1, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp
__P, __2, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp
__P, __3, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp
__P, __4, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp
__P, __5, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp
__M, __0, _sp, __O, __B, __J, __E, __C, __T, _sp, _sp, _sp
__M, __1, _sp, __O, __B, __J, __E, __C, __T, _sp, _sp, _sp
__B, __A, __L, __L, _sp, __O, __B, __J, __E, __C, __T, _sp
end
inline text12b.asm
bank 4
inline text12a.asm