-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_utils.asm
More file actions
901 lines (755 loc) · 18 KB
/
_utils.asm
File metadata and controls
901 lines (755 loc) · 18 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
////////////////////////////////////////////////////////////////////////////////
//
// Project : ForestSaver - https://github.com/intoinside/ForestSaver
// Target : Commodore 64
// Author : Raffaele Intorcia - raffaele.intorcia@gmail.com
//
// Some useful routine.
//
////////////////////////////////////////////////////////////////////////////////
#importonce
SpriteNumberMask:
.byte %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000
// Switch char at CharPosition from CharFrame1 to CharFrame2 and back
.macro AnimateLake(CharPosition, CharFrame1, CharFrame2) {
lda CharPosition
cmp #CharFrame1
beq !+
ldx #CharFrame1
jmp Set
!:
ldx #CharFrame2
Set:
stx CharPosition
}
* = * "Utils RemoveTree"
RemoveTree: {
jsr Sfx.TreeFall
// Row #1
lda StartAddress
sta SelfMod1 + 1
lda StartAddress + 1
sta SelfMod1 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod2 + 1
lda StartAddress + 1
sta SelfMod2 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod3 + 1
lda StartAddress + 1
sta SelfMod3 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod4 + 1
lda StartAddress + 1
sta SelfMod4 + 2
// Row #2
c64lib_add16($0025, StartAddress)
lda StartAddress
sta SelfMod5 + 1
lda StartAddress + 1
sta SelfMod5 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod6 + 1
lda StartAddress + 1
sta SelfMod6 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod7 + 1
lda StartAddress + 1
sta SelfMod7 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod8 + 1
lda StartAddress + 1
sta SelfMod8 + 2
// Row #3
c64lib_add16($0025, StartAddress)
lda StartAddress
sta SelfMod9 + 1
lda StartAddress + 1
sta SelfMod9 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod10 + 1
lda StartAddress + 1
sta SelfMod10 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod11 + 1
lda StartAddress + 1
sta SelfMod11 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod12 + 1
lda StartAddress + 1
sta SelfMod12 + 2
// Row #4
c64lib_add16($0025, StartAddress)
lda StartAddress
sta SelfMod13 + 1
lda StartAddress + 1
sta SelfMod13 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod14 + 1
lda StartAddress + 1
sta SelfMod14 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod15 + 1
lda StartAddress + 1
sta SelfMod15 + 2
c64lib_inc16(StartAddress)
lda StartAddress
sta SelfMod16 + 1
lda StartAddress + 1
sta SelfMod16 + 2
ldx #$00
SelfMod1:
stx $beef
SelfMod2:
stx $beef
SelfMod3:
stx $beef
SelfMod4:
stx $beef
SelfMod5:
stx $beef
SelfMod6:
stx $beef
SelfMod7:
stx $beef
SelfMod8:
stx $beef
SelfMod9:
stx $beef
SelfMod12:
stx $beef
ldx #$3a
SelfMod10:
stx $beef
inx
SelfMod11:
stx $beef
inx
SelfMod13:
stx $beef
inx
SelfMod14:
stx $beef
inx
SelfMod15:
stx $beef
inx
SelfMod16:
stx $beef
jmp SetColorToChars
StartAddress: .word $beef
}
// Fill screen with $00 char (preserve sprite pointer memory area)
.macro ClearScreen(screenram) {
lda #$00
ldx #250
!:
dex
sta screenram, x
sta screenram + 250, x
sta screenram + 500, x
sta screenram + 750, x
bne !-
}
.macro CopyScreenRam(StartAddress, EndAddress) {
ldx #250
!:
dex
lda StartAddress, x
sta EndAddress, x
lda StartAddress + 250, x
sta EndAddress + 250, x
lda StartAddress + 500, x
sta EndAddress + 500, x
lda StartAddress + 750, x
sta EndAddress + 750, x
cpx #$0
bne !-
}
.macro ShowDialogNextLevel(ScreenMemoryBaseAddress) {
lda #<ScreenMemoryBaseAddress
sta ShowDialog.StartAddress
lda #>ScreenMemoryBaseAddress
sta ShowDialog.StartAddress + 1
lda #<DialogNextLevel
sta ShowDialog.DialogAddress
lda #>DialogNextLevel
sta ShowDialog.DialogAddress + 1
jsr ShowDialog
}
.macro ShowDialogGameOver(ScreenMemoryBaseAddress) {
lda #<ScreenMemoryBaseAddress
sta ShowDialog.StartAddress
lda #>ScreenMemoryBaseAddress
sta ShowDialog.StartAddress + 1
lda #<DialogGameOver
sta ShowDialog.DialogAddress
lda #>DialogGameOver
sta ShowDialog.DialogAddress + 1
jsr ShowDialog
}
ShowDialog: {
lda StartAddress + 1
sta StartAddressHi
c64lib_add16(c64lib_getTextOffset(DialogStartX, DialogStartY), StartAddress)
ldy #DialogHeight
!Row:
dey
lda DialogAddress
sta DialogAddressPtr + 1
lda DialogAddress + 1
sta DialogAddressPtr + 2
lda StartAddress
sta StartAddressPtr + 1
lda StartAddress + 1
sta StartAddressPtr + 2
ldx #DialogWidth
!:
dex
DialogAddressPtr:
lda DialogAddress, x
StartAddressPtr:
sta StartAddress, x
cpx #0
bne !-
c64lib_add16(40, StartAddress)
c64lib_add16(DialogWidth, DialogAddress)
cpy #0
bne !Row-
lda StartAddressHi
sta SetColorToChars.ScreenMemoryAddress
jsr SetColorToChars
inc IsShown
rts
.label DialogStartX = 10;
.label DialogStartY = 6;
.label DialogWidth = 20;
.label DialogHeight = 7;
IsShown: .byte $00
StartAddress: .word $beef
DialogAddress: .word $beef
StartAddressHi: .byte $be
}
.macro SetupColorMap(screenRamHiAddress) {
lda #screenRamHiAddress
sta SetColorToChars.ScreenMemoryAddress
jsr SetColorToChars
}
DisableAllSprites: {
lda #$00
sta c64lib.SPRITE_ENABLE
rts
}
SetSpriteToBackground: {
lda #$ff
sta c64lib.SPRITE_PRIORITY
rts
}
SetSpriteToForeground: {
lda #$00
sta c64lib.SPRITE_PRIORITY
rts
}
.macro SetSpriteToSamePosition(sprite1X, sprite2X) {
lda sprite1X
sta sprite2X
lda sprite1X + 1
sta sprite2X + 1
}
.assert "SetSpriteToSamePosition($2000, $2100) ", { SetSpriteToSamePosition($2000, $2100) }, {
lda $2000; sta $2100; lda $2001; sta $2101
}
.macro SetXBitToSameValue(bitSource, bitDest) {
.const mask = List().add(
%00000001,
%00000010,
%00000100,
%00001000,
%00010000,
%00100000,
%01000000,
%10000000).lock();
lda c64lib.SPRITE_MSB_X // 3by + 4
and #~(mask.get(bitDest)) // 2by + 2
sta c64lib.SPRITE_MSB_X // 3by + 4
and #mask.get(bitSource) // 2by + 2
lsr // 1by + 2
ora c64lib.SPRITE_MSB_X // 3by + 4
sta c64lib.SPRITE_MSB_X // 3by + 4
//17by + 22cy
}
.assert "SetXBitToSameValue(2, 3) ", { SetXBitToSameValue(2, 3) }, {
lda $d010; and #%11110111; sta $d010;
and #%00000100; lsr; ora $d010; sta $d010
}
.macro EnableSprite(bSprite, bEnable) {
ldy #bSprite
lda SpriteNumberMask, y
.if (bEnable) // Build-time condition (not run-time)
{
ora c64lib.SPRITE_ENABLE // Merge with the current sprite enable register
}
else
{
eor #$ff // Get mask compliment
and c64lib.SPRITE_ENABLE // Merge with the current sprite enable register
}
sta c64lib.SPRITE_ENABLE // Set the new value into the sprite enable register
}
.assert "EnableSprite($00, true) ", { EnableSprite($be, true) }, {
ldy #$be; lda SpriteNumberMask, y; ora $d015; sta $d015
}
.assert "EnableSprite($00, false) ", { EnableSprite($be, false) }, {
ldy #$be; lda SpriteNumberMask, y; eor #$ff; and $d015; sta $d015
}
.macro EnableMultiSprite(SpriteMask, bEnable) {
lda #SpriteMask
.if (bEnable) // Build-time condition (not run-time)
{
ora c64lib.SPRITE_ENABLE // Merge with the current sprite enable register
}
else
{
eor #$ff // Get mask compliment
and c64lib.SPRITE_ENABLE // Merge with the current sprite enable register
}
sta c64lib.SPRITE_ENABLE // Set the new value into the sprite enable register
}
.assert "EnableMultiSprite($be, true) ", { EnableMultiSprite($be, true) }, {
lda #$be; ora $d015; sta $d015
}
.assert "EnableMultiSprite($00, false) ", { EnableMultiSprite($be, false) }, {
lda #$be; eor #$ff; and $d015; sta $d015
}
.macro bmi16(arg1, arg2) {
lda arg1 + 1
cmp arg2 + 1
bmi end // branch to end if value is smaller than low
lda arg1
cmp arg2
end:
}
.assert "bmi16($0102, $0a0b) ", { bmi16($0102, $0a0b) }, {
lda $0103; cmp $0a0c; bmi end; lda $0102; cmp $0a0b; end:
}
* = * "Utils SetLakeToBlack"
SetLakeToBlack: {
lda StartAddress
sta Loop1 + 1
lda StartAddress + 1
sta Loop1 + 2
ldx #$00
lda #$a5
Loop1:
sta StartAddress, x
clc
adc #$01
inx
cpx #$04
bne Loop1
c64lib_add16($0028, StartAddress)
lda StartAddress
sta Loop2 + 1
lda StartAddress + 1
sta Loop2 + 2
ldx #$00
lda #$a9
Loop2:
sta StartAddress, x
clc
adc #$01
inx
cpx #$04
bne Loop2
rts
StartAddress: .word $beef
}
* = * "Utils SpriteCollision"
SpriteCollision: {
c64lib_add16($000c, OtherX)
lda OtherY
clc
adc #10
sta OtherY
lda c64lib.SPRITE_MSB_X
and #%00000001
sta RangerX1 + 1
sta RangerX2 + 1
lda c64lib.SPRITE_0_X
sta RangerX1
sta RangerX2
add16value($0018, RangerX2)
lda c64lib.SPRITE_0_Y
sta RangerY1
clc
adc #21
sta RangerY2
// Collision happened if OtherSprite coordinates is inside Ranger
// square. This means that
// * RangerX1 < OtherX < RangerX2
// * RangerY1 < OtherY < RangerY2
// REMIND: BMI means jump if first value is lower than second value
// Is like if OtherX < RangerX1 then jump (no collision)
bmi16(OtherX, RangerX1) // OtherSpriteX - Ranger Left
bmi NoCollisionDetected
// Is like if RangerX2 < OtherX then jump (no collision)
bmi16(RangerX2, OtherX) // Ranger Right - OtherSpriteX
bmi NoCollisionDetected
// Is like if OtherY < RangerY1 then jump (no collision)
lda OtherY
cmp RangerY1
bmi NoCollisionDetected // branch to end if value is smaller than low
// Is like if RangerY2 < OtherY then jump (no collision)
lda RangerY2
cmp OtherY
bmi NoCollisionDetected // branch to end if value is smaller than low
CollisionDetected:
lda #$01
jmp Done
NoCollisionDetected:
lda #$00
Done:
rts
// Ranger square
RangerX1: .word $0000
RangerX2: .word $0000
RangerY1: .byte $00
RangerY2: .byte $00
// Other sprite initial coordinate
OtherX: .word $0000
OtherY: .byte $00
}
* = * "Utils BackgroundCollision"
BackgroundCollision: {
lda c64lib.SPRITE_2B_COLLISION
and #%00000001
sta Collision
rts
Collision: .byte $00
}
.macro add16byte(value, dest) {
clc
lda dest
adc value
sta dest
bcc !+
inc dest + 1
!:
}
.assert "add16byte($cc, $0123) ", { add16byte($cc, $0123) }, {
clc; lda $0123; adc $cc; sta $0123; bcc !+; inc $0124; !:
}
.macro add16value(value, dest) {
clc
lda dest
adc #<value
sta dest
lda dest + 1
adc #>value
sta dest + 1
}
.assert "add16value($0102, $0123) ", { add16value($0102, $0123) }, {
clc; lda $0123; adc #<$0102; sta $0123 ; lda $0124 ; adc #>$0102 ; sta $0124
}
.macro sub16byte(value, dest) {
sec
lda dest
sbc value
sta dest
lda dest + 1
sbc #$00
sta dest + 1
}
.assert "sub16byte($cc, $0123) ", { sub16byte($cc, $0123) }, {
sec; lda $0123; sbc $cc; sta $0123; lda $0124; sbc #$00; sta $0124
}
.macro ShowComplain(address, x, y) {
lda #<address
sta ShowComplainRoutine.Dummy
lda #>address
sta ShowComplainRoutine.Dummy + 1
c64lib_add16((y * 40) + x, ShowComplainRoutine.Dummy)
jsr ShowComplainRoutine
}
* = * "Utils ShowComplain"
ShowComplainRoutine: {
lda Dummy
sta HandleEnemyFined.MapComplain
lda Dummy + 1
sta HandleEnemyFined.MapComplain + 1
lda #0
sta HandleEnemyFined.AddOrSub
jmp HandleEnemyFined // jsr + rts
Dummy: .word $beef
}
* = * "Utils HandleEnemyFined"
HandleEnemyFined: {
// Char self mod
lda ComplainChars
sta EditMap1 + 1
lda ComplainChars + 1
sta EditMap2 + 1
lda ComplainChars + 2
sta EditMap3 + 1
lda ComplainChars + 3
sta EditMap4 + 1
lda ComplainChars + 4
sta EditMap5 + 1
lda ComplainChars + 5
sta EditMap6 + 1
lda AddOrSub
beq MapSelfModAreaRow1
cmp #$ff
beq !Add+
!Sub:
sub16byte(Offset, MapComplain)
jmp MapSelfModAreaRow1
!Add:
add16byte(Offset, MapComplain)
MapSelfModAreaRow1:
lda MapComplain
sta EditMap1 + 3
lda MapComplain + 1
sta EditMap1 + 4
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap2 + 3
lda MapComplain + 1
sta EditMap2 + 4
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap3 + 3
lda MapComplain + 1
sta EditMap3 + 4
MapSelfModAreaRow2:
add16value($0026, MapComplain)
lda MapComplain
sta EditMap4 + 3
lda MapComplain + 1
sta EditMap4 + 4
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap5 + 3
lda MapComplain + 1
sta EditMap5 + 4
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap6 + 3
lda MapComplain + 1
sta EditMap6 + 4
EditMap1:
lda #$00
sta $beef
EditMap2:
lda #$00
sta $beef
EditMap3:
lda #$00
sta $beef
EditMap4:
lda #$00
sta $beef
EditMap5:
lda #$00
sta $beef
EditMap6:
lda #$00
sta $beef
rts
ComplainChars: .byte $9e, $9f, $a0, $a1, $a2, $a3
AddOrSub: .byte $00 // $ff means add, $01 means sub, otherwise no offset
Offset: .byte $00 // Offset to add or sub from the position
MapComplain: .word $4569
}
.macro HideComplain(address, x, y) {
lda #<address
sta HideComplainRoutine.Dummy
lda #>address
sta HideComplainRoutine.Dummy + 1
c64lib_add16((y * 40) + x, HideComplainRoutine.Dummy)
jsr HideComplainRoutine
}
* = * "Utils HideComplainRoutine"
HideComplainRoutine: {
lda Dummy
sta HandleEnemyFinedOut.MapComplain
lda Dummy + 1
sta HandleEnemyFinedOut.MapComplain + 1
lda #$00
sta HandleEnemyFinedOut.AddOrSub
jmp HandleEnemyFinedOut // jsr + rts
Dummy: .word $beef
}
* = * "Utils HandleEnemyFinedOut"
HandleEnemyFinedOut: {
lda AddOrSub
beq MapSelfModAreaRow1
cmp #$ff
beq !Add+
!Sub:
sub16byte(Offset, MapComplain)
jmp MapSelfModAreaRow1
!Add:
add16byte(Offset, MapComplain)
MapSelfModAreaRow1:
lda MapComplain
sta EditMap1 + 1
lda MapComplain + 1
sta EditMap1 + 2
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap2 + 1
lda MapComplain + 1
sta EditMap2 + 2
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap3 + 1
lda MapComplain + 1
sta EditMap3 + 2
MapSelfModAreaRow2:
add16value($0026, MapComplain)
lda MapComplain
sta EditMap4 + 1
lda MapComplain + 1
sta EditMap4 + 2
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap5 + 1
lda MapComplain + 1
sta EditMap5 + 2
c64lib_inc16(MapComplain);
lda MapComplain
sta EditMap6 + 1
lda MapComplain + 1
sta EditMap6 + 2
EditCharMap1:
lda FixComplainChars
EditMap1:
sta $beef
EditMap2:
sta $beef
EditMap3:
sta $beef
EditMap4:
sta $beef
EditMap5:
sta $beef
EditMap6:
sta $beef
rts
FixComplainChars: .byte $00
AddOrSub: .byte $00 // $ff means add, $01 means sub, otherwise no offset
Offset: .byte $00 // Offset to add or sub from the position
MapComplain: .word $4569 //, $456a, $456b, $4591, $4592, $4593
}
* = * "Utils SetColorToChars"
SetColorToChars: {
lda ScreenMemoryAddress
sta Dummy1 + 2
lda #$d8
sta ColorMap + 2
lda #$00
sta StartLoop + 1
lda #$04
sta CleanLoop
StartLoop:
ldx #$00
PaintCols:
Dummy1:
ldy DummyScreenRam, x
lda CharColors, y
ColorMap:
sta $d800, x
dex
bne PaintCols
inc Dummy1 + 2
inc ColorMap + 2
dec CleanLoop
lda CleanLoop
cmp #$01
beq SetLastRun
cmp #$00
beq Done
jmp StartLoop
SetLastRun:
lda #$e7
sta StartLoop + 1
jmp StartLoop
Done:
rts
ScreenMemoryAddress: .byte $be
.label DummyScreenRam = $be00
CleanLoop: .byte $03
}
// Generates a random number up to maxNumber (excluded)
.macro GetRandomUpTo(maxNumber) {
lda #maxNumber
sta GetRandom.GeneratorMax
jsr GetRandom
}
GetRandom: {
Loop:
lda $d012
eor $dc04
sbc $dc05
cmp GeneratorMax
bcs Loop
rts
GeneratorMax: .byte $00
}
WaitRoutine: {
VBLANKWAITLOW:
lda $d011
bpl VBLANKWAITLOW
VBLANKWAITHIGH:
lda $d011
bmi VBLANKWAITHIGH
rts
}
.macro DrawAccumulator(position) {
pha
and #$0f
cmp #$0a
bpl !bigger+
clc
adc #$2a
jmp !write+
!bigger:
sec
sbc #$08
!write:
sta position + 1
pla
and #$f0
clc
ror
ror
ror
ror
cmp #$0a
bpl !bigger+
clc
adc #$2a
jmp !write+
!bigger:
sec
sbc #$08
!write:
sta position
}
#import "common/lib/math-global.asm"
#import "chipset/lib/vic2.asm"
#import "chipset/lib/vic2-global.asm"
#import "_allimport.asm"
#import "_sounds.asm"