-
Notifications
You must be signed in to change notification settings - Fork 0
/
rotary-bobble.json
729 lines (670 loc) · 22.3 KB
/
rotary-bobble.json
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
[
{
"patchDescription": "Final Rotary Bobble patch. This is basically all the individual patches in the individual directory concatted into one. But the strings were moved to the end. The invidivual patches are also better commented"
},
{
"type": "prom",
"description": "rotary version string",
"string": true,
"value": "Rotary v1.0.2",
"symbol": "VERSION_STR"
},
{
"type": "prom",
"description": "p1: just toggled joystick off string",
"string": true,
"value": "Rotary ",
"symbol": "P1_JOY_OFF_STR"
},
{
"type": "prom",
"description": "p2: just toggled joystick off string",
"string": true,
"value": " Rotary",
"symbol": "P2_JOY_OFF_STR"
},
{
"type": "prom",
"description": "just toggled joystick on string",
"string": true,
"value": "Joystick",
"symbol": "JOY_ON_STR"
},
{
"type": "prom",
"description": "General input to rotary routine",
"symbol": "INPUT_TO_ROTARY_ROUTINE",
"subroutine": true,
"patchAsm": [
";;; uses d0, d1, d2",
";;; input: BIOS_P(X)CURRENT in d0",
";;; output: rotary angle in d1, (-60,60)",
";;;; rotary controls",
"move.b d0, d1 ; copy input into d1",
"move.b d0, d2 ; copy input into d2",
";;;; get rid of D, place BC in the right spot",
"andi.b #$7f, d0 ; turn the D bit off, it is for sign and we are only calc'ing a positive angle right now",
"lsr.b #5, d0 ; shift it down by 5 to get BC all by itself",
"lsl.b #4, d0 ; then shift BC back up into the higher nibble, to make room for RLDU",
"andi.b #$f, d1 ; take the copy of input in d1, and throw away everything but RLDU",
"add.b d0, d1 ; d1 is now CBRLDU, which is the positive angle we want, up to 63",
"cmpi.b #60, D1 ; compare D1 to 60",
"ble.s skipUpperClamp60 ; is it less than 61? no need to apply upper clamp",
"move.b #60, D1 ; it is too big, clamp it down to 60",
"skipUpperClamp60:",
";;;; at this point D1 is (0,60), ie positive angles, and d2 is the original input",
"btst #7, D2 ; see if D was set",
"beq skipNegation; not set, no need to negate",
"muls #-1,d1 ; negation asked for, multiply angle by -1",
"skipNegation:",
"rts"
]
},
{
"type": "prom",
"description": "general string to fix layer routine",
"subroutine": true,
"symbol": "STR_TO_FIX_ROUTINE",
"patchAsm": [
";;; this routine is called with A6 set to a base address with the following data",
";;; [w:fix layer location][l: string pointer][w:countdown]",
"move.w (A6), d7 ; load string's fix layer write location into d7",
"movea.l $2(a6), a5 ; get this string's start address in ROM",
"move.w $6(a6), d6 ; get the countdown value",
"cmpi.w #0, d6",
"beq exit",
"move.w #32, $3c0004 ; set vrammod so that when writing to fix we write horizontally",
"move.w d7, $3c0000 ; set this string's fix layer write location",
"setAChar:",
"clr.w d7",
"move.b (a5), d7 ; grab a byte of the string into d7",
"beq stringDone ; hit the null byte, done",
"adda.l #1, a5 ; increment to next byte",
"cmpi.w #1, d6",
"beq useEmptyTile",
"addi.w #768, d7 ; offset from ascii to fix tile index",
"bra setTile",
"useEmptyTile:",
"move.w #$ff, d7",
"setTile:",
"move.w d7, $3c0002 ; load the tile into the fix layer",
"bra setAChar",
"stringDone:",
"subi.w #1, d6 ; decrement the counter",
"move.w d6, $6(a6) ; stick the counter back in memory",
"exit:",
"rts"
]
},
{
"type": "prom",
"description": "string manager routine",
"address": "f8e",
"subroutine": true,
"patchAsm": [
"jsr $1da6 ; jump to the original routine we just clobbered the call of",
";;;; game needs A6, so we need to save it",
"move.l A6, D7",
"move.l D7, $108dce",
";;;; game needs A5, so we need to save it",
"move.l A5, D7",
"move.l D7, $108dca",
"lea $108dd2, A6 ; load the version string base address",
"jsr $STR_TO_FIX_ROUTINE; jump to the general string routine",
"lea $108dda, A6 ; load the p1 control toggle string",
"jsr $STR_TO_FIX_ROUTINE; jump to the general string routine",
"lea $108eda, A6 ; load the p2 control toggle string",
"jsr $STR_TO_FIX_ROUTINE; jump to the general string routine",
";;;; game needs A6, so restore it",
"move.l $108dce, D7",
"movea.l D7, A6",
";;;; game needs A5, so restore it",
"move.l $108dca, D7",
"movea.l D7, A5",
"rts"
]
},
{
"type": "prom",
"description": "hook in the version string info early at game start",
"address": "69a",
"subroutine": true,
"patchAsm": [
";;; do what was just clobbered for the jts",
"move.b #1, $10fdaf ; set BIOS_USE_MODE to 'Title'",
";;; set up the version string values for the general string routine",
";;; [w:fix layer location][l: string pointer][w:countdown]",
"move.w #$7322, $108dd2 ; set up the version string's fix write location",
"move.l #$VERSION_STR, $108dd4 ; set up the pointer to the version string",
"move.w #300, $108dd8 ; set its countdown",
"rts"
]
},
{
"type": "prom",
"description": "clean up the bytes left behind by the jsr",
"address": "6a0",
"patchAsm": ["nop"]
},
{
"type": "prom",
"description": "Force 2ec94 (the routine just after the giant input routine) to go into our own subroutine, which sets delta (108212 for p2 and 1082ae for p2) based on the rotary input",
"address": "2ec94",
"subroutine": true,
"patchAsm": [
";;;;; recreate what this routine originally did ;;;;;",
"move.b $83(A4), D0",
"andi.w #$10, D0",
"lsr.w #4, D0",
"move.w D0, $12(A4)",
";;;;;; end recreation ;;;;;",
"clr.w d0",
"clr.w d1",
"clr.w d2",
"move.l a4, d0",
"cmpi.l #$108202, d0 ; is a4 pointed at p1's base address?",
"beq loadP1Input ; if so, jump down and load p1's input, else p2's",
"move.b $10fd9C, d0 ; load BIOS_P2CURRENT",
"move.b $108f02, d3 ; load the p2 input toggle value, 0 = rotary, 1 = joystick",
"bra doneLoadingInput",
"loadP1Input:",
"move.b $10fd96, d0 ; load BIOS_P1CURRENT",
"move.b $108e02, d3 ; load the p1 input toggle value, 0 = rotary, 1 = joystick",
"doneLoadingInput:",
"cmpi.b #1, d3 ; are we in joystick mode?",
"beq done ; if so, don't do anything",
"jsr $INPUT_TO_ROTARY_ROUTINE",
";;;; at this point, d1.b is the current rotary angle",
"move.w d1, d2 ; save d1 into d2",
"move.w $60(A4), d0 ; load the previous angle into d0",
"sub.w d0, d1 ; get the delta and stick it into d1",
"move.w d1, $10(A4) ; now finally set the delta into where the game expects it",
";;;;; push input based on delta into our temp address so our fake input routine can inject it",
"cmpi.b #0, d1",
"beq.s setMovementToZero",
"ble.s skipRightMovement",
"move.b #$4, $a26(A4) ; our delta was positive, so tell the dino to move right",
"bra done",
"skipRightMovement:",
"move.b #$8, $a26(A4); our delta was negative, so tell the dino to move left",
"bra done",
"setMovementToZero:",
"move.b #$0, $a26(A4) ; our delta was zero, tell the dino to chill",
"done:",
"rts"
]
},
{
"type": "prom",
"description": "Ensure the 2ec94 routine ignores the garbage we left behind",
"address": "2ec9a",
"patchAsm": ["rts", "nop", "nop", "nop"]
},
{
"type": "prom",
"description": "Have it read the fake p1 input and real p1 input, and OR them together, also handle start holding to toggle controls",
"address": "1016",
"subroutine": true,
"patchAsm": [
";;; this is an unusual subroutine in that it leaves a value in D0 that the main game",
";;; code will use. Normally the Dx registers are free game in any subroutine and the game",
";;; wont make assumptions about them. But we are forcing the game to jump here to do this",
";;; so it's not really a true subroutine",
";;; keep track of holding start for toggling",
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"move.b $10fdac, d0 ; load BIOS_STATCURNT",
"move.w $108e00, d1 ; load current counter",
"btst #0, d0 ; is p1 start down?",
"beq clearToggleCounter ; it's not? reset the counter",
"addi.w #1, d1 ; increment the counter",
"cmpi.w #110, d1 ; did the counter just hit exactly 110?",
"bne saveCounter ; it didn't? not toggling then",
";;; doing the toggle",
"move.b $108e02, d3 ; load the current toggle value",
"move.b #1, d2",
"sub.b d3, d2",
"move.b d2, $108e02 ; put it back in memory",
";;;; set up the notification string",
"move.w #$7058, $108dda ; set the fix layer write location",
"cmpi.b #0, d2 ; see what string we need to load based on the toggle ",
"beq loadJoyOffString",
"move.l #$JOY_ON_STR, $108ddc ; set the string pointer to joy on",
"bra movePastStringPointer",
"loadJoyOffString:",
"move.l #$P1_JOY_OFF_STR, $108ddc ; set the string pointer to p1 joy off",
"movePastStringPointer:",
"move.w #100, $108de0 ; set the countdown to 100",
"bra saveCounter ; purposely dont clear the counter. only clear via let go of start",
"clearToggleCounter:",
"move.w #0, d1 ; clear the counter",
"saveCounter:",
"move.w d1, $108e00",
";;; END: keep track of holding start for toggling",
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"move.b $10fd96, D0 ; load the real changed input at BIOS_P1CURRENT",
"move.b $108e02, d3 ; load the p1 input toggle value, 0 = rotary, 1 = joystick",
"cmpi.b #1, d3 ; check to see if in joystick mode",
"beq done ; if so, don't fake anything",
"andi.b #$10,d0 ; wipe out anything that isnt the A button",
"move.b $108c28, D1 ; load our fake p1 input into D1",
"or.b D1, D0; combine the fake left/right with real A",
"done:",
"rts"
]
},
{
"type": "prom",
"description": "Have it read the fake p2 input and real p2 input, and OR them together, also handle start holding to toggle controls",
"address": "1032",
"subroutine": true,
"patchAsm": [
";;; this is an unusual subroutine in that it leaves a value in D0 that the main game",
";;; code will use. Normally the Dx registers are free game in any subroutine and the game",
";;; wont make assumptions about them. But we are forcing the game to jump here to do this",
";;; so it's not really a true subroutine",
";;; keep track of holding start for toggling",
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"move.b $10fdac, d0 ; load BIOS_STATCURNT",
"move.w $108f00, d1 ; load current counter",
"btst #2, d0 ; is p2 start down?",
"beq clearToggleCounter ; it's not? reset the counter",
"addi.w #1, d1 ; increment the counter",
"cmpi.w #110, d1 ; did the counter just hit 110 exactly?",
"bne saveCounter ; it didn't? not toggling then",
";;; doing the toggle",
"move.b $108f02, d3 ; load the current toggle value",
"move.b #1, d2",
"sub.b d3, d2",
"move.b d2, $108f02 ; put it back in memory",
";;;; set up the notification string",
"move.w #$73d8, $108eda ; set the fix layer write location",
"cmpi.b #0, d2 ; see what string we need to load based on the toggle ",
"beq loadJoyOffString",
"move.l #$JOY_ON_STR, $108edc ; set the string pointer to joy on",
"bra movePastStringPointer",
"loadJoyOffString:",
"move.l #$P2_JOY_OFF_STR, $108edc ; set the string pointer to p2 joy off",
"movePastStringPointer:",
"move.w #100, $108ee0 ; set the countdown to 100",
"bra saveCounter ; purposely dont clear the counter. only clear via let go of start",
"clearToggleCounter:",
"move.w #0, d1 ; clear the counter",
"saveCounter:",
"move.w d1, $108f00",
";;; END: keep track of holding start for toggling",
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"move.b $10fd9c, D0 ; load the real changed input at BIOS_P2CURRENT",
"move.b $108f02, d3 ; load the p2 input toggle value, 0 = rotary, 1 = joystick",
"cmpi.b #1, d3 ; check to see if in joystick mode",
"beq done ; if so, don't fake anything",
"andi.b #$10,d0 ; wipe out anything that isnt the A button",
"move.b $108cc4, D1 ; load our fake p2 input into D1",
"or.b D1, D0; combine the fake left/right with real A",
"done:",
"rts"
]
},
{
"type": "prom",
"description": "Make the timer countdown start at 99 instead of 20, to allow more time",
"address": "208ec",
"patchAsm": ["move.w #5940, $1c(a4)"]
},
{
"type": "prom",
"description": "Have the high score input routine not skip if no input is detected",
"address": "20cea",
"patchAsm": ["jmp $20d40"]
},
{
"type": "prom",
"description": "Have the high score input routine jump to our subroutine which sets pending letter based on rotary",
"address": "20d40",
"subroutine": true,
"patchAsm": [
"clr.l d1",
"move.b $10fdb6, d0; load BIOS_PLAYER_MOD1 to see if p1 is playing",
"beq loadP2current ; zero? then p2 is playing",
"move.b $10fd96, d0 ; load BIOS_P1CURRENT",
"move.b $108e02, d2 ; load the p1 input type toggle. 0 = rotary, 1 = joystick",
"bra doneLoadCurrent",
"loadP2current:",
"move.b $10fd9c, d0 ; load BIOS_P2CURRENT",
"move.b $108f02, d2 ; load the p2 input type toggle. 0 = rotary, 1 = joystick",
"doneLoadCurrent:",
"cmpi.b #0, d2 ; is the player currently using rotary?",
"bne handleJoystick",
";;;; rotary controls",
"jsr $INPUT_TO_ROTARY_ROUTINE",
"addi.b #60, D1 ; map D1 from (-60,60) -> (0,120)",
"cmpi.b #119, D1 ; compare D1 to 119, as 120 is one too big because 120/3 = 40, one above the max",
"ble.s skipUpperClamp119 ; is it less than 120? no need to apply upper clamp",
"move.b #119, D1 ; it is too big, clamp it down to 119",
"skipUpperClamp119:",
"andi.l #$000000ff, d1 ; wipe out D1 above the byte, forcing the byte to become positive",
"divu.w #3, D1",
"move.b D1, $105a89",
"bra done",
"handleJoystick:",
"cmpi.b #0, d0 ; is there no input?",
"beq done ; then just bail",
"subi.b #1, $108fa0 ; decrement the throttle counter",
"bmi updateBasedOnJoystick ; did it go negative? let an input through",
"bra done ; not negative? ignore input to let the throttle work",
"updateBasedOnJoystick:",
"move.b #3, $108fa0 ; rearm the throttle",
"move.b $105a89, d1 ; load the current pending letter",
"btst #2, d0 ; is left pressed?",
"beq handleRight ; if not, jump to right",
"cmpi.b #0, d1 ; is the current pending letter at zero?",
"bne decrement ; if it is not, we can just decement it",
"move.b #39, d1 ; otherwise wrap it around to the max value",
"bra jsdone",
"handleRight:",
"cmpi.b #39, d1; is the current pending letter at the max?",
"bne increment ; if it is not, we can increment it",
"move.b #0, d1 ; otherwise, wrap it around to the min value",
"bra jsdone",
"decrement:",
"subi.b #1, d1",
"bra jsdone",
"increment:",
"addi.b #1, d1",
"jsdone:",
"move.b d1, $105a89",
"done:",
"rts"
]
},
{
"type": "prom",
"description": "Once we return from our subroutine, the original routine needs to skip past its input handling",
"address": "20d46",
"patchAsm": ["jmp $20d6c"]
},
{
"type": "crom",
"description": "how to play - rotary left",
"imgFile": "howToPlayRotaryLeft.png",
"paletteFile": "howToPlayRotaryPalette.png",
"destStartingIndex": "9c00"
},
{
"type": "crom",
"description": "how to play - rotary center",
"imgFile": "howToPlayRotaryCenter.png",
"paletteFile": "howToPlayRotaryPalette.png",
"destStartingIndex": "9c09"
},
{
"type": "crom",
"description": "how to play - rotary right",
"imgFile": "howToPlayRotaryRight.png",
"paletteFile": "howToPlayRotaryPalette.png",
"destStartingIndex": "9c12"
},
{
"type": "prom",
"description": "the left rotary frame tiles written into prom",
"address": "adc4",
"patchAsm": [
"dc.w $9c00",
"dc.w $0000",
"dc.w $9c01",
"dc.w $0000",
"dc.w $9c02",
"dc.w $0000",
"dc.w $9c03",
"dc.w $0000",
"dc.w $9c04",
"dc.w $0000",
"dc.w $9c05",
"dc.w $0000",
"dc.w $9c06",
"dc.w $0000",
"dc.w $9c07",
"dc.w $0000",
"dc.w $9c08",
"dc.w $0000"
]
},
{
"type": "prom",
"description": "the center rotary frame tiles written into prom",
"address": "ad9c",
"patchAsm": [
"dc.w $9c09",
"dc.w $0000",
"dc.w $9c0a",
"dc.w $0000",
"dc.w $9c0b",
"dc.w $0000",
"dc.w $9c0c",
"dc.w $0000",
"dc.w $9c0d",
"dc.w $0000",
"dc.w $9c0e",
"dc.w $0000",
"dc.w $9c0f",
"dc.w $0000",
"dc.w $9c10",
"dc.w $0000",
"dc.w $9c11",
"dc.w $0000"
]
},
{
"type": "prom",
"description": "the right rotary frame tiles written into prom",
"address": "adec",
"patchAsm": [
"dc.w $9c12",
"dc.w $0000",
"dc.w $9c13",
"dc.w $0000",
"dc.w $9c14",
"dc.w $0000",
"dc.w $9c15",
"dc.w $0000",
"dc.w $9c16",
"dc.w $0000",
"dc.w $9c17",
"dc.w $0000",
"dc.w $9c18",
"dc.w $0000",
"dc.w $9c19",
"dc.w $0000",
"dc.w $9c1a",
"dc.w $0000"
]
},
{
"type": "crom",
"description": "how to play - instructions, joystick -> spinner",
"imgFile": "howToPlayInstructions.png",
"paletteFile": "howToPlayInstructionsPalette.png",
"destStartingIndex": "9c1b"
},
{
"type": "prom",
"description": "joystick -> spinner changes to tile indexes in prom, first row",
"address": "a564",
"patchAsm": [
"dc.w $9c1b",
"dc.w $0000",
"dc.w $9c1c",
"dc.w $0000",
"dc.w $9c1d",
"dc.w $0000",
"dc.w $9c1e",
"dc.w $0000",
"dc.w $9c1f",
"dc.w $0000",
"dc.w $9c20"
]
},
{
"type": "prom",
"description": "joystick -> spinner changes to tile indexes in prom, second row",
"address": "a584",
"patchAsm": [
"dc.w $9c21",
"dc.w $0000",
"dc.w $9c22",
"dc.w $0000",
"dc.w $9c23",
"dc.w $0000",
"dc.w $9c24",
"dc.w $0000",
"dc.w $9c25",
"dc.w $0000"
]
},
{
"type": "prom",
"description": "Jump to subroutine to choose difficulty via rotary",
"address": "686e",
"subroutine": true,
"patchAsm": [
"move.l d1, $108fc0 ; save d1 as the game needs it",
"move.l d2, $108fc8 ; save d2 as the game needs it",
"move.b d3, $108fd0 ; save d3 as the game needs it",
"clr.l d1",
"move.b $10fdb6, d0; load BIOS_PLAYER_MOD1 to see if p1 is playing",
"beq loadP2current ; zero? then p2 is playing",
"move.b $10fd96, d0 ; load BIOS_P1CURRENT",
"move.b $108e02, d2 ; load the p1 input type toggle. 0 = rotary, 1 = joystick",
"move.b $10fd97, d3 ; load BIOS_P1CHANGE",
"bra doneLoadCurrent",
"loadP2current:",
"move.b $10fd9c, d0 ; load BIOS_P2CURRENT",
"move.b $108f02, d2 ; load the p2 input type toggle. 0 = rotary, 1 = joystick",
"move.b $10fd9d, d3 ; load BIOS_P2CHANGE",
"doneLoadCurrent:",
"move.b d0, $108fca ; store the input off so we can restore it",
"cmpi.b #0, d2 ; is the player currently using rotary?",
"bne handleJoystick",
";;;; rotary controls",
"jsr $INPUT_TO_ROTARY_ROUTINE",
";;; from here on out is specific stuff for difficulty select",
"addi.b #60, D1 ; map D1 from (-60,60) -> (0,120)",
"cmpi.b #119, D1 ; compare D1 to 119, as 120 is one too big because 120/30 = 4, one above the max",
"ble.s skipUpperClamp119 ; is it less than 120? no need to apply upper clamp",
"move.b #119, D1 ; it is too big, clamp it down to 119",
"skipUpperClamp119:",
"andi.l #$000000ff, d1 ; wipe out D1 above the byte, forcing the byte to become positive",
"divu.w #30, D1 ; divide d1 by 30, accomplishing (0,3) how many difficulty choices there are",
"move.b D1, D5 ; store the pending difficulty that we just determined where the game expects it",
";;; the game will take this value and run with it, enabling rotary controls on high score name input",
"bra done",
";;; joystick code is identical to what the game originally had",
";;; except using BIOS_PXCHANGE in d3",
"handleJoystick:",
"btst #$0, D3 ; is up pressed?",
"bne handleUp ; yes? go set based on up",
"btst #$1, D3 ; is down pressed?",
"bne handleDown ; yes ? go set based on down",
"bra ensure3 ; nothing is pressed? jump out of here",
"handleUp:",
"subq.w #1, D5 ; move difficulty up one (visually)",
"bra ensure3 ; skip down handling",
"handleDown:",
"addq.w #1, D5 ; move difficulty down one (visually)",
"ensure3:",
"andi.w #$3, D5 ; ensure the difficulty is (0-3)",
"done:",
"move.l $108fc0, d1 ; restore d1",
"move.l $108fc8, d2 ; restore d2",
"move.b $108fd0, d3 ; restore d3",
"move.b $108fca, d0 ; restore current input into d0",
"rts"
]
},
{
"type": "prom",
"description": "clear out left behind junk with nops",
"address": "6874",
"patchAsm": ["nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop"]
},
{
"type": "prom",
"description": "num player select using rotary",
"address": "69FE",
"subroutine": true,
"patchAsm": [
"clr.l d1",
"move.b $10fdb6, d0; load BIOS_PLAYER_MOD1 to see if p1 is playing",
"beq loadP2current ; zero? then p2 is playing",
"move.b $10fd96, d0 ; load BIOS_P1CURRENT",
"move.b $108e02, d2 ; load the p1 input type toggle. 0 = rotary, 1 = joystick",
"bra doneLoadCurrent",
"loadP2current:",
"move.b $10fd9c, d0 ; load BIOS_P2CURRENT",
"move.b $108f02, d2 ; load the p2 input type toggle. 0 = rotary, 1 = joystick",
"doneLoadCurrent:",
"cmpi.b #0, d2 ; is the player currently using rotary?",
"bne handleJoystick",
";;;; rotary controls",
"jsr $INPUT_TO_ROTARY_ROUTINE",
"addi.b #60, D1 ; map D1 from (-60,60) -> (0,120)",
"cmpi.b #119, D1 ; compare D1 to 119, as 120 is one too big because 120/60 = 2, one above the max",
"ble.s skipUpperClamp119 ; is it less than 120? no need to apply upper clamp",
"move.b #119, D1 ; it is too big, clamp it down to 119",
"skipUpperClamp119:",
"andi.l #$000000ff, d1 ; wipe out D1 above the byte, forcing the byte to become positive",
"divu.w #60, D1 ; set d1 to (0,1)",
"beq handleUp ; is it zero? jump to handleUp",
"bra handleDown ; else jump to handleDown",
";;; identical to the original code",
"handleJoystick:",
"move.b -$5da4(A5), D0",
"and.b -$5da3(A5), D0",
"btst #$0, D0",
"beq handleUp",
"btst #$1, D0",
"beq handleDown",
"bra done",
"handleUp:",
"move.w #$48, D5",
"move.w #$40, D6",
"move.w #$1, -$5d94(A5)",
"bra done",
"handleDown:",
"move.w #$98, D5",
"move.w #$90, D6",
"move.w #$3, -$5d94(A5)",
"done:",
"rts"
]
},
{
"type": "prom",
"description": "clean out the junk left behind",
"address": "6A04",
"patchAsm": [
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop",
"nop"
]
}
]