-
Notifications
You must be signed in to change notification settings - Fork 13
/
VSNDRM4.SRC
executable file
·2586 lines (2353 loc) · 40.1 KB
/
VSNDRM4.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
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
NAM JOUST SOUND ROM STARTED 06/15/1982
SUBTTL
*COPYRIGHT WILLIAMS ELECTRONICS INC. 1982
*PROGRAMMERS: EUGENE P. JARVIS, SAM DICKER,RANDY PFEIFFER,JOHN KOTLARIK
* PAUL G. DUSSAULT,CARY W. KOLKER,TIM MURPHY
* AND A CAST OF THOUSANDS......
*
*
*SYSTEM CONSTANTS
*
ROM EQU $F000
SOUND SET $400
CKORG EQU $EF00 CHECKSUM PROG ORG
ENDRAM SET $7F
VECTOR EQU $FFF8 RESET,INT VECTORS
WVELEN EQU 72
*
* SCREAM EQUATES
*
ECHOS EQU 4
FREQ EQU 0
TIMER EQU 1
*
*GLOBALS
*
ORG 0
HI RMB 1 RANDOM SEED
LO RMB 1 RANDOM SEED
XDECAY RMB 2
AMP0 RMB 1
*
*
*TEMPORARIES
*
TMPRAM EQU * TEMPORARY RAM
TEMPX RMB 2 X TEMPS
XPLAY RMB 2
XPTR RMB 2
TEMPA RMB 1 ACCA TEMP
TEMPB RMB 1
LOCRAM EQU *
*
*GWAVE PARAMETERS
*
ORG LOCRAM
GECHO RMB 1 ECHO FLAG
GCCNT RMB 1 CYCLE COUNT
GECDEC RMB 1 # OF DECAYS PER ECHO
GDFINC RMB 1 DELTA FREQ INC
GDCNT RMB 1 DELTA FREQ COUNT
GWFRM RMB 2 WAVEFORM ADDRESS
*TEMPORARY OR COMPUTED PARAMETERS
PRDECA RMB 1 PRE-DECAY FACTOR
GWFRQ RMB 2 FREQ TABLE ADDR
FRQEND RMB 2 END ADDR FREQ TABLE
WVEND RMB 2 WAVE END ADDR
GPER RMB 1 PERIOD
GECNT RMB 1 # OF ECHOES COUNTER
FOFSET RMB 1 FREQUENCY OFFSET
*
*GWAVE TABLES
*
GWTAB RMB WVELEN WAVE TABLE
*
*VARIWAVE PARAMETERS
*
ORG LOCRAM
LOPER RMB 1 LO PERIOD
HIPER RMB 1 HIPERIOD
LODT RMB 1 PERIOD DELTAS
HIDT RMB 1
HIEN RMB 1 END PERIOD
SWPDT RMB 2 SWEEP PERIOD
LOMOD RMB 1 BASE FREQ MOD
VAMP RMB 1 AMPLITUDE
LOCNT RMB 1 PERIOD COUNTERS
HICNT RMB 1
* BOMB RAM
ORG LOCRAM
TIME RMB 1
TABLE RMB 2
FREQZ RMB 1
*
* KNOCKER RAM
*
ORG LOCRAM
PERIOD RMB 1
AMP RMB 1
SNDTMP RMB 2 INDEX TMEP
*
* FLASH LOCAL RAM
ORG LOCRAM
FREQ1 RMB 1 FREQUENCY CONSTANT 1
FREQ2 RMB 1 FREQUENCY CONSTANT 2
FREQ3 RMB 1 FREQUENCY CONSTANT 3
FREQ4 RMB 1 FREQUENCY CONSTANT 4
DELTA1 RMB 1 DELTA AMPLITUDE 1
DELTA2 RMB 1 DELTA AMPLITUDE 2
DELTA3 RMB 1 DELTA AMPLITUDE 3
DELTA4 RMB 1 DELTA AMPLITUDE 4
FREQ1$ RMB 1 FREQUENCY COUNTER 1
FREQ2$ RMB 1 FREQUENCY COUNTER 2
FREQ3$ RMB 1 FREQUENCY COUNTER 3
FREQ4$ RMB 1 FREQUENCY COUNTER 4
CYCLE1 RMB 1 CYCLE CONSTANT 1
CYCLE2 RMB 1 CYCLE CONSTANT 2
CYCLE3 RMB 1 CYCLE CONSTANT 3
CYCLE4 RMB 1 CYCLE CONSTANT 4
DFREQ1 RMB 1 DELTA FREQUENCY 1
DFREQ2 RMB 1 DELTA FREQUENCY 2
DFREQ3 RMB 1 DELTA FREQUENCY 3
DFREQ4 RMB 1 DELTA FREQUENCY 4
EFREQ1 RMB 1 END FREQUENCY 1
EFREQ2 RMB 1 END FREQUENCY 2
EFREQ3 RMB 1 END FREQUENCY 3
EFREQ4 RMB 1 END FREQUENCY 4
CYCL1$ RMB 1 CYCLE COUNTER 1
CYCL2$ RMB 1 CYCLE COUNTER 2
CYCL3$ RMB 1 CYCLE COUNTER 3
CYCL4$ RMB 1 CYCLE COUNTER 4
SNDX1 RMB 1
RANDOM EQU LO SINGLE BYTE RANDOM
ORG LOCRAM+1
FREQ$ RMB 1 START FREQUENCY
C$FRQ RMB 1 CYCLES AT FREQUENCY
D$FRQ RMB 1 DELTA FREQUENCY
E$FRQ RMB 1 END FREQUENCY
C$AMP RMB 1 CYCLES AT AMPLITUDE
D$AMP RMB 1 DELTA AMPLITUDE
C$AMP$ RMB 1 CYCLE COUNTER
C$FRQ$ RMB 1 CYCLE COUNTER
*
*
*FILTERED NOISE ROUTINE PARAMETERS
*
ORG LOCRAM
FMAX RMB 1 MAXIMUM_FREQUENCY
FHI RMB 1 FREQUENCY
FLO RMB 1
LOFRQ RMB 1
SAMPC RMB 2 SAMPLE COUNT
FDFLG RMB 1 FREQUENCY DECREMENT FLAG
DSFLG RMB 1 DISTORTION FLAG
*
*
*
*NOISE/CROWD ROAR ROUTINE PARAMETERS
*
ORG LOCRAM
DECAY RMB 1
NAMP RMB 1
CYCNT RMB 1
NFRQ1 RMB 2
NFFLG RMB 1
LFREQ RMB 1
DFREQ RMB 1
GALPAM EQU *
CYCNT2 RMB 1
NAMP2 RMB 1
DECAY2 RMB 1
NFFLG2 RMB 1
NFR2 RMB 1
GALCNT RMB 1
WHIS RMB 1 CROWD ROAR AMP
WFRQ RMB 1 CROWD WHISTLE FREQ
WCNT RMB 1 WHISTLE PASSCOUNTER
PTRHI RMB 2 WHIS ADR PTR
WFRQ2 RMB 1
WCNT2 RMB 1
CURVAL RMB 1 WHISTLING NOISE OUTPUT
ATP RMB 1 INTERM NOISE VAL
MINWIS RMB 1 MIN WHISTLE FREQ
CY2 RMB 1 NOISE CYCLE COUNTER
DFRQ RMB 1 WHISTLE FREQ CHANGE
DFRQ2 RMB 1 INIT WHISTLE FREQ CHANGE
NNOIS RMB 1 NEXT NOISE VALUE
NFRQ RMB 1 NOISE FREQ
NFRQ2 RMB 1 INIT NOISE FREQ
RCNT2 RMB 1
* CHECKSUM CALCULATOR & RELOCATOR
*
ORG CKORG
CKSUM LDX #$FFFF INDEX TO END OF ROM
CLRB ZERO CHECKSUM
CKSUM1 ADCB 0,X ADD IN PROGRAM BYTE
DEX TO NEXT BYTE
CPX #$F000 DONE YET?
BNE CKSUM1 NOPE...
STAB 0,X SAVE CHECKSUM AT BEGINNING
WAI TURN OFF LEDS
FROM RMB 2
RMB 2 FOR POINTER
*
* MAIN PROGRAM
*
ORG ROM
FCB $74 CHECKSUM BYTE
*
*
SETUP SEI SET INTERRUPT MASK
LDS #ENDRAM INITIALIZE STACK POINTER
LDX #SOUND INDEX TO PIA
CLR 1,X ACCESS DDRA
CLR 3,X ACCESS DDRB
LDAA #$FF PA0-PA7
STAA 0,X SET SIDE A AS OUTPUTS
CLR 2,X SET B SIDE AS INPUTS
LDAA #$37 CB2 LOW, IRQ ALLOWED
STAA 3,X PROGRAM B CONTROL REG
LDAA #$3C CA2 SET INIT HIGH, NO IRQS
STAA 1,X PROGRAM A SIDE
STAA HI START RANDOM GENERATOR
CLI CLEAR INTERRUPTS
BRA * WAIT FOR INTERRUPT
*
*
* THREE OSCILLATOR SOUND GENERATOR
*
PLAY STX XPLAY SAVE CURRENT INDEX
LDX #DECAYZ SET TO MAXIMUM AMPLITUDE
STX XDECAY AND SAVE
LDAA #$80 LOAD ZERO AMPLITUDE
PLAY1 LDAB FREQ4 CHECK WHITE NOISE COUNTER
BPL PLAY3 NOT IN WHITE MODE
LDAB RANDOM GET RANDOM NUMBER
LSRB REDUCE IT
LSRB
LSRB
INCB NOW NON-ZERO
PLAY2 DECB TIME OUT COUNT
BNE PLAY2
PLAY3 DEC FREQ1$ COUNT DOWN OSC. 1
BEQ PLAY7 DO AN UPDATE
DEC FREQ2$ COUNT DOWN OSC. 2
BEQ PLAY8 DO AN UPDATE
DEC FREQ3$ COUNT DOWN OSC. 3
BEQ PLAY9 DO AN UPDATE
DEC FREQ4$ COUNT DOWN WHITE NOISE
BNE PLAY1 DO THEM AGAIN
LDAB FREQ4 CHECK WHITE NOISE CONSTANT
BEQ PLAY1 FORGET IT
ANDB #$7F STRIP FLAG BIT
STAB FREQ4$ SAVE WHITE NOISE COUNT
LDAB RANDOM GET CURRENT RANDOM
ASLB DOUBLE
ADDB RANDOM TRIPLE
ADDB #$0B ADD IN 11
STAB RANDOM VOILA...NEW RANDOM NUMBER
DEC CYCL4$ COUNT DOWN DECAY
BNE PLAY6 DON'T DECAY
LDAB CYCLE4 RELOAD COUNT
STAB CYCL4$ AND SAVE
LDX XDECAY GET DECAY JUMP POINTER
DEX MOVE TO LESS AMPLITUDE
CPX #RDECAY+1 DONE?
BEQ PLAY12 YUP...BYE BYE
STX XDECAY SAVE NEW POINTER
PLAY6 LDAB RANDOM GET RANDOM AMPLITUDE
BMI PLAY6A SKIP IF NEGATIVE
ANDB DELTA4 REDUCE AMPLITUDE
ANDB #$7F STRIP SIGN BIT
BRA PLAY6B
PLAY6A ANDB DELTA4 REDUCE AMPLITUDE
ANDB #$7F REMOVE SIGN BIT
NEGB NEGATE
PLAY6B PSHA
ABA ADD WHITE NOISE
TAB
PULA
LDX XDECAY GET DECAY POINTER
JSR 0,X OUTPUT NOISE
BRA PLAY1 DO SOME MORE
PLAY7 LDX #FREQ1 INDEX TO SET 1
BRA PLAY10
PLAY8 LDX #FREQ2 INDEX TO SET 2
BRA PLAY10
PLAY9 LDX #FREQ3 INDEX TO SET 3
PLAY10 TST 24,X CHECK CYCLES AT FREQUENCY
BEQ PLAY11 ZERO, DON'T CHANGE
DEC 24,X COUNT DOWN
BNE PLAY11 NOT TIME TO CHANGE...
LDAB 12,X LOAD CYCLES AT FREQUENCY
STAB 24,X SAVE IN COUNTER
LDAB 00,X GET CURRENT FRQUENCY
ADDB 16,X ADD DELTA
CMPB 20,X COMPARE TO END
BEQ PLAY12 DONE...
STAB 00,X SAVE NEW CURRENT FREQUENCY
PLAY11 LDAB 0,X GET CURRENT FREQUENCY
STAB 8,X SAVE IN FREQUENCY COUNTER
ADDA 4,X ADD IN AMPLITUDE
NEG 4,X NEGATE AMPLITUDE
TAB SAVE DATA
LDX XDECAY INDEX TO DECAY
JSR 0,X OUTPUT SOUND
JMP PLAY1 REPEAT
PLAY12 LDX XPLAY RESTORE INDEX
RTS
*
* ECHO AND DECAY ROUTINE
*
RDECAY LSRB
LSRB
LSRB
LSRB
LSRB
LSRB
LSRB
LSRB
DECAYZ STAB SOUND
RTS
*
* 3 OSCILLATOR CALLING ROUTINES
*
THNDR LDX #VEC01 THUNDER SOUND
THNDR1 LDAB #28 NEED TO TRANSFER
JSR TRANS 28 BYTES FOR PLAY
JSR PLAY NOW PLAY IT
RTS
SND4 LDX #VEC04 SOUND 4
BRA THNDR1
SND5 LDX #VEC05 SOUND 5
BRA THNDR1
*
*
*
* THE BOMB OOOOOH NOOOOO!
WHIST LDAA #$80
STAA FREQZ
LDAA #SINTBL/$100
STAA TABLE
WHIST0 LDAA #$80
STAA TEMPA
WHIST1 LDAA #18
WHIST2 DECA
BNE WHIST2
LDAA TIME
ADDA FREQZ
STAA TIME
LSRA
LSRA
LSRA
ADDA #SINTBL!.$FF
STAA TABLE+1
LDX TABLE
LDAA ,X
STAA SOUND
DEC TEMPA
BNE WHIST1
DEC FREQZ
LDAA FREQZ
CMPA #$20
BNE WHIST0
RTS
* SINE TABLE
SINTBL FCB $80,$8C,$98,$A5,$B0,$BC,$C6,$D0
FCB $DA,$E2,$EA,$F0,$F5,$FA,$FD,$FE
FCB $FF,$FE,$FD,$FA,$F5,$F0,$EA,$E2
FCB $DA,$D0,$C6,$BC,$B0,$A5,$98,$8C
FCB $80,$73,$67,$5A,$4F,$43,$39,$2F
FCB $25,$1D,$15,$0F,$0A,$05,$02,$01
FCB $00,$01,$02,$05,$0A,$0F,$15,$1D
FCB $25,$2F,$39,$43,$4F,$5A,$67,$73
*
* KNOCKER ROUTINE
*
KNOCK CLR SOUND+2 FULL BLAST
LDX #KNKTAB
STX SNDTMP
SQLP LDX SNDTMP RESTORE X REG
LDAA ,X GET PERIOD
BEQ END END ON ZERO
LDAB 1,X GET AMP
ANDB #$F0
STAB AMP
LDAB 1,X
INX
INX
STX SNDTMP SAVE X
STAA PERIOD
ANDB #$F
LP0 LDAA AMP
STAA SOUND
LDAA PERIOD
LP1 LDX #5 DELAY
LP11 DEX
BNE LP11
DECA
BNE LP1
CLR SOUND
LDAA PERIOD
LP2 LDX #5 DELAY
LP22 DEX
BNE LP22
DECA
BNE LP2
DECB
BNE LP0
BRA SQLP
END LDAA #$80 OVERRIDE OFF
STAA SOUND+2
RTS
*
*
* KNOCKER PATTERN
*
KNKTAB FDB $01FC,$02FC,$03F8,$04F8,$06F8,$08F4,$0CF4
FDB $10F4,$20F2,$40F1,$60F1,$80F1,$A0F1,$C0F1,0
*
*
* SINGLE OSCILLATOR SOUND CALLS
*
PERK1 JSR MOVE
JSR SING
RTS
ATARI LDX #VEC02X
BRA PERK1
PERK$1 BSR PERK1
BSR ECHO
BRA PERK$1
PERK$$ LDAA #$FF
STAA AMP0
LDX #VEC06X
BRA PERK$1
*
* RANDOM SQUIRTS
*
SQRT LDAB #$30
SQRT1 LDX #VEC09X
BSR MOVE
SQRT2 LDAA RANDOM
ASLA
ADDA RANDOM
ADDA #$0B
STAA RANDOM
LSRA
LSRA
ADDA #$0C
STAA FREQ$
BSR SING
DECB
BNE SQRT2
RTS
*
* ECHO FUNCTION
*
ECHO LDAA AMP0
SUBA #$08
BPL ECHO1
STAA AMP0
RTS
ECHO1 PULA
PULA
RTS
*
* MOVE PARAMETERS
*
MOVE LDAA 0,X
STAA FREQ$
LDAA 1,X
STAA C$FRQ
LDAA 2,X
STAA D$FRQ
LDAA 3,X
STAA E$FRQ
LDAA 4,X
STAA C$AMP
LDAA 5,X
STAA D$AMP
RTS
*
* DELTA F, DELTA A ROUTINE
*
SING LDAA AMP0 GET STARTING AMPLITUDE
SING$ PSHB SAVE B
LDAB C$AMP GET CYCLES AT AMPLITUDE
STAB C$AMP$ SAVE AS COUNTER
LDAB C$FRQ GET CYCLES AT FREQUENCY
STAB C$FRQ$ SAVE AS COUNTER
SING1 COMA INVERT AMPLITUDE
LDAB FREQ$ GET FREQUENCY COUNTER
STAA SOUND OUTPUT TO D/A
SING2 DECB
BNE SING2
COMA INVERT AMPLITUDE
LDAB FREQ$ GET FREQUENCY COUNTER
BRA *+2 -I
INX -I
DEX -I--- SYNC, 20 CYCLES
INX -I
DEX -I
STAA SOUND OUTPUT TO D/A
SING3 DECB
BNE SING3
DEC C$FRQ$ CHECK CYCLES AT FREQUENCY
BEQ SING4 GO CHANGE FREQUENCY
DEC C$AMP$ CHECK CYCLES AT AMPLITUDE
BNE SING1 ALL OK, GO OUTPUT
COMA INVERT AMPLITUDE
LDAB C$AMP GET CYCLES AT AMPLITUDE
STAA SOUND OUTPUT TO D/A
STAB C$AMP$ SAVE AS COUNTER
LDAB FREQ$ GET FREQUENCY COUNT
ADDA D$AMP ADD AMPLITUDE DELTA
BMI SING6 RETURN FROM SUBROUTINE
NOP SYNC, 2 CYCLES
BRA SING5
SING4 INX -I
DEX -I--- SYNC, 10 CYCLES
NOP -I
COMA INVERT AMPLITUDE
LDAB C$FRQ GET CYCLES AT FREQUENCY
STAA SOUND OUTPUT TO D/A
STAB C$FRQ$ SAVE AS COUNTER
LDAB FREQ$ GET FREQUENCY COUNT
SUBB D$FRQ SUBTRACT FREQUENCY DELTA
CMPB E$FRQ COMPARE TO END FREQUENCY
CMPB E$FRQ SYNC, 3 CYCLES
BEQ SING6 RETURN FROM SUBROUTINE
SING5 STAB FREQ$ SAVE FREQUENCY COUNT
SUBB #$05 SYNC TO FREQUENCY COUNTDOWN
BRA SING2 JUMP INTO COUNTDOWN LOOP
SING6 PULB RESTORE B
RTS
*
*
SNDTBL FCB $DA,$FF,$DA,$80,$26,$01,$26,$80
FCB $07,$0A,$07,$00,$F9,$F6,$F9,$00
NOTTBL FCB $3A,$3E,$50,$46,$33,$2C,$27,$20
FCB $25,$1C,$1A,$17,$14,$11,$10,$33
WAVFRM FCB $08,$03,$02,$01,$02,$03,$04,$05
FCB $06,$0A,$1E,$32,$70,$00
VEC01 FDB $FFFF,$FF90,$FFFF,$FFFF,$FFFF
FDB $FF90,$FFFF,$FFFF,$FFFF,$FFFF
FDB $0000,$0000,$0000,$0000
VEC02 FDB $4801,$0000,$3F3F,$0000,$4801
FDB $0000,$0108,$0000,$8101,$0000
FDB $01FF,$0000,$0108,$0000
VEC03 FDB $0110,$0000,$3F3F,$0000,$0110
FDB $0000,$0505,$0000,$0101,$0000
FDB $31FF,$0000,$0505,$0000
VEC04 FDB $3000,$0000,$7F00,$0000,$3000
FDB $0000,$0100,$0000,$7F00,$0000
FDB $0200,$0000,$0100,$0000
VEC05 FDB $0400,$0004,$7F00,$007F,$0400
FDB $0004,$FF00,$00A0,$0000,$0000
FDB $0000,$0000,$FF00,$00A0
VEC06 FDB $0C68,$6800,$071F,$0F00,$0C80
FDB $8000,$FFFF,$FF00,$0000,$0000
FDB $0000,$0000,$FFFF,$FF00
VEC016 FDB $0104,$0000,$3F7F,$0000,$0104
FDB $0000,$05FF,$0000,$0100,$0000
FDB $4800,$0000,$05FF,$0000
VEC017 FDB $0280,$0030,$0A7F,$007F,$0280
FDB $0030,$C080,$0020,$0110,$0015
FDB $C010,$0000,$C080,$0000
VEC01X FDB $FF01,$02C3,$FF00
VEC02X FDB $0103,$FF80,$FF00
VEC03X FDB $2003,$FF50,$FF00
VEC04X FDB $5003,$0120,$FF00
VEC05X FDB $FE04,$0204,$FF00
VEC06X FDB $4803,$010C,$FF00
VEC07X FDB $4802,$010C,$FF00
VEC08X FDB $E001,$0210,$FF00
VEC09X FDB $50FF,$0000,$6080
VEC10X FDB $FF02,$0106,$FF00
*
*VARI LOADER
*
VARILD TAB
ASLA X2
ASLA X4
ASLA X8
ABA X9
LDX #LOCRAM
STX XPTR SET XSFER
LDX #VVECT
JSR ADDX
LDAB #9 GET COUNT
VTRAN JMP TRANS
*
*VARIABLE DUTY CYCLE SQUARE WAVE ROUTINE
*
VARI LDAA VAMP
STAA SOUND
VAR0 LDAA LOPER
STAA LOCNT
LDAA HIPER
STAA HICNT
V0 LDX SWPDT
V0LP LDAA LOCNT LO CYCLE
COM SOUND
V1 DEX
BEQ VSWEEP
DECA
BNE V1
COM SOUND
LDAA HICNT HI CYCLE
V2 DEX
BEQ VSWEEP
DECA
BNE V2
BRA V0LP LOOP BACK
VSWEEP LDAA SOUND
BMI VS1
COMA
VS1 ADDA #0
STAA SOUND OUTPUT
LDAA LOCNT
ADDA LODT
STAA LOCNT
LDAA HICNT
ADDA HIDT
STAA HICNT
CMPA HIEN
BNE V0
LDAA LOMOD
BEQ VARX
ADDA LOPER
STAA LOPER
BNE VAR0
VARX RTS
*
*TURBO
*
TURBO LDX #TRBO
JMP NOISLG
TRBO FCB $10,$FF,1,1,1
*CROWD ROAR
CDR LDX #WS1 1ST WHISTLE PARAMS
STX PTRHI
JSR WISLD
LDX #$A500 SEED
STX HI
LDX #CR1 1ST CROWD ROAR NOISE PARAMS
JSR NOISLD
JSR NINIT
LDX #CR2
JSR NOISLD
JMP NINIT2
*WHISTLE PARAMS
WS1 FCB $90,$10,2,$14,$40
FCB $B4,$40,$FF,$14,$30
FCB $D0,$32,$2,$10,$60
FCB $EE,$20,2,8,$54
FCB $E9,$54,$FF,$20,$28
FCB $C0,$30,2,$14,$58
FCB $AC,$20,$2,$8,$58
FCB $A6,$58,$FF,$18,$22
FCB 0
CR1 FCB $30,$10,$FC,0,1
CR2 FCB $30,$FC,1,0,1
GALMD FCB $10,$F0,$F0,1,$30
*
*MAIN GALLOP LOOP
*
MGAW LDX #GALMD
BSR NOISLD
GLP BSR GP1
BSR GP1
LDAA #$28
STAA NFRQ2
COM NFFLG
BSR NOIN
COM NFFLG
LDAA #$1E
BSR DELAY
BRA GLP
GP1 LDAA #$30
STAA NFRQ2
BSR NOIN
LDAA #2
BSR DELAY
RTS
DELAY TAB
LDX #$400
DLP1 TBA
DLP DECA
BNE DLP
DEX
CPX #0
BNE DLP1
LDAA #$F0
STAA NAMP
RTS
*
*WHITE NOISE ROUTINE
*NFRQ=INIT PERIOD, NAMP=INIT AMP, DECAY AMPLITUDE RATE
*CYCNT=CYCLE COUNT, NFFLG= FREQ DECAY FLAG
*NFFLG=0 NO FREQ CHANGE;=POS DECAY;=MINUS INC FREQ
*NOISE LOAD PROG-ENTER WITH XREG POINTING TO DATA
*
NOISLD LDAA X
STAA CY2
LDAA 1,X
STAA NAMP
LDAA 2,X
STAA DECAY
LDAA 3,X
STAA NFFLG
LDAA 4,X
STAA NFRQ2
NEND RTS
*
*LOAD NOISE AND GO
*
NOISLG BSR NOISLD
*
*NOISE INIT
*
NOIN BSR NSUB CY2&NFRQ2 TO CYCNT&NFRQ
*
*NOISE LOOP
*
NO1 BSR RNT FREQ CHECK
LDAA NFRQ FREQ REINITED?
CMPA NFRQ2
BNE NO1 IF NOT KEEEP DELAYING
ROLB RESTORE MAX AMPLITUDE TO NOISE
STAB SOUND OUTPUT TO DAC
BSR NOISE1 PREPARE NEXT RAND NO
BSR NOISE2
BSR RNA AMPLITUDE &CYCL3 COUNT CECK
TST NAMP SEE IF DONE
BEQ NEND RTS IF FINISHED
TST CYCNT SEE IF NEXT FREQ
BNE NO1 IF NOT GO FREQ DELAY LOOP
TST NFFLG SEE IF SWEEP MODE
BEQ NO1 IF NO SWEEP GO DELAY
BMI NO3 SWEEP DOWN
INC NFRQ2
BRA NO1
NO3 DEC NFRQ2
DEC NFRQ
BRA NO1
NSUB CLR CYCNT
LDAA NFRQ2
STAA NFRQ NOISE FREQ
CLR NNOIS
RTS
* 23 CYCLES FOR EACH SUBROUTINE PLUS CALLING OVERHEAD
*
*
NOISE1 LDAA LO GET RANDOM BIT
LSRA
LSRA
LSRA
EORA LO
STAA ATP INTERMED RAND NO
INX
ANDA #$7 FOR 3 BIT RANDOM NO
*
RTS
*
NOISE2 LDAA ATP
LSRA
ROR HI
ROR LO
LDAA #$0
BCC NOISE3
LDAA NAMP
NOISE3 STAA NNOIS NEXT NOISE VALUE
*
RTS
*
RNT LDAA NFRQ2 NOISE FREQ
DEC NFRQ
BEQ NW0
INX
DEX TEQ
BRA NNW1
NW0 STAA NFRQ REINIT FREQ
LDAB NNOIS SAVE NEXT NOISE VAL IN B REG
LSRB HALF AMPLITUDE
INC CYCNT NOISE CYCLE COUNT AT NAMP
*
NNW1 RTS
*
RNA LDAA CY2 NOISE AMPL CHANGE
CMPA CYCNT
BEQ NW2
INX
DEX
BRA NW3 TEQ
NW2 CLR CYCNT
LDAA NAMP
SUBA DECAY
STAA NAMP
*
NW3 RTS
*
* NOISE WITH WHISTLE MAIN LOOP
NINIT CLR WFRQ
CLR DFRQ
LDAA #$E CYCLE OFFSET FOR WHISTLE
STAA WCNT
CLR CURVAL CLR WHISTLE VALUES
NINIT2 BSR NSUB CLR CYCNT AND INIT FREQ
WIN BSR NOISE1
JSR TRIDR
BSR NOISE2
JSR TRIDR
BSR RNT
BSR TRIDR
BSR RNA
BSR TRIDR
BSR TRICNT
BSR TRIDR
BSR TRIFRQ
BSR TRIDR
BSR NNW
BRA WIN
*
TRICNT LDAA WCNT2 #CYCLES AT WHISTLE FREQ
DEC WCNT
BEQ NW4
FCB $B6 LDAA EXTENDED
FDB NAMP
BNE NW5 TEQ
BRA NSEND END NOISE
NW4 STAA WCNT
LDAA WFRQ
ADDA DFRQ
STAA WFRQ
*
NW5 RTS
*
TRIFRQ LDAA WFRQ WHISTLE END TEST
CMPA MINWIS
BEQ NW6
INX TEQ
LDAA NAMP END TEST
BNE NW7 TEQ
BRA PEND END NOISE
NW6 CLR WFRQ TURN OFF WHISTLE
CLR DFRQ
CLR CURVAL
LDX PTRHI SET UP FOR NEXT WHISTLE
WISLD LDAA X
STAA WHIS
BEQ NW7
LDAA 1,X
STAA WFRQ2
LDAA 2,X
STAA DFRQ2
LDAA 3,X
STAA WCNT2
LDAA 4,X
STAA MINWIS
LDAA #5
JSR ADDX
STX PTRHI
*
NW7 RTS
PEND PULA
PULA STACK ADJ
RTS
*
NNW LDAA WHIS WHISTLE INIT
BEQ NW8 ALREADY INITED
CMPA NAMP
BNE NW9
BRA WINIT GO INIT WHISTLE
NW8 INX
DEX TEQ
NW9 RTS
WINIT CLR WHIS
LDAA WFRQ2
STAA WFRQ
LDAA DFRQ2
STAA DFRQ
RTS
******************
TRIDR LDAA CURVAL
ADDA WFRQ
STAA CURVAL
BPL GO
COMA
GO ABA
STAA SOUND
NSEND RTS
*
*
*LIGHTNING
*
LITE LDAA #1
STAA DFREQ
LDAB #3
BRA LITEN
*
*LIGHTNING+APPEAR NOISE ROUTINE
*
LITEN STAA LFREQ
LDAA #$FF HIGHEST AMP
STAA SOUND
STAB CYCNT
LITE0 LDAB CYCNT
LITE1 LDAA LO GET RANDOM
LSRA
LSRA
LSRA
EORA LO
LSRA
ROR HI
ROR LO
BCC LITE2
COM SOUND
LITE2 LDAA LFREQ COUNT FREQ
LITE3 DECA
BNE LITE3
DECB COUNT CYCLES
BNE LITE1
LDAA LFREQ
ADDA DFREQ
STAA LFREQ
BNE LITE0
RTS
*
*
*WHITE NOISE ROUTINE
*X=INIT PERIOD, ACCB=INIT AMP, ACCA DECAY RATE
*CYCNT=CYCLE COUNT, NFFLG= FREQ DECAY FLAG
*
MOISE STAA DECAY
MOISE0 STX NFRQ1
MOIS00 STAB NAMP
LDAB CYCNT
MOISE1 LDAA LO GET RANDOM BIT
LSRA
LSRA
LSRA
EORA LO
LSRA
ROR HI
ROR LO
LDAA #$0
BCC MOISE2
LDAA NAMP
MOISE2 STAA SOUND
LDX NFRQ1 INCREASING DELAY
MOISE3 DEX
BNE MOISE3
DECB FINISH CYCLE COUNT?
BNE MOISE1 NO
LDAB NAMP DECAY AMP
SUBB DECAY
BEQ MSEND
LDX NFRQ1 INC FREQ
INX
LDAA NFFLG DECAY FREQ?
BEQ MOIS00 NO
BRA MOISE0
MSEND RTS
*
*
*PARAMETER TRANSFER
*
TRANS PSHA
TRANS1 LDAA 0,X
STX XPLAY
LDX XPTR
STAA 0,X
INX
STX XPTR
LDX XPLAY
INX
DECB
BNE TRANS1
PULA
RTS
*
*
*GWAVE LOADER
*
GWLD TAB MULKT BY 7
ASLB
ABA
ABA
ABA
LDX #SVTAB SOUND VECTOR TABLE
JSR ADDX
LDAA ,X
TAB
ANDA #$F
STAA GCCNT GET CYCLE COUNT
LSRB
LSRB
LSRB
LSRB
STAB GECHO GET #ECHOS
LDAA 1,X
TAB
LSRB
LSRB