-
Notifications
You must be signed in to change notification settings - Fork 2
/
dspprn.src
887 lines (887 loc) · 9.88 KB
/
dspprn.src
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
TITLE 'THE PRINCESS AND THE FROG'
SUBTTL 'BY EDDY FRIES'
SUBTTL 'FOR ROMOX INC.'
ORG $4000
LOC $B000
RBASE = $B000
RCHBASE = RBASE +$A00
DBASE = $1000
DLBASE = $1C00
INTBASE = $1F00
CHRBASE = $1A00
DLST = $230
CHBAS = $2F4
NMEIN = $D40E
NMIST = $D40F
GPRIOR = $26F
STIC0 = $278
FRGC = $8A
FRGFLG = $EE
JUMP = $BF
FACE = $BE
TONE = $BD
COUNT = $BC
SET = $BB
SPEED = $BA
FULL = $B9
FROGS = $B8
SCL = $B7
SCH = $B6
HFAR = $B5
BONUS = $B3
LFEN = $B2
ROUND = $B1
RANDOM = $D20A
HIT = $D004
DINTL = $200
SCRN = DBASE + $C80
SCRLOC = $CC
SAVEX = $CE
DLIC = $B0
LAST = $CF
DIR = $630
YLOC = $C0
BASE = $C1
XLOC = $C2
LBASE = $C7
LYLOC = $C6
LXLOC = $C3
SBASE = $71
SYLOC = $70
SYNC = $3C0
SYNC2 = $3C1
TOPOINT = $F0
FRPOINT = $F2
FROGGIE
JSR MEMOVE
LDA #$00
STA $D201
STA DLST
LDA #DLBASE/256
STA DLST+1
LDA #$D4
STA $2C4
LDA #$1A
STA $2C5
LDA #$08
STA $2C6
LDA #$70
STA $2C8
LDA #CHRBASE/256
STA CHBAS
LDA #$01
STA $61F
STA $61A
DLSET LDA NMIST
AND #$40
BEQ DLSET
LDA NMEIN
ORA #$80
STA NMEIN
LDA #$0
STA DINTL
LDA #INTBASE/256
STA DINTL+1
LDA #$00
STA DLIC
LDA #$C0
STA NMEIN
BEGIN LDY #$0C
FILLOOP LDA DATA1,Y
STA $600,Y
LDA DATA2,Y
STA $60C,Y
LDA DATA3,Y
STA $630,Y
LDA DATA4,Y
STA $63C,Y
LDA #$0
STA L11,Y
STA L11+12,Y
STA $624
DEY
BPL FILLOOP
LDA #$38
STA SPEED
LDA #$E0
STA $EF
LDA #$0
STA SCL
STA SCH
STA SYNC
STA SYNC2
STA $D200
STA ROUND
LDA #$05
STA FROGS
LDA #$97
STA DLBASE + $10
STARTOVER JSR SETUP
LDX #$FF
TXS
LDX #$0
HERECLR LDA DIR,X
BEQ NEXTX
CLC
ADC $617,X
AND #$03
STA $617,X
LDY DIR,X
BPL PLCK
CMP #$03
BNE NEXTX
JMP IND
PLCK CMP #$00
BNE NEXTX
IND STX SAVEX
TXA
ASL A
TAY
LDA TABLE,Y
STA SCRLOC
LDA TABLE+1,Y
STA SCRLOC+1
LDA DIR,X
BMI NEGSCRL
LDY #47
LDA (SCRLOC),Y
STA LAST
SCLOOP DEY
LDA (SCRLOC),Y
INY
STA (SCRLOC),Y
DEY
CPY #$00
BNE SCLOOP
BEQ DONE
NEGSCRL LDY #$0
LDA (SCRLOC),Y
STA LAST
NLOOP INY
LDA (SCRLOC),Y
DEY
STA (SCRLOC),Y
INY
CPY #47
BNE NLOOP
DONE LDA LAST
STA (SCRLOC),Y
LDX SAVEX
NEXTX INX
CPX #12
BNE HERECLR
LDA $EF
CMP #$E0
BNE REAL
JSR FIX
JSR LETTER
JSR TURTLE
JMP TTT
REAL JSR LFINIT
JSR DRAW
JSR TURTLE
JSR SMILEY
JSR SCORE
JSR LADY
TTT LDX #$00
STX $4D
JMP HERECLR
DATA1 DB $00,$94,$94,$94,$94,$E2
DB 0,0,0,0,$70,$70
DATA2 DB $D4,$16,$00,$16,$00,$4A
DB $0C,$0C,$0C,$0C,$78,0
DATA3 DB 0,0,1,254,2,255,0,2,254,1,255,255
DATA4 DB $08,$D4,$F4,$D4,$44,$AA,$14,$94,$34,$F4,$AA,0
TABLE DW L0,L1,L2,L3,L4,L5
DW L6,L7,L8,L9,L10,L11
L0 = SCRN
L1 = L0+$30
L2 = L1+$30
L3 = L2+$30
L4 = L3+$30
L5 = L4+$30
L6 = L5+$30
L7 = L6+$30
L8 = L7+$30
L9 = L8+$30
L10 = L9+$30
L11 = L10+$30
SETUP LDA #62
STA 559
LDA #$E8
STA $2C0
LDA 106
SEC
SBC #$18
STA 54279
CLC
ADC #$04
STA BASE
ADC #$01
STA LBASE
ADC #$01
STA SBASE
LDY #$0
STY YLOC
STY SYLOC
STY LYLOC
TYA
CLEAN STA (YLOC),Y
STA (SYLOC),Y
STA (LYLOC),Y
DEY
BNE CLEAN
LDA #$D4
STA YLOC
STA HFAR
LDA #$80
STA XLOC
STA $D000
LDA #$64
STA LYLOC
LDA #$34
STA SYLOC
LDA #$11
STA GPRIOR
LDA #$03
STA $D01D
LDY #$07
GERP LDA FROG1,Y
STA (YLOC),Y
STA (LYLOC),Y
LDA SMILE,Y
STA (SYLOC),Y
DEY
BPL GERP
LDA $EF
CMP #$E0
BNE PPP
LDA #0
STA $D000
STA $D001
RTS
PPP LDA FROGS
CLC
ADC #$5A
STA L11+8
LDA #$60
STA BONUS
RTS
DRAW LDA JUMP
CMP #$0F
BEQ JOK
LDA STIC0
STA JUMP
JMP FERD
JOK LDA STIC0
CMP #$0F
BNE JOK2
JMP FERD
JOK2 LDY #7
INC JUMP
LDA #0
ELOOP STA (YLOC),Y
DEY
BPL ELOOP
LDA #$FF
STA $D01E
LDA STIC0
AND #$01
BNE ST2
LDA YLOC
SEC
SBC #$10
STA YLOC
LDA #$7
STA FACE
JMP STDONE
ST2 LDA STIC0
AND #$02
BNE ST3
LDA YLOC
CMP #$D4
BEQ ST3
CLC
ADC #$10
STA YLOC
LDA #$17
STA FACE
JMP STDONE
ST3 LDA STIC0
AND #$04
BNE ST4
LDA XLOC
CMP #$34
BCC ST4
SEC
SBC #$08
STA XLOC
LDA #$0F
STA FACE
JMP STDONE
ST4 LDA STIC0
AND #$08
BNE STDONE
LDA XLOC
CMP #$C4
BCS STDONE
CLC
ADC #$08
STA XLOC
LDA #$1F
STA FACE
STDONE LDY #$07
LDX FACE
LDA XLOC
STA $D000
DLOOP LDA FROG1,X
STA (YLOC),Y
DEX
DEY
BPL DLOOP
LDA #$60
STA TONE
LDA HFAR
CMP YLOC
BEQ FERD
BCC FERD
LDA YLOC
STA HFAR
LDA SCL
CLC
ADC #$0A
STA SCL
BCC FERD
INC SCH
FERD LDA #$FF
STA $D01E
JSR DELAY
LDA YLOC
CMP #$44
BCC HUTCH
CMP #$84
BCS BBB
JMP RIVER
BBB CMP #$94
BCC FINISH
CMP #$D4
BCC ROAD
FINISH RTS
ROAD LDA HIT
BEQ FINISH
JMP DEAD
FROG1 DB $41,$5D,$6B,$3E,$3E,$7F,$41,$41
FROG2 DB $E7,$3C,$5C,$7C,$5C,$3C,$E7,$00
FROG3 DB $41,$41,$7F,$3E,$3E,$6B,$5D,$41
FROG4 DB $E7,$3C,$3A,$3E,$3A,$3C,$E7,$00
HUTCH LDA HIT
BEQ FOK
JMP DEAD
FOK LDA XLOC
CLC
ADC #$02
LSR A
LSR A
SEC
SBC #$08
TAX
LDA $D00E
BEQ HCONTF
STX $C4
JSR BWEEP
LDX $C4
LDA #$45
STA L1,X
INX
LDA #$46
STA L1,X
LDA #$00
STA $4D
JMP HCONTG
HCONTF LDA #$51
STA L1,X
INX
LDA #$52
STA L1,X
JSR BEEPER
HCONTG LDA $2C0
CMP #FRGC
BNE NOL
LDA SCL
CLC
ADC #$C8
STA SCL
BCC NOL
INC SCH
NOL LDA SCL
CLC
ADC #$32
ADC BONUS
STA SCL
BCC AAA
INC SCH
AAA LDA $D00E
BEQ III
STA $D002
LDA #$F4
CLC
ADC SCL
STA SCL
LDA #$01
ADC SCH
STA SCH
III DEC FULL
BEQ HFULL
JMP STARTOVER
HFULL INC ROUND
LDY ROUND
RRR LDA SCL
CLC
ADC #$E7
STA SCL
LDA SCH
ADC #$03
STA SCH
DEY
BNE RRR
LDA #$0
STA $D000
JSR TUNE
HFULL2 LDY #$06
LDX #$08
LDA #$0
CLEAR STA L1,X
INX
STA L1,X
INX
INX
INX
INX
INX
DEY
BNE CLEAR
LDA #$06
STA FULL
LDA SPEED
SEC
SBC #$08
CMP #$08
BNE SOK
LDA #$10
SOK STA SPEED
JMP STARTOVER
RIVER LDA HIT
BNE FOK2
JMP DEAD
FOK2 LDA YLOC
SEC
SBC #$24
LSR A
LSR A
LSR A
LSR A
TAX
LDA DIR,X
CLC
ADC XLOC
STA XLOC
STA $D000
JMP FINISH
DEAD LDY #$10
XLOOP TYA
AND #$03
ASL A
ASL A
ASL A
CLC
ADC #$07
TAX
STY SAVEX
LDY #$07
FDLOOP LDA FROG1,X
STA (YLOC),Y
DEX
DEY
BPL FDLOOP
LDA RANDOM
STA TONE
JSR DELAY
LDY SAVEX
DEY
BPL XLOOP
DEC FROGS
BEQ GAMEOVER
JMP STARTOVER
GAMEOVER JMP BEGIN
DELAY LDY SPEED
DELAY1 LDX #$FF
JSR MUSIC
DELAY2 DEX
BNE DELAY2
DEY
BNE DELAY1
RTS
MUSIC LDA TONE
BEQ MDONE
LDA #$AA
STA $D201
DEC TONE
LDA TONE
CLC
ADC #$80
STA $D200
RTS
MDONE LDA #$A0
STA $D201
RTS
TURTLE INC COUNT
LDA COUNT
AND #$07
BNE TDONE
INC SET
LDA SET
AND #$07
STA SET
AND #$01
ASL A
TAX
LDA INDEX,X
STA $C4
INX
LDA INDEX,X
STA $C5
LDY #$0F
TLOOP LDA ($C4),Y
STA DBASE+$A60,Y
DEY
BPL TLOOP
LDA SET
ASL A
TAX
LDA INDEX2,X
STA $C4
INX
LDA INDEX2,X
STA $C5
LDY #$2F
TLOOP2 LDA ($C4),Y
STA DBASE+$B50,Y
DEY
BPL TLOOP2
TDONE RTS
INDEX DW SNDAT1,SNDAT2
INDEX2 DW DBASE+$B20,DBASE+$B20,GDATA,$3C2,$3C2,GDATA,DBASE+$B20,DBASE+$B20
SNDAT1 DB 0,0,$0F,$FF,$F0,$00,0,0
DB 0,0,$00,$F0,$FF,$0F,0,0
SNDAT2 DB 0,0,$00,$F0,$FF,$0F,0,0
DB 0,0,$0F,$FF,$F0,$00,0,0
GDATA DB 0,$00,$00,$00,$3F,$00,$00,0
DB 0,$00,$03,$00,$FF,$00,$03,$00
DB 0,$3C,$F0,$00,$FF,$00,$F0,$3C
DB 0,$03,$0F,$00,$FF,$00,$0F,$03
DB 0,$C0,$0F,$3A,$FF,$3A,$0F,$C0
DB 0,$00,$C0,$FD,$FF,$FD,$C0,$00
SCORE LDA SCL
STA $D4
LDA SCH
STA $D5
JSR $D9AA
LDA $D4
SEC
SBC #$40
BEQ SCW1
SEC
SBC #$1
BEQ SCW2
SCOK LDX #$5
LDA $D5
JSR PRINT
LDA $D6
JSR PRINT
LDA $D7
JSR PRINT
LDA $D5
CMP #$01
BNE SCGG
JSR XTRAFROG
SCGG LDA COUNT
AND #$07
BEQ NSCO
RTS
NSCO SED
LDA BONUS
SEC
SBC #$01
STA BONUS
CLD
BPL CCC
JMP DEAD
CCC LDA BONUS
LDX #39
JSR PRINT
RTS
SCW1 LDA $D5
STA $D6
LDA #00
STA $D5
SCW2 LDA $D6
STA $D7
LDA $D5
STA $D6
LDA #$0
STA $D5
JMP SCOK
PRINT STA SAVEX
LSR A
LSR A
LSR A
LSR A
CLC
ADC #$5A
STA L6,X
INX
LDA SAVEX
AND #$0F
CLC
ADC #$5A
STA L6,X
INX
RTS
LADY LDA LFEN
BNE EEE
RTS
EEE LDA LXLOC
CLC
ADC #$02
STA LXLOC
STA $D001
LDA $D00D
BEQ FFF
JSR LFDEAD
LDA #FRGC
STA $2C0
LDA #$AA
STA $D201
LDY #$FF
RARA STY $D200
LDX #$FF
ARAR DEX
BNE ARAR
DEY
BNE RARA
FFF LDA $D005
BEQ LFDEAD
LDA #FRGC
STA $2C1
LDA RANDOM
AND #$07
BNE HHH
LDA RANDOM
AND #$03
ASL A
ASL A
ASL A
CLC
ADC #$07
TAX
LDY #$07
LFMOVE LDA FROG1,X
STA (LYLOC),Y
DEX
DEY
BPL LFMOVE
HHH RTS
LFDEAD LDA #$0
STA LXLOC
STA $D001
LDA #$00
STA LFEN
RTS
LFINIT LDA LFEN
BNE LFDONE
LDA $2C0
CMP #FRGC
BEQ LFDONE
GGG LDA RANDOM
AND #$7F
BNE LFDONE
LDA #$94
STA $2C1
LDA #$30
STA LXLOC
STA $D001
LDA #$01
STA LFEN
LFDONE RTS
TUNE LDY #$0
LDA #$AA
STA $D201
TUNELOOP LDA SDATA,Y
STA $D200
LDX #$38
DTLOOP LDA #$FF
DT2 SEC
SBC #$01
BNE DT2
DEX
BNE DTLOOP
INY
CPY #22
BNE TUNELOOP
RTS
SDATA DB 64,53,72,60,47,47,53
DB 60,53,53,64,64,81,64,85
DB 72,60,64,72,64,64,81,81
FIX LDA $D01F
AND #$01
BEQ YYY
LDA $D010
BEQ YYY
RTS
YYY LDA #$95
STA DLBASE+$10
LDA #CHRBASE/256
STA $EF
LDA #$0
STA $63B
STA $622
LDA #$01
STA FRGFLG
JMP HFULL2
RTS
LETTER INC SYNC2
LDA SYNC2
AND #$03
STA SYNC2
BNE WWW
LPATCH INC SYNC
LDY SYNC
LDA MESG-1,Y
BEQ XXX
SEC
SBC #$20
STA L11+22
WWW LDX #$30
UUU LDY #$FF
VVV DEY
BNE VVV
DEX
BNE UUU
RTS
XXX LDA #$00
STA SYNC
JMP LPATCH
MESG DB '* THE PRINCESS AND THE FROG * BY EDDY FRIES * COPYRIGHT ROMOX INC *'
DB ' PRESS START TO BEGIN ',0
XTRAFROG LDX FRGFLG
BNE NEWFROG
RTS
NEWFROG INC FROGS
LDA FROGS
CLC
ADC #$5A
STA L11+8
DEC FRGFLG
LDA #$AA
STA $D201
LDY #$0A
BEEP LDA #$30
STA $D200
JSR NFDLY
LDA #$0
STA $D200
JSR NFDLY
DEY
BNE BEEP
RTS
NFDLY LDA #$FC
STA $14
FLLL LDA $14
BNE FLLL
RTS
SMILEY LDA COUNT
AND #$1F
BEQ SMIMOV
RTS
SMIMOV LDA RANDOM
AND #$07
CMP #$06
BMI NEWPOS
RTS
NEWPOS ASL A
STA SAVEX
ASL A
CLC
ADC SAVEX
ADC #$08
TAY
LDA L1,Y
BEQ DRWSMI
LDA #$0
STA $D002
RTS
DRWSMI TYA
SEC
SBC #$08
ASL A
ASL A
CLC
ADC #$40
STA $D002
LDA #$36
STA $2C2
RTS
SMILE DB 0,$00,$66,$FE,$C3,$7E,$3C,$00
BEEPER LDA #$AA
STA $D201
LDY #$1
OOO LDA #$50
STA $D200
JSR NFDLY
LDA #$0
STA $D200
JSR NFDLY
DEY
BPL OOO
RTS
MEMOVE LDA #00
STA FRPOINT
LDA #RCHBASE/256-2
STA FRPOINT +1
LDA #$00
STA TOPOINT
LDA #CHRBASE/256-2
STA TOPOINT +1
LDX #$08
LDY #$0
MEMLOOP LDA (FRPOINT),Y
STA (TOPOINT),Y
DEY
BNE MEMLOOP
INC FRPOINT +1
INC TOPOINT +1
DEX
BNE MEMLOOP
RTS
BWEEP LDA #$A8
STA $D201
LDA #$80
LDY #$07
BWEEP2 CLC
ADC #$01
STA $D200
TAX
LDA #$FF
STA $14
BWEEPD LDA $14
BNE BWEEPD
TXA
DEY
BPL BWEEP2
LDY #$07
SEC
SBC #$0D
BPL BWEEP2
LDA #$0
STA $D201
RTS