-
Notifications
You must be signed in to change notification settings - Fork 1
/
coleco-listing2.txt
6870 lines (6870 loc) · 499 KB
/
coleco-listing2.txt
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
1 780"
3 NAME “OS7PRIME~
4
5 DESCRIPTION MACRO
6 -GOTOENDESCRIPTION
7
8 Author: Coleco Industries Inc.
9 Advanced Research & Development - Software Engineering
10 Userid: Os
11 Starting date: A long long time ago in a galaxy far far away...
12
13. Prom release Date: 24 Nov 1982. for internal use only
14 Prom release Rev: 7B
15
16 Prom release Date: December 28, 1982
17 Prom release Rev: 7PRIME
18
19 Header Rev: 2
20
21 SEEKS AASAAAAAARAAAAREAAAEAEERKAAEARERKAEARAEEAAERARERACEAEREKREAKAEKKEKAKRERKERKEKRKKKEK
22 * *
23 * ColecoVision Operating System *
24 * Absolute Listing ( Rev 7PRIME ) *
25 * (c) Coleco Industries 1982 *
26 * ®
e7 * *** Confidential *** *
26 * *
29 SBESTARAKAAAEKAKAAEARKAAAEARAETKAKAEREHAAAAAAEAEKERERAEREREAEEZAEEERERKEEKAKEAR
30
31
32 This listing has the actual addresses of the start of OS routines
33
34 Rev History (one line note indicating the change)
35 |
36 Rev. Date Change
37 4 14feb1983 Filler locations changed to OFFH to
38 reflect OS 7PRIME. Prom release date
39 changed to December 28, 1982 from May
60 1982. Name change to OS7PRIME to
41 reflect majority of versions in the °
42 field at this date.
43
44 3 24nov1982 Timing change to shorten LOGO delay
45 Title changes to JMPTABLES and OSSR EQU
46 2 60ct1982 Minor comment modifications
47 1 23sept1982 OS7 as one absolute file
48 0 May 1982 OS7 listing by module
49
50 ENDESCRIPTION:
51 MEND
52 PROG .
55; Operating system sound routine EQUATES
56 ; FILE NAME: OSSR.EQU
57 ; gan Equates sere
58 ; Dedicated Cartridge RAM locations
<7020> 59 DEDAREA EQU 7020H sthe start of the RAM area dedicated to sound routines
<7020> 60 PTR TOLST OF SND_ADDRS EQU DEDAREA+0
<7022> 61 PTR TO SON O EQU;DEDAREA+2
<7024> 62 PTR TO SON.1 EQU DEDAREA+4
<7026> 63 PTR TOS OM _2 EQU DEDAREA+6
<7028> 64 PTRTO SON 3 EQU DEDAREAtS
<702A> 65 SAVECTRL EQU DEDAREA+10
66 ; Attenuation level codes
<000F> 67 OFF EQU OFH ;OFF (NO SOUND)
68 ; Sound outputport
<O0FF> 69 SOUND_PORT EQU OFFH ;data to sound chip thru this port
70 ; Special byte 0 codes
<003E> 72 SEFFECT EQU 62
<0000> 73 ENDSDATA EQU 0
74; Offsets within an SxDATA song data area
<0000> 75 CH EQu 0
<0000> 76 SONGNO EQU 0
<0001> 77 WEXTNOTEPTR EQU 1
<0003> 78 FREQ EQU 3
<0004> 79 ATW EQU 4
<0004> 80 CTRL EQU 4
<0005> 81 NLEN EQu 5
<0006> 82 FPS EQU 6
<0006> 83 FPSV EQU 6
<0007> 84 FSTEP EQU 7
<0008> 85 ALEN Equ 8
<0008> 86 ASTEP €EQu8
<0009> 87 APS EQU 9
<0009> 88 APSV EQU 9
89 ; song end codes
<0010> 90 CHOEND EQU 000100008
<0050> 91 CHIEND EQu 010100008
<0090> 92 CH2END EQuU100100008
<0000> 93 CH3END EQU 110100008
<0018> 94 CHOREP EQU 000110008
<0058> 95 CHIREP EQU 010110008
<0098> 96 CH2REP EQU 100110008
<0008> 97 CH3REP EQU 110110008
98 ; channel numbers, B7 -B6
<0000> 99 CHO EQu 0
<0040> 100 CH1 Equ 010000008
<0080> 101 CH2 EQU 100000008
<00cO> 102 CH3 EQU 110000008
103 ; [page]
104 PROG
105
107
108 ; Modified February 14, 1983. Filler areas were changed
109 ; to OFFH to reflect OS7PRIME. Also minor comment changes
110 ; were made to clarify O55AAH for test cartridge condition.
113
114 * EXTERNAL ROUTINES LINKED INTO OS
115 |
116 sEXT REG WRITE ;VIDEO DRIVERS
117 ;EXT REG READ
118 ;EXT VRAM WRITE
119 ;EXT VRAM READ
120 ;EXT INIT QUEUE
121 sEXT WRITER_
122 ;EXT REGWRITEQ PASCAL CALLS
123 ;EXT VRAM WRITEQ
124 ;EXT VRAM_READQ
125 ;EXT INIT QUEUEQ
126
127 sEXT POLLER ; CONTROLLER ROUTINE
128 ;EXT UPDATESPINNER
129 ;EXT CONTSCAN
130 ;EXT DECODER_
131
132 EXT INIT SOUND ; SOUND ROUTINES
133 ;EXT ALL_OFF
134 sEXT JUKEBOX
135 ;EXT SNOMANAGER
136 ;EXT PLAYSONGS
137 sEXT INITSOUNDQ ; PASCAL CALLS
138 sEXT JUKEBOXQ
139
140 sEXT INITTIMER | ; TIME MGMT ROUTINES
141 sEXT FREESIGNAL _
142 sEXT REQUESTSIGNAL _
143 | sEXT TESTSIGNAL
144 sEXT TIMEMGR_
145 sEXT INITTIMERQ ; PASCAL CALLS
146 sEXT FREESIGNALQ ;
147 sEXT REQUEST SIGNALQ
148 sEXT TESTSIGNALQ
149
150 sEXT INITTABLE _ 7TABLE MA
151 sEXT GETVRAM_
152 ;EXT PUTVRAM_
153 sEXT INITSPR ORDER_
154 sEXT WRSPR NM TBL_
155 sEXT INITTABLEQ ;PASCAL CALLS
156 ;EXT GETVRAMQ
157 ;EXT PUTVRAMQ .
158 -EXT INITSPR ORDERQ
159 sEXT WRSPR NM TBLQ
160
161 sEXT ACTIVATE ; GRAPHICS ROUTINES
162 -EXT PUTOBJ
163 7EXT RFLCTVERT
164 EXT RFLCT HOR
165 EXT ROT 90
166 EXT EWLRG
167 EXT PUTOBJO ; PASCAL CALLS
168 EXT ACTIVATEQ
169
170 ;EXT GAME OPT ;DISPLAYS THE GAME OPTION SCREEN
171 ;EXT LOAD ASCII LOADS ASCII CHARACTER GENERATORS
172 EXT FILL VRAM_ FILLS DESIGNATED AREA OF VRAM WITH VALUE
173 EXT MODE 1 ;SETS UP A DEFAULT GRAPHICS MODE 1
174
175
176 * “HIDDEN EXTERNALS”
177
178 3EXT DISPLAY LOGO
179 sEXT CONTROLLER INIT
180 sEXT ASCII TBL
181 sEXT WUMBER TBL
182
183
184 SRAKASAATAEAAAEAAAEEEAKAARRERER EXPORTS SRARAARAARARAEKRARARAREEERAKRERKEE
185
186 * ENTRY POINTS TO OS ROUTINES
187
188 GLB INIT TABLE TABLE MA
189 GLB GET VRAM
190 GLB PUT _VRAM
191 GLB INIT SPR ORDER
192 GLB WR_SPR_WM TBL
193 GLB INIT TABLEP PASCAL CALLS
19% GLB GET VRAMP
195 GLB PUT_VRAMP
196 GLB INIT SPR ORDERP
197 GLB WR_SPR_NM TBLP
198
199 GLB WRITE REGISTER ; VIDEO DRIVERS
200 GLB READ REGISTER |
201 GLB WRITE _VRAM
202 GLB READ VRAM
203 GLB INIT WRITER ,
204 GLB WRITER
205 GLB WRITE_REGISTERP ; PASCAL CALLS
206 GLB WRITE VRAMP
207 GLB READ VRAMP
208 GLB INIT _WRITERP
209
210 GLB POLLER ; CONTROLLER ROUTINES
211 GLB UPDATE SPINNER
212 GLB CONTROLLER SCAN
213 GLB DECODER
214
215 GLB SOUND INIT ; SOUND ROUTINES
216 GLB TURN OFF SOUND
217 GLB PLAY IT
218 GLB SOUND MAN
219 GLB PLAY SONGS
220 GLB SOUND INITP ; PASCAL CALLS
221 GLB PLAY ITP
222
223 GLB INIT TIMER ; TIME MGMT ROUTINES
224 GLB FREE SIGNAL
225 GLB REQUEST SIGNAL
226 GLB TEST SIGNAL
227 GLB TIME MGR
228 GLB INIT _TIMERP ; PASCAL CALLS
229 GLB FREE SIGNALP
230 GLB REQUEST SIGMALP
231 GLB TEST SIGNALP
232
233 GLB STACK ; MISC GLOBALS
234 GLB VDPSTATUS BYTE
235 GLB VDP_MODE_ WORD
236 GLB AMERICA
237 GLB MUX SPRITES
238 GLB DEFER WRITES
239 GLB RAND GEN 3Can be called from Pascal
240 ; or assembly language
241 GLB PUTOBJ 3 GRAPHICS ROUTINES
242 GLB ACTIVATE
243 GLB REFLECT VERTICAL
264 GLB REFLECT _WORIZONTAL
245 GLB ROTATE_90
246 GLB ENLARGE
247 GLB PUTOBJP : PASCAL CALLS
248 GLB ACTIVATEP
249
250 GLB GAME_OPT GAME OPTIONS DISPLAY
251 GLB LOAD _ASCII sLOADS ASCII CHARACTER GENERATORS
252 GLB FILL_VRAM ;FILLS DESIGNATED AREA OF VRAM WITH VALUE
253 GLB MODE 1 7SETS UP A DEFAULT GRAPHICS MODE 1
254 GLB ASCIT TABLE ;POINTER TO TABLE OF ASCII GENERATORS
255 GLO NUMBER TABLE POINTER TO TABLE OF 0-9 PATTERN GENERATORS
256
258 RBRERRAEKAERAARAAAARAKCARTRIDGE ROM DATA AREA RRAKAKRAKEARARERARAKERKAREE
259
260 GLB CARTRIDGE
<8000> 261 CARTRIDGE EQU 8000H
262 * THIS ISTHE MEMORY LOCATION TESTED TO SEE IFA CARTRIDGE IS PLUGGED
263 * IN.IF IT CONTAINS THE PATTERN AASSH THE OS ASSUMES THAT A GAME
264 * CARTRIDGE IS PRESENT. IF ITCONTAINS THE THE PATTERN 55AAH, THE OS
265 * ASSUMES THAT A TEST CARTRIDGE ISPRESENT.
266
267 GLB LOCALSPR TBL
<8002> 268 LOCAL SPR TBL EQU-. 8002H
269 * THIS IS A POINTER TO THE CPU RAM COPY OF THE SPRITE NAME TABLE. THE
270 * TABLE COPY IS USED WHENEVER ONE LEVEL OF INDIRECTIONIS DESIRED IN
271 * ADDRESSING THE VRAM TABLE. FOR EXAMPLE WHEN.USING THE OS SPRITE
272 * MULTIPLEXING SOFTWARE.
273
274 GLB SPRITEORDER
<8004> 275 SPRITEORDER EQU 8004K
276 * THIS IS A POINTER TO THE CPU RAM SPRITE ORDER TABLE. THIS TABLE IS
277 * USED TO ORDER THE LOCAL SPRITE NAME TABLE.
278
279 GLB WORKBUFFER
<8006> 280 WORK BUFFER EQU 8006H
281 * THIS IS A POINTER TO A FREE BUFFER SPACE IN RAM. THE OBJECT ORIENTED
282 * GRAPHICS ROUTINES USED THIS BUFFER FOR TEMPORARY STORAGE.
283
284 GLB CONTROLLERMAP
<B8008> 285 CONTROLLER MAP EQU 8008H:
286 * THIS IS A POINTER TO THE CONTROLLER MEMORY MAP THAT IS MAINTAINED BY
287 * THE HIGH-LEVEL CONTROLLER SCANNING AND DEBOUNCE SOFTWARE.
288
289 GLB STARTGAME
<800A> 290 STARTGAME EQU 800AH
291 * THIS IS A POINTER TO THE START OF THE GAME.
292 —
(293 RRAARARKRARRKARURKER RESTART AND INTERRUPT VECTORS RERKEKEKRKAKKKKKRKKKRAEK
294 * THESE ARE ADDRESSES IN CARTRIDGE ROM OF VECTORS WHICH MUST BE PLACED
295 * THERE BY THE CARTRIDGE PROGRAMMER. WHEN AN INTERRUPT OR RESTART
296 * OCCURS, THE OS VECTORS IT THROUGH THIS AREA. THE CARTRIDGE PROGRAMMER
297 * SHOULD PLACE A JUMP TO HIS OWN INTERRUPT HANDLER IN THE APPROPRIATE
298 * LOCATION.
299
300 GLB RST BHRAM ~
<800C> 301 RST8H RAM EQU 800CH
302 * THIS IS THE RESTART 8 SOFT VECTOR.
303 |
304 GLB RST_10H_RAM
<800F> 305 RST10H RAM B00H
306 * THIS IS THE RESTART 10 SOFT VECTOR.
307
308 - GLB RST 18HRAM
<8012> 309 RST 18H RAM EQU 8012H
310 * THIS IS THE RESTART 18 SOFT VECTOR.
311
312 GLB RST 20HRAM
<8015> 313 RST 20H RAM EQU 8015H
314 * THIS IS THE RESTART 20 SOFT VECTOR.
315
316 GLB RST 28H RAM
<8018> 317 RST28H RAM EQU 8018H
318 * THIS ISTHE RESTART 28 SOFT VECTOR.
319
320 GLB RST 30H RAM
<B01B> 321 RST 30H RAM = EQU 8016H
322 * THIS IS THE RESTART 30 SOFT VECTOR.
323
324 GLB IRQ_INT VECT
<BO1E> 325 IRQ_INTVECT EQuU BOTEH
326 * THIS IS THE MASKABLE INTERRUPT SOFT VECTOR
327
328 GLB WMI INT VECT
<8021> 329 NMI INT VECT EQU 8021H
330 * THIS IS THE NMI SOFT VECTOR.
331
332 GLB GAME NAME
<8024> 333 GAME NAME EQU 8024H
334 * FROM HERE TO STARTGAME THERE SHOULD BE A STRING OF ASCII CHARACTERS
335 * WAMES THAT HAS THE FOLLOWING FORM:
336 *
337 * GAME/MAKER_OF THIS GAME/COPYWRITE YEAR.
339 * FOR EXAMPLE:
340 *
341 * “DONKEY KONG/NINTENDO/ 1982"
342
343 * IMPORTANT NOTE *****
3446
345 * #ees IT 1S THE RESPONSIBILITY OF THE ****
346 * *#** CARTRIDGE PROGRAMMER TO PLACE ****
347 * **#* THESE CODES IN CARTRIDGE ROM
348
350
351 RAARARAARAAAKARAAARAAAAAAARARAKKRAKAARARARKAAAEARAERAEARARERERAARARRERAKARREEKE
352 * ®
353 * OPERATING SYSTEM ROM CODE *
354 * *
355 RERARARAAAAARAAAARARAAAAAKARARAAEKKAKAAAREERAAARAREKRAREREARAREARAKRAREAAREEK
356
357 REAAAKRAKAARAAAARARAKARAARAARRAREEE PAGE ZERO SREKRAARRESRAAAAARAARRARRRARARKAEE
358 * PAGE ZERO CONTAINS THE RESTART VECTORS, INTERRUPT VECTORS, AND
359 * THE INTERRUPT VECTORING SOFTWARE, AS WELL AS THE DEFAULT HANDLERS
360 * FOR INTERRUPTS AND RESTARTS.
361
362 * BOOT-UP ROUTINE
363
364 * THE BOOT-UP ROUTINE HANDLES POWER ON RESETS AND RESTARTS TO 0. IT
365 * INITIALIZES THE STACK AND JUMPS TO THE POWER UP ROUTINE.
366
367 * BEGIN BOOT-UP
368 BOOT UP PROG
369
370 * KICK STACK
371 LD SP, STACK
372
373 * JUMP TOPOWER _UP
374
375 JP POWER UP
376 END BOOTUP
377 * END BOOT-UP
379
380 * RESTART VECTORS
381
382 * THE FOLLOWING ARE THE 8 PROGRAMMABLE RESTARTS. FOR EACH OF THE
383 * RESTART LOCATIONS BELOW THERE IS A VECTOR IN CARTRIDGE ROM.
384 * TO USE A RESTART, THE PROGRAMMER MUST PLACE THE ADDRESS OF THE
385 * ROUTINE WHICH HE/SHE WISHES TO ACCESS THROUGH THE RESTART AT THE
386 * CORRSEPONDING VECTOR. THEREAFTER EVERY TIME THAT RESTART IS
387 * EXECUTED, THE CARTRIOGE PROGRAMMER'S ROUTINE WILL BE CALLED.
388
0006 FFFF 389 HEX FF,FF Filler
0008 ¢3800C 390 RST8H JP RST8H RAM
391
0008 FFFFFFFFFF 392 HEX FF,FF,FF,FF, FF Filler
0010 C3800F 393 RST10H JP RST 10H RAM
394
0013 FFFFFFFFFF © 395 HEX FF,FF,FF,FF, FF Filler
0018 C38012 396 RST18H JP RST_18H_RAM
397
0018 FFFFFFFFFF 398 HEX FF,FF,FF,FF,FF Filler
0020 ¢38015 399 RST20H JP RST_20H_RAM
400
0023 FFFFFFFFFF 401 HEX FF,FF,FE,FF, FF ;Filler
0028 C38018 402 RST28H JP RST28H RAM
403
0028 FFFFFFFFFF 404 HEX FF,FF, FF,FF, FE Filler
0030 C3801B 405 RST_30H JP RST30H RAM
406
408
409 * MASKABLE INTERRUPT VECTORING SOFTWARE
410
411 * A MASKABLE INTERRUPT OCCURRING IN THE SYSTEM IS EQUIVALENT TO A
412 * RESTART TO 38H. THUS, THE MASKABLE INTERRUPT IS VECTORED IN EXACTLY
413 * THE SAME WAY AS THE VARIOUS RESTARTS GIVEN ABOVE. IN ORDER TO USE
414 * THE INTERRUPT, TWE CARTRIDGE MUST PLACE THE ADDRESS OF HIS/HER
415 * INTERRUPT HANDLER IN THE IRQ INT VECT LOCATION IN CARTRIDGE ROM.
416
417 * THE CARTRIDGE PROGRAMMER IS RESPONSIBLE FOR SAVING ANY REGISTERS
418 * WIS/HER OWN INTERRUPT HANDLERS MAY USE, AND FOR RE-ENABLING
419 * INTERRUPTS IF WE/SHE WEEDS THEM TO BE RE-EWABLED.
420
421 * MASKABLE INTERRUPT
0033 FFFFFFFFFF 422 HEX FF, FF,FF,FF, FF Filler
0038 423 IRQINTERRUPT :38H
0038 C3801E 426 JP (1RQ_INT_VECT)
425
426 RRAAKAAEARARARAAREARKEKARE RANDOM LIME GENERATOR RRRARAARRAKARERARKAKRKARKRKEKREK
427
428 * (PLACED HERE FOR PURPOSES OF CODE COMPACTION)
429
430 * Random mmber generator (psuedo) for a 16 bit value
431 * This routine ‘exclusive or's the 15th and 8th bit
432 * together. It then rotates the entire quantity to the
433 * left and inserts the ‘exclusive or'ed bit into the rightmost
434 * bit. Upon leaving it stores the random # in a specified
435 * memory location.
436
437 * The random number can be accessed from the global location
438 * RAND _NUM or the HL pair or the Accumulator.
439
0038 440 RAND GEN :
0038 2A73C8 441 LD =HL, [RANDNUM)
003C CB7C 442 BIT 7,H
0040 2806 443 JR ON
444 715th bit is on
0042 CB44 445 BIT O,H
0044 2806 446 JR = 2,SET ;For 10 quantity then set
0046 1807 447 JR =RESET ;For 11 reset ,
0048 448 WOTON:
0048 CB44 449 BIT O,H
004A 2803 450 JR ;For 00 reset
451 For 01 fall through to set
004C 452 SET:
004C 37 453 SCF
0040 1801 454 JR CARRY READY
004F 455 RESET:
004F B87 456 OR A
0050 457 CARRY READY:
0050 cB15 458 RL L
0052 CB14 459 RL oH ,
0054 2273C8 460 LD {RAND NUM) ,HL
0057 7D 461 LD A,L
0058 C9 462 RET
0059 463 AFTER RANDOM
464
465 SASRSAAERAKARARAAREAEAAAAARAEKAKARERAEAAARARAERKAAAARARARARAEKAAAEERARERAEREE
466
468
469 * THE WMI VECTORING SOFTWARE AND DEFAULT HANDLER
470
471 * WHEN AN NMI IS RAISED BY THE VDP IN THE COLECOVISION SYSTEM, IT
472 * CAUSES THE CPU TO RESTART TO 66H. THE VECTORING SOFTWARE FOR THE
473 * WMI IS IDENTICAL TO THAT FOR THE MASKABLE INTERRUPT EXCEPT THAT
474 * IT GETS ITS VECTOR FROM WMIINT VECT INSTEAD OF IRQ_INT_VECT.
475
476 * AGAIN THE CARTRIDGE PROGRAMMER IS RESPONSIBLE, IN HIS/HER OWN
477 * INTERRUPT HANDLERS FOR SAVING AND RESTORING THE PROCESSOR STATE
478 * WHEN NECESSARY, AND FOR CLEARING THE VDP CONDITION BY READING THE
479 * VDP STATUS REGISTER.
480
0059 FFFFFFFFFF 481 HEX FF,FF,FF, FF, FF sFiller
OOSE FFFFFFFFFF 482 HEX FFLFF, FF,FF, FF Filler
0063 FFFFFF 483 | HEX FF,FF, FF Filler
484 * NON-MASKABLE INTERRUPT
0066 485 NMI_ INTERRUPT
0066 ¢38021 686 JP (WHI INT VECT)
487
489
490 **ttteeanenetenaneeeneeRe OS ROM DATA AREA ***teunsenenennseeaneeennn
491
0069 3C 492 AMERICA DEFB 60
493 * THIS BYTE SHOULD BE USED WHENEVER THE CARTRIDGE PROGRAMMER WANTS TO
494 * SET UP REAL-TIME COUNTERS. IT HAS A VALUE OF 60 FOR COLECOVISIONS
495 * WARKETED IN THE USA ANO 50 FOR EUROPEAN UNITS. USE OF THIS BYTE
496 * EWSURES CARTRIDGE COMPATIBILITY AT LEAST WHERE REAL-TIME COUNTING
497 * IS CONCERNED.
498
006A 16AB 499 ASCII_TABLE — DEFW ASCII TBL
500 * THIS IS THE ADDRESS OF THE ROM PATTERN GENERATORS FOR UPPERCASE
509 * ASCII WHICH ARE CONTAINED WITHIN THE OPERATING SYSTEM.
02
006C 1623 503 NUMBER TABLE NUMBER TBL
504 * THIS IS THE ADDRESS OF THE ROM PATTERN GENERATORS FOR THE NUMBERS
3ie * 0.9 WHICH ARE CONTAINED WITHIN THE OPERATING SYSTEM.
200 REASARAAATAAAARARERARERES RRREKEARAAAERRALRARKRAEE
510 ;
511 ;B00TUP SINCE THE VIDEO GAME SYSTEM MAY BE STARTED UP WITH A
512 ; GAME CARTRIDGE, KEYBOARD MODULE, OR BOTH (OR NOTHING)
513 ; INSTALLED AT BOOT UP, THE SOFTWARE MUST PERFORM THE
514 ; FOLLOWING;
515 >
516 ; A. IMITIALIZE THE INTERRUPT VECTORS.
517 ;
518 ; B. IMITIALIZE RESTART VECTORS
519 ;
520 ; C. TURN OFF THE SOUND CHIP.
521 ; |
522 ; D. DETERMINE IF A CARTRIDGE IS PLUGGED IN.
523 ; IF SO, BRANCH TO THE CARTRIDGE PROGRAM
524 ; ELSE, WAIT FOR CARTRIDGE.
525
<0000> 526 FALSE EQU 0
<0001> 527 TRUE EQu 1
528 * VALUES FOR BOOLEAN FLAGS
529
530 * BEGIN POWER _UP
<O06E> 531 POWER UP EQU $
532
533 * IF CARTRIDGE = 55AAH THEN EXIT TO START GAME (TEST)
O06E 2A8000 534 LD HL, (CARTRIDGE)
0071 7D 535 i) A,L
0072 FESS 536 cp 55H
0074 C20081 537 JP NZ,NO TEST.
0077 7C 538 LD A,l
0078 FEAA 539 cP OAAH
007A C20081 540 JP NZ,MO TEST.
0070 2AB800A 541 LO HL, [START GAME)
0080 E9 542 JP {Wt}
543
544 * ELSE
0081 545 MO_TEST_
546
547 * TURN OFF SOUND CHIP ,
0081 CD1FD6 548 CALL TURN OFF SOUND
549
550 * INITIALIZE RANDOM NUMBER GENERATOR
0084 210033 551 LD HL,33H
3
554 * CLEAR CONTROLLER BUFFER AREAS
008A CD1105 555 CALL CONTROLLER _INIT
556
557 * DEFER WRITES := FALSE
008D 3£00 558 LD A,FALSE ‘
OO8F 3273C6 559 LD (DEFER WRITES) ,A
560
561 * MUX SPRITES := FALSE
0092 3273C7 562 LO [MUX SPRITES) ,A
563
570 RRERAAARKARARSRAAKARRRARKEE SYSTEM RAR AREA REKARTKARAARARKARAAARAEKAAERE
571 DATA
0000 572 DEFS 73BAH ;Added to offset to first location
<73BA> 573 SYSTEM RAM AREA EQU $
574 * THIS IS THE RAM AREA DEDICATED TO THE BASIC OS NEEDS. IT INCLUDES THE
575 * STACK, VARIOUS STATUS VARIABLES, AND ALL THE VARIABLES USED BY OS
576 * ROUTINES.
577
<7389> 578 STACK Equ SYSTEM RAM AREA-1
579 * THIS 1S THE TOP OF THE STACK
580
581 ; COMN
582 ; DEFS 9
583 DATA
738A 584 PARAM AREA:
738A 585 INIT SOUND DATA:
738A 586 PRM AREA:
738A 587 IWIT TIME DATA:
T3BA 588 TEMP1:
T3BA 589 DEFS 1
7388 590 DEFS 1
738C 591 TEMP2:
738C 592 DEFS 1
7380 593 DEFS 1
73BE 594 SIGNAL_NUM:
T3BE 595 DEFS 1
738F 596 REPEAT SIG CODE:
738F 597 DEFS 1
73c0 598 TIMER LENGTH:
73CO 599 DEFS 1
73C1 600 DEFS 1
73C2 601 TEST SIG _WUM:
T3C2 602 DEFS 1
603
604
605 * THIS IS THE COMMON PARAMETER PASSING AREA AND THE HOLE IN THE DATA
606 * AREA THAT IS PROVIDED TO MAKE ROOM FOR IT.
607
73C3 608 VDP MODE WORD EFS 2
609 * THE VDP MODE WORD CONTAINS A COPY OF THE DATA IN THE FIRST TWO VOP .
610 * REGISTERS. BY EXAMINING THIS DATA, THE OS AND CARTRIDGE PROGRAMS
611 * CAN MAKE MODE-DEPENDENT DECISIONS ABOUT THE SPRITE SIZE OR VRAM
612 * TABLE ARRANGEMENT. THIS WORD IS MAINTAINED BY THE WRITE REGISTER
613 * ROUTINE WHENEVER THE CONTENTS OF REGISTERS 0 OR 1 ARE CHANGED.
614
615 * IMPORTANT NOTE *****
616
617 * wane IT IS THE RESPONSIBILITY OF THE ****
618 * **8* CARTRIDGE PROGRAMMER TO MAKE “ee
619 * *e*® SURE THAT NON-STANDARD USE OF ‘****
620 * see® THE VDP REGISTERS DOES NOT MAKE **** °
621 * see% THE DATA IN THIS WORD INVALID ****
622
73c5 623 VDP_STATUS BYTE DEFS 1
624 * THE DEFAULT HANDLER FOR THE NMI, WHICH MUST READ THE VDP STATUS
625 * REGISTER TO CLEAR THE INTERRUPT CONDITION, PLACES ITS CONTENTS
626 * HERE. THIS BYTE IS THE MOST ACCURATE REPRESENTATION OF THE ACTUAL
627 * VDP STATUS THAT IS AVAILABLE TO THE CARTRIDGE PROGRAMMER PROVIDED
628 * THAT THE VDP INTERRUPT IS ENABLED ON-CHIP
629
73C6 630 DEFER WRITES 1
631 * DEFER WRITES ISA BOOLEAN FLAG WHICH IS SET TO FALSE AT POWER UP
632 * TIME, SHOULD BE SET TO TRUE ONLY IF THE CARTRIDGE PROGRAMMER WISHES
633 * TO DEFER WRITES TO VRAM. IF THIS FLAG IS TRUE THEN THE WRITER
634 * ROUTINE MUST BE CALLED REGULARLY TO PERFORM DEFERRED WRITES.
635
73C7 636 MUX SPRITES DEFS 1
637 * THIS BOOLEAN FLAG WITH DEFAULT FALSE VALUE SHOULD BE SET TO TRUE IF
638 * THE CARTRIDGE PROGRAMMER WISHES ONE LEVEL OF INDIRECTION TO BE
639 * INSERTED INTO SPRITE PROCESSING BY HAVING ALL SPRITES WRITTEN TO
640 * A LOCAL SPRITE NAME TABLE BEFORE BEING WRITTEN TO VRAM. THIS AIDS
641 * SPRITE MULTIPLEXING SOLUTIONS TO THE FIFTH SPRITE PROBLEM.
642 |
643 GLB RAND NUM
73C8 644 RAND WUM DEFS 2
645 * THIS IS THE SHIFT REGISTER USED BY THE RANDOM NUMBER GENERATOR.
646 * IT 1S INITIALIZED AT POWER-UP.
647 GLB PARAM,
648 PROG
0098 649 PARAM ,
0098 EIESESOA6F 650 HEX £1,£3,E5, 0A, 6F,03,0A,03,67,£3,05,5E, 23,56, 23,E5
OAS 7B82C28700 651 HEX 7B,B2,C2,B7,00,£1,5€,23,56,23,E5, EB, 5E,23,56, 03
0088 OAO7D2DA00 652 HEX 0A,07,D2,DA,00,03,€1,E3, 73,23, 72,23,01,E3, 2B, AF
00C8 BCC2D0008D 653 HEX BC,C2,D0,00,BD,CA,06,00,£3,£5,EB,C3,A3,00,£1,£8
00D8 ESESEIE3ES 654 HEX E3,€9,E1,E3,E5, OF 67,08, 0A, 6F,E3,03,03, 1A,77,23
OOE8 13E32BAFBD 655 HEX 13,€3,28,AF,80,C2,F4,00,8C,CA,F8,00,£3,C3,E5,00
OOF8 E1C3C400 «= «656 HEX £1,C3,C4,00
657 PROG
669 sEXT DECLSN ,MSNTOLSN,DECMSN ,ADD816
670 ;INCLUDE OSSR EQU:0S:0 ;equates
OOFF FEOO 674 ce 0 sSET 2 flag if FSTEP = 0
675 ; IF (PSW, 1S,ZERO) smote not to be swept
0101 2009 676 JR NZ,L20
0106 3D 678 DEC A sSET 2 flag if NLEN = 0
0107 C8 679 RET 2 sleave if note over with Z flag SET
0108 C9 681 RET sRET with 2 flag RESET [note not over)
0111 1600 687 LO 0,0
690 ; IF (PSW,1S, ZERO) :FPSV has timed out
0117 2015 691 JR WZ,L21
O11E 30 696 DEC A SET 2 flag if NLEN = 0
O11F C8 697 RET 2 jleave if sweep over with Z flag SET
0126 cD0181 703 CALL ADDB16 ;FREQ = FREQ + FSTEP
012A CB96 705 RES2, (HL) sRESET B2 in hi FREQ in case add caused >10 bit FREQ
712 ; IDENT ATNSWEE ;Includes ATN_SWEEP
713 oRRRAAAARAAEAKRARAAAEATERAKREK
714 :* ATN.SWEEP *
715 oRERARAERAAAARRERAERERARERES
716 ;.COMMENT )
717 ;See User's Manual for description
718 ;RETs 2 SET: if byte 8 is O [means sweep is over, or note was never swept)
719 ;RETs 2 RESET: if sweep in progress
720 ;)
721 GLB ATNSWEEP
722 sEXT DECLSN,DECMSN ,MSNTOLSN
723 ;INCLUDE OSSR_EQU:0S:0 ;equates
012F 724 ATN SWEEP
725 ; * RET with Z SET if byte 8 = 00
012F DD7E08 726 LD A,(1X+8) ;Check byte 8 for no sweep code
0132 FEOO 727 cp 0 sZ is set if byte 8 = 0
0134 C8 728 RET 2 leave if Z set, sweep not going
729 ; * sweep going, so dec APSV
0135 DOES 730 PUSH IX ;point HL to APSV
0137 €1 731 POP HL
0138 1600 732 to 0,0
O13A 1609 733 LO E,APSV
013C 19 734 ADD HL,DE
0130 CD0190 735 CALL DECLSN sdec APSV [LSN of byte 9]
736 ; IF (PSW, 1S,ZERO) sAPSV has timed out
0140 2021 737 JR NZ,L22
738 ; * dec ALEN to see if sweep over
0142 CDO1A6 739 CALL MSNTOLSN sreload APSV from APS
0145 28 740 DEC WL spoint to ALEN [# of steps in the sweep)
0146 €D0190 741 CALL DECLSN ;dec ALEN [LSN byte 8)
742 ; IF (PSW,1S,NZERO) ;sweep not over yet
0149 2816 743 JR 2,123
0148 7E 745 LDA, (HL) ;MSN A = ASTEP
014C E6FO 746 AND OFOH smask LSN
O14E 5F 747 LD E,A 7E = ASTEP | 0
O14F 2B 748 DEC HL point HL to ATN
0150 28 749 DEC HL
0151 28 750 DEC HL
0152 2B 751 DEC HL
0153 7E 752 LD A, (HL) sMSN A = ATN
0154 E6FO 753 AND OFOH ;A = ATN | O
0156 83 754 ADD A,E ;MSN A = [ASTEP + ATN] | 0
0157 5F 755 LD E,A ;E = [ASTEP + ATN) | 0
0158 7E 756 LD A, (HL) ;A = ATW | freq or CTRL
0159 E60F 157 AND OFH ;mask old ATIN A = 0 | freq or CTRL
015B B3 758 OR E sOR in new ATN
015C 77 759 LO (HL],A ;store updated value back into song data area
015D F6FF 760 OR OFFH ;RESET 2 flag, sweep not over yet
O1SF 1802 761 JR L22
762 ; ELSE ;2 flag is SET: sweep over
0161 3600 763 L23 LD {Hi} ,0 ;set byte 8 to 0 to indicate end sweep
764 ; ENDIF
765 ; ENDIF
0163 C9 766 122 RET
767 ; END ;ATNSWEE
770 ; - IDENT UTIL ;Includes UPATNCTRL ,UPFREQ,
771 ;DECLSM, DECHSN, MSNTOLSN ,ADD816, PT_IX_TO SxDATA,
772 ;LEAVE _EFFECT, AREA SONG. is
773 oRAVATRAARAAARUAARAARAAAAARARRE
775 :RERATARARARRAARARSEAARARAARE
776 COMMENT )
77 “Perform single byte update of the snd chip noise control register or any
778 ;attenuation register. IX is passed pointing to byte 0 of a song data area, MSN
779 sregister C = formatted channel attenuation code.
780 ;)
761 GLB UPATNCTRL
782 ; INCLUDE OSSR_EQU:0S:0 ;equates
0164 783 UPATWCTRL
0164 DD7E04 784 LD A, (IX*4) ;MSN A = ATN, LSN may be CTRL data
0167 CB61 785 BIT 4,C stest for ATN
786 ; IF (PSW,1S,NZERO) ;ATW is to be sent, move it to the LSN
0169 2804 787 JR 2,124 .
0168 OF 788 RRCA ;swap nibbles
016C OF 789 RRCA
0160 OF 790 RRCA
O16E OF 791 RRCA ;LSN A = ATN
792 ; ENDIF
O16F E60F 793 L264 AND OFH mask @Se
0171 Bi 79% OR C = formatted register# | ATM or CTRL
0172 O3FF 795 QUT [SOUND PORT) ,A -output ATW or CTRL data
0174 C9 796 RET
797 stenaeannehaanaNnewasansNane
798 ;* UPFREQ 7
T99 eRRRRKAEKARARAAARAARAKEARKEKE
800 ;.COMMENT >
801 ;Perform double byte update of a sound chip frequency register. IX is passed
802 ;pointing to byteO of a song data area, MSN register D = formatted channel
803 ;frequency code.
804 ;)
805 GLB UPFREQ
0175 806 UPFREQ
0175 DD7E03 807 LDA, (IX+FREQ) F2 F3 F4 FS F6 F7 FB FO
0178 E60F 808 AND OFH 0 0 O O F6 F7 FB F9
O17A B2 809 OR D formatted reg# | F6 F7 FB FO
0178 D3FF 810 QUT [SOUND PORT) ,A tput first freq byte
0170 007E03 811 LD A, (IX+FREQ) F2 F3 F4 F5 F6 F7 FB FO again
0180 E6FO 812 AND OFOH F2 F3 F464F5 0 0 O O
0182 57 813 LD D,A ;sa ae D
0183 DD7E04 814 LDA, (IX*FREQ+1) “LS =0 O FOF!
0186 E60F 815 AND OFH “A 7 000 0 O FO FI
0188 82 816 OR D cA = F2 F3 F4 FS O OFO F1
0189 OF 817 RRCA 78wap nibbles
O18A OF 818 RRCA
0188 OF 819 RRCA
018C OF 820 RRCA ;A = O OFO FI F2 F3 F4 FS
0180 D3FF 821 OUT [SOUND PORT) ,A ;output 2nd [most significant] freq byte
O18F C9 822 RET
823 oRRERKEKRAAARKANHRKRARKKRKKAKEKE
824 ; DECLSN *
B25 Sette eee deere eee
826 ;.COMMENT )
te »2E”eguoteBe euw@e@ou
827 ;Without affecting the MSN, decrement the LSN of the byte pointed to by HL. HL
828 ;remains the same.
829 ;RET with 2 flag set if dec LSN results in 0, reset otherwise.
830 ;RET with C flag set if dec LSN results in -1, reset otherwise.
831 ;)
832 GLB DECLSN
0190 3£00 833 DECLSN LD A,O
0192 E067 834 RRD ;A = 0 | LSW (HL)
| 0194 D601 835 SUB 1 ;Z flag set if dec to 0, C flag if dec to -1
0196 F5 836 PUSH AF ;save Z and C flags
| 0197 ED6F 837 RLO ; (HL) = old MSN | new LSN
| 0199 F1 838 POP AF ;restore 2 and C flags, A = 0 | new LSN
| 019A C9 839 RET
840 eeasanaanadsageaanagggaessns
841 ;* DECMSN *
842 oRRERRERRAEAAAARARAAREKEARAAEHARE
843 ;.COMMENT )
844 ;Without affecting the LSN, decrement the MSN of the byte pointed to by HL. HL
845 ;remains the same.
846 ;RET with 2 flag set if dec MSN results in 0, reset otherwise.
847 ;RET with C flag set if dec MSN results in -1, reset otherwise.
848 ;)
849 GLB DECMSN
0198 3E00 850 DECMSN LD A,0
0190 ED6F 851 RLD ;A = 0 | MSN (HL)
O19F 0601 852 sus 1 32 flag set if dec to 0, C flag set if dec -1
O1A1 F5 853 PUSH AF ;save 2 and C flags
O1A2 ED67 854 RRD ;(HL) = new MSN | old LSN
O1A4 FI 855 POP AF ;restore Z and C flags, A = 0 | new MSN
01A5 C9 856 RET
857 shathansaassagaseranseesnnss
858 ;* MSNTOLSN *
859 shenendnanaasedancaanessnaes
860 ;.COMMENT }
861 ;Copy MSN of the byte pointed to by HL to the LSN of that byte. HL remains
862 ;the same.
863 ;)
864 GLB MSNTOLSN
01A6 865 MSNTOLSN ,
O1A6 7E 866 LD A, (WL) ;A = MSN | LSN to be changed
O1A7 E6FO 867 AND OFOH ;A = MSN | 0
O1A9 47 868 LD 6,A save in B
O1AA OF 869 RRCA ;swap nibbles
O1AB OF 870 RRCA
O1AC OF 871 RRCA
O1AD OF 872 RRCA ;A = 0 | MSN
O1AE 80 873 OR B ;A = MSN |MSN
OIAF 77 874 LD (HL),A ;(HL) = MSN i MSN
0180 C9 875 RET
876 seadaneeeakanagegansansasans
877 ‘;* ADD816 * ‘
878 oREEKKARARRAAERAAKKKKKKEKEKKE
879 ;.COMMENT }
880 ;Adds 8 bit two's complement signed value passed inA to the 16 bit location
881 ;pointed to by HL.
882 ;)
883 GLB ADD816
0181 0600 884 ADD816 LD 8,0 ;set8 for positive value in A
0183 C87F 885 BIT 7,A :ifA ispositive
0185 2802 886 JR 2,POS ;skip
0187 O6FF 887 LO 8,OFFH ;A 1sneg: extend sign bit thru B
0189 86 888 POS ADDA, (HL) ;do8 bit add [and set Carry)
01BA 77 889 LD {WL),A ;Storeresult into LSB 16 bit number
0188 23 890 INC HL ;putMSB
018C 7E 891 LDA, (HL) sintoA
0180 &8 892 ADC A,B 7A= 4SB + Carry + B [B is 0 or FF)
018E 77 893 LD [WL],A store result into MSB
O1BF 2B 894 DEC WL ;re-point HL to LSB 16 bit number
01C0 C9 895 RET
896 atte ieheaieiarhatniaineriababmiiniintel
897 :* PT 1X TO SxDATA *
898 -eaaeeannteneentensenenenans
899 ;.COMMENT )
900 ;SONGNO passed in B.
901 ;Point IX to byte 0 inSONGNO's song data area.
902 ;RET with both DE and IX pointing to SxDATA,
903 ;HL pointing to MSB SXDATA entry in LST_OF SND ADORS.
904 ;)
905 GLB PT_IX_TO SxDATA
01C1 906 PT_1X_TOSxDATA
907 ; * IX & DE := addr of byte 0 in SONGNO’s song data area,
908 ; HL pointing to MSB SxXDATAentry in LST_OFSND ADDRS.
01C1 2A7020 909 LD WL,{PTR_TOLST OF SND_ADDRS) ;point HL to start LSTOF SND ADDRS
01C4 2B 910 DEC WL sinit HL for addition
01C5 2B 911 DEC HL
O1C6 48 912 tO C,8 sform 4 * SONGNO in C
01C7 0600 913 LD 8,0
01C9 CB01 914 RLC C
01cB CB01 915 RLC C
01CD 09 916 ADD HL,BC ;HL pts to SXDATA's entry in LST_OF SND _ADDRS
OICE 5E 917 LD E,CHL) ;move addr SxDATA to IX thru DE
O1CF 23 918 INC HL
0100 56 919 LD D(HL)
0101 05 920 PUSH DE
0102 ODE 921 POP IX
0104 C9 922 RET
923 ;
924 ; LEAVE EFFECT
925 34/19/82
926 ;
927 eAORORERERSEHESSENAHERSENATE
928 ;* LEAVE EFFECT *
929 -se#eaanaakanshantannareranne
930 ;COMMENT )
931 ;LEAVEEFFECT, called by a special sound effect routine when it's finished,
932 ;restores the SONGNO of the song to which the effect note belongs to B5 - BO of
933 sbyte 0 in the effect's data area, and loads bytes 1 and 2 with the address of
934 ;the next note in the song. The address of the 1 byte SONGNO (saved by the
935 seffect when first cailed) is passed in DE. The 2 byte address of the next note
936 ;in the song, also saved by the effect, is passed in HL. IX is assumed to be
937 ;pointing to byte 0 of the data area to which the song number is to be restored.
938 ;Bits 7 and 6 of the saved SONGNO are ignored, and therefore may be used by the
939 ;effect to store flag information during the course of the note.
240 ;)
4
941 GLB LEAVEEFFECT
0105 942 LEAVEEFFECT
0105 0D7501 943 LD (IX¢1),L ;LSB NEXTNOTE PTR := LSB addr next note in song
0108 007402 944 LO [IX*2),W “MSB NEXTNOTE PTR := MSB addr next note in song
0108 1A 945 LD A,(DE) “A s= x xSONGNO (i.e., the saved, original SONGNO)
010C E63F 946 AND O3FW sA :=0 0 SONGNO
O1DE 47 947 LO B,A 3B :=0 0 SONGNO (B now = original SONGNO)
01DF 0D7E00 948 LD A,(1X+0) cA :=CH# | 62 (all effect notes have SONGNO = 62)
01€2 E6CO 949 AND OCOH sA :=CHA 000000
O1E4 80 950 OR B 7A :=CH# |SONGNO
01€5 007700 951 LD [I1X+0),A srestore the song number
O1E8 C9 952 RET
953 |
954 sanaahsanansnabeaneneragases
955 ;* AREA_SONGIS *
956 shhaansaganasaananeaneasesen
957 ;.COMMENT )
958 ;The address of byte 0 of a song data area is passed in IX. The song number of
959 ;the song using that area is returned in A [OFFH if inactive). If a special
960 ;effect was using that area, 62 is returned in A and WL is returned with the
961 ;address of the special sound effect routine.
962 ;)
963 GLB AREA_SONG_IS
O1E9 964 AREASONG 1S
01E9 DD7E00 965 LDA, (1X+0) 3A := CH# | SONGNO or 62, or A := FF
O1EC FEFF 966 CP OFFH
O1EE C8 967 RET 2 sleave with A = FF if area inactive
O1EF E63F 968 AND 001111118 smask CH#
O1F1 FE3E 969 CP 62
01F3 CO 970 RET WZ leave with A = SONGNO if not a special effect (62)
971 ; special effect, so set HL to addr effect, stored in bytes 1&2
01F4 DDES 972 PUSH IX z;pointHL to byte 1
01F6 E1 973 POP WL
O1F7 23 974 INC HL
O1F8 SE 975 LOE, (HL) ssave LSB effect addr inE
O1F9 23 976 INC WL sHL to byte 2
O1FA 56 977 LDD, (HL) s;saveMSB effect addr in D
O1FB EB 978 EX DE,HL sHL := addr special effect
O1FC C9 979 RET
980; END ;UTIL
981 "PROG
983 ; IDENT INITSOU ;includes INISOUND, ALL OFF
984 eatraat hetactaatintmaatatininiiiaaiaataiaeel
985 ;* INITSOUND *
986 éRESARARaRakakenakeneantakee
987 ;.COMMENT }
988 ;See Users’ Manual for description; includesENTRY POINT ALL_OFF
989 ;addr LSTOF SND ADDORS passed in WL
990 ;n = # of song data areas to init, passed iB
991 -)
992 GLB INITSOUND,ALL OFF ,DUMAREA
993 ;INCLUDE OSSREU: os -equates
994 ; ‘*®® Sound chip register code EQUATES
995 ; Tone generator frequency and attenuation formatted register codes
<0080> 996 SRIFRQ EQU 100000008 ;BIT7 = 1, BIT6-4 = TONE GEN 1 FREQ CODE
997 SRIATN EQU 100100008 “BIT7 =1, BIT6-4 = TOWE GEN 1 ATIN CODE
<QO0A0> 998 SR2FRQ EQU 101000008 “BIT7 = 1, BIT6-4 = TOWE GEN 2 FREQ CODE
<0080> 999 SR2ATN EQU 101100008 sBIT7 = 1, BIT6-4 = TONE GEN 2 ATTN CODE
<00C0> 1000 SR3FRQ EQU 110000008 ;BIT7 = 1, BIT6-4 = TONE GEN 3 FREQ CODE
<0000> 1001 SR3ATN EQU 110100008 ;BIT7 = 1, BIT6-4 = TONE GEN 1 ATTN CODE
1002 ; Noise generator control and attenuation formatted register codes
<00E0> 1003 SRNCTL EQuU111000008 sBIT7 = 1, BIT6-4 = MOISE GEN CONTROL CODE
<00F0> 1004 SRNATN EQU 111100008 sBIT7 = 1, BIT6-4 = NOISE GEN ATTN CODE
1005
1006 * PROCEDURE INITSOUNDQ (AREA_COUNT:BYTE;LISTOF ADDR: INTEGER)
1007
1008 * THIS IS THE PASCAL ENTRY POINT TO INITSOUND
1009
1010 7EXT PARAM
1011 GLB INITSOUNDQ
01FD 00020001 1012 INITSOUND PAR: DEFW 2,1,2
1013
1014; COMM
1015 =IMIT_SOUNDDATA: DEFS 3 ;Moved to OS
1016.
1017 PROG
0203 1018 INITSOUNDQ:
0203 0101FD 1019 LD BC,INITSOUND PAR
0206 1173BA 1020 LD DE,INITSOUND DATA
0209 C0098 1021 CALL PARAM
020C 3A738A 1022 LD =A,CINIT SOUND DATA)
O20F 47 1023 LD =B,A
0210 2A7388 1024 LD =oWL,(INITSOUND DATA+1)
1025
0213 1026 INITSOUND
1027 ; * initialize PTR TO LST OF SNDADDRS with value passed in HL
0213 227020 1028 LD [PTR_TO LSTOF SND ADORS) ,HL
1029 ; * store inactive code at byte 0 of each of the n data areas [B = n)
0216 23 1030 INC HL ;pt WL to song 1 data area entry in LST_OF SNDADDRS
0217 23 1031 INC HL
0218 5€ 1032 LO €,(HL) ;pt DE to byte 0 in first song data area
0219 23 1033 INC WL
O21A 56 1034 LDD, (HL)
0218 £8 1035 EX DE,HL ;pt HL to byte 0 in first song dataarea
021C 1E0A 1036 LD £,10 ;set DE for 10 byte increment
021E 1600 1037 iD 0,0
0220 36FF 1038 BI: LO (HL),OFFH ;deactivate area
0222 19 1039 ADD HL,DE spt HL to byte 0 next area (10 bytes away)
0223 10FB 1040 DJNZ BI ;do this for the n (passed in B) data areas
1041 ; * store end of data area code (0) at first byte after last song data area
0225 3600 1042 LO (HL),0 sstore end of data area code in byte 0 data area n+ 1
1043 ; * set the 4 channel data area pointers to a dummy, inactive data area
0227 21024C 1044 LD WL ,OUMAREA spoint HL to inactive byte below [after the RET)
022A 227022 1045 LD (PTR. TO. S OW 0),HL ;store addr DUMAREA at PTR_TO S ON 0
022D 227024 1046 LD (PTR_ TO SON 1)},HL ;store addr DUMAREA at PTR 10S ON 4
0230 227026 1047 LD [PTR TO S ON 2),HL ;store addr DUMAREA at PTR TO S OW 2
0233 227028 1048 LO (PTR_ TO" SON 3),HL ;store addr DUMAREA at PTR_TOos ON 3
1049 ; * initialize SAVE “CTRL
0236 3EFF 1050 LD A,OFFH snote: this is only time MSN SAVE CTRL will be non zero,
0238 32702A 1051 LD {(SAVE_CTRL),A sthus ensuring PLAY SONGS will output ist real CTRL data
0238 1052 ALL_OFF
1053 ; * turn off all 4 sound generators
0238 3E9F 1054 LD A,OFF*¢SRIATN 3form off code for tone generator 1
0230 OSFF 1055 OUT [SOUND _PORT) ,A ssend it out
O23F 3EBF 1056 LD A,OFF+SR2ATN sform off code for tone generator 2
0241 D3FF 1057 OUT [SOUND _PORT),A ssend it out
0243 3EDF 1058 LD A,OFF+SR3ATN ;form off code for tone generator 3
0245 D3FF 1059 OUT [SOUND PORT), A ;send it out
0247 SEFF 1060 LD A,OFF+SRNATN sform off code for noise generator, N
0249 D3FF 1061 QUT [SOUND PORT) ,A ssend it out
0248 C9 1062 RET
O024C FF 1063 DUMAREA DEFB INACTIVE
1064 ; ENO ;INITSOU
1065 PROG
1067 ; -IDENT JUKEBOX includes JUKE BOX