-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathkpl14.s
2461 lines (2076 loc) · 41.9 KB
/
kpl14.s
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
;APS0000422E000000000000000000000000000000000000000000000000000000000000000000000000
incdir include:
include exec/exec_lib.i
include exec/interrupts.i
include hardware/intbits.i
include hardware/cia.i
include resources/cia_lib.i
include exec/ports.i
include mucro.i
;incdir
_ciaa = $bfe001
_ciab = $bfd000
CHM = 0 * 1: käännetään channelmask-homma mukaan
fast = 1 * 0: ei fastram rutiinia
dmawait set 1 * 1: isot dmawaitit, toimii esim super72 jne,
* 0: tavalliset, 6+3 tms
dmwait set dmawait|fast
*******************************************************************************
* KPlayer v33 --- 31.3.1996 © by K-P Koljonen *
*******************************************************************************
* A flexible and fast ProTracker-module player.
* All commands excluding E4 and E7 are supported.
*
* k_init
*
* Initialize everything necessary (no audiochannel allocating), convert
* patterndata to KPlayer format.
* A0 <= 2000 bytes buffer (for variables etc.)
* A1 <= Protracker/Noisetracker/Stattrekker module, 64 or 100 patterns
* D0.b <= Starting position
* D1.b <= 0: user, 1: automatic cia
* D2.b <= Flags, bit 0: tempo, bit 1: fast ram play
* D0 => 0: OK, -1: Couldn't allocate CIA timer or invalid module.
*
* k_music
*
* In modes 0 and 1 call this every frame to play the music.
*
* k_end
*
* Stop the audio DMA and interrupts.
* D0.w => Stopping position
*
* k_channelmask
*
* D0.b <= Channelmask. Set bit = channel enabled,
* bit 0 = channel 0 ... bit 3 = channel 3.
* Disabled channel of the module will be totally ignored and no
* audio registers will be changed.
*
* k_playstop
*
* D0.b <= 0: Play, non-0: don't play
*
* k_setmaster
*
* Set the mastervolume of the music (default max=64).
* D0.b <= Mastervolume
*
* k_clear
*
* Stop audio DMA.
*
* Timing modes
*
* 0 - system friendly, no tempo, no interrupts, DMA wait
* 1 - no tempo, CIAB timer B interrupt
* 2 - tempo, CIAB timers A and B
* 3 - system friendly, tempo, CIAA timer A or B interrupt, DMA wait
*
* k_base
*
* k_base is the data area for KPlayer where all the variables
* needed for playing one module is located.
*
* Speed
*
* Rastertime usage with most modules is between 2 and 7 lines on 68000
* Amigas. In addition to these lines, modes 0 and 3 use a DMA wait of 7+3
* lines.
* Setting the mastervolume to maximum (64) will gain some speed (no need
* to scale volumes).
* Fast ram player uses about 15% cpu on A500.
*
* Usertrig
*
* It's possible to use the information in k_base to make quadrascopes etc.
* The byte k_usertrig (k_base+k_usertrig) has four bits (0-3) for every
* channel. At the same time as one of these bits sets, a new sample
* in the respective channel starts to play. You should clear k_usertrig after
* you've read it.
* Samplestarts, volumes, periods, etc. can be found by examining the
* k_base structure below.
*
* KPlayer by: K-P Koljonen
* Torikatu 31
* 40900 Säynätsalo
* Finland
*
*
*******************************************************************************
rsreset * Routine offsets, kplayer+kp_????
kp_init rs.l 1
kp_music rs.l 1
kp_end rs.l 1
kp_setmaster rs.l 1
kp_channelmask rs.l 1
kp_playstop rs.l 1
kp_clear rs.l 1
kp_baseaddress rs.l 1 * This is where the k_base addr is stored.
* channel data blocks
rsreset
n_data rs.l 1
n_start rs.l 1 * Sample start address
n_length rs 1 * Sample length (words)
n_volume rs 1 * Volume
n_periodaddr rs.l 1
n_loopstart rs.l 1 * Loopstart
n_replen rs 1 * Looplength
n_wavestart rs.l 1
n_period rs 1 * Period
n_dmabit rs 1
n_toneportspeed rs 1
n_wantedperiod rs 1
n_pattpos rs 1
n_period2 rs 1
n_tempvol rs 1
n_sampleoffset rs 1
n_vibratopos rs.b 1
n_tremolopos rs.b 1
n_toneportdirec rs.b 1
n_vibratocmd rs.b 1
n_tremolocmd rs.b 1
n_loopcount rs.b 1
n_funkoffset rs.b 1
n_funkspeed rs.b 1
n_retrig rs.b 1
n_glisscontrol rs.b 1
n_flag rs 1
n_buffer rs.l 1 * chip buffer (1kb)
n_datapointer rs.l 1
n_datalength rs.l 1
n_datarepointer rs.l 1
n_datarelength rs.l 1
n_sizeof rs.b 0 * channel temp size
* variables & data
rsreset
k_counter rs.b 1
k_speed rs.b 1
k_posjumpflag rs.b 1
k_pbreakflag rs.b 1
k_pattdeltime rs.b 1
k_pattdeltime2 rs.b 1
k_songpos rs 1 * Song position
k_pbreakpos rs 1
k_patternpos rs 1 * Patternposition
k_dma rs 1
k_mastervolume rs 1
k_songdataptr rs.l 1
k_fast rs.b 1 * <>0: samplet fastissa
k_timingmode rs.b 1
k_filterstore rs.b 1
k_trig rs.b 1
k_tempo rs.b 1
k_usetempo rs.b 1 * ~0: ei tempoa
k_usertrig rs.b 1 * User trigger
k_sysint rs.b 1
k_playmusic rs.b 1 * 0 = play
k_songover rs.b 1 * Song played n times
k_chmask rs.b 1 * Kanavamaski
k_intid rs.b 1
k_whichtimer rs.b 1
rs.b 1
k_timerhi rs.b 1
k_timerlo rs.b 1
k_timervalue rs.l 1
k_ciabase rs.l 1 * cia?.resource base
k_cia rs.l 1 * ciab tai ciaa osoite
k_null rs.l 1
k_oldis1 rs.l 1
k_oldis2 rs.l 1
k_oldis3 rs.l 1
k_oldis4 rs.l 1
k_mt rs.l 31 * Sampleaddresses
k_chan1temp rs.b n_sizeof * Channel data blocks
k_chan2temp rs.b n_sizeof
k_chan3temp rs.b n_sizeof
k_chan4temp rs.b n_sizeof
k_roundtable rs.b 1512
k_sizeof rs.b 0 * size of k_base
ifnd __VASM
main
; move $dff01c,-(sp)
; move #$7fff,$dff09a
lea k_base,a0
lea module,a1
moveq #0,d0
moveq #0,d1 * Mode
moveq #0,d1 * Mode
; moveq #%11,d2 * flags, fastramyes, tempoyes
; moveq #%01,d2 * flags, tempoyes
bsr.b kplayer+kp_init
tst.l d0
bne.b .error
ifne CHM
moveq #%0001,d0
bsr kplayer+kp_channelmask
endc
moveq #$3f,d0
bsr.b kplayer+kp_setmaster
.loop
.1 cmp.b #$60,$dff006
bne.b .1
.2 cmp.b #$60,$dff006
beq.b .2
tst.b k_base+k_timingmode
bne.b .rr
; move #$ff0,$dff180
bsr.w k_music
; clr $dff180
.rr
btst #6,$bfe001 * left
bne.b .loop
bsr.b kplayer+kp_end
.error rts
endif
*******************************************************************************
* sample
rsreset
s_start rs.l 1
s_length rs 1
s_volume rs 1
s_periodaddr rs.l 1 * s_finetune käytännössä
s_loopstart rs.l 1
s_replen rs 1
s_wavestart rs.l 1
* note
d_command = 0
d_period = 2
d_samplenum = 3
* orig. sampleinfo
ss_length = 42-42
ss_finetune = 44-42
ss_volume = 45-42
ss_repeat = 46-42
ss_replen = 48-42
binstart
kplayer
bra.b k_init
rts
bra.w k_music
bra.w k_end
bra.w k_setmaster
ifne CHM
bra.w k_channelmask
else
rts
rts
endc
bra.w k_playstop
bra.w k_clear
k_baseaddr dc.l 0 * k_base's address
k_intname
dc.b " KPlayer v33 © 31.3.1996 by K-P Koljonen",0
k_cianame dc.b "ciaa.resource",0
even
***********************
* Init
***********************
k_init cmp.l #'M.K.',1080(a1)
beq.b k_valid
cmp.l #'M!K!',1080(a1)
beq.b k_valid
cmp.l #'FLT4',1080(a1)
beq.b k_valid
moveq #-1,d0
rts
k_valid movem.l d1-a6,-(sp)
lea k_baseaddr(pc),a5
move.l a0,(a5)
move.l a0,a5
move #k_sizeof/2-1,d7 * tyhjätään muuttujatila
k_c clr (a0)+
dbf d7,k_c
move.l a1,a4
move.b d0,k_songpos+1(a5)
move.b d1,k_timingmode(a5)
move.b #%1111,k_chmask(a5)
ror.b #1,d2
spl k_usetempo(a5)
ifne fast
ror.b #1,d2
smi k_fast(a5)
bpl.b .chip
pushm all
move.l 4.w,a6
move.l #1024,d0
moveq #2,d1 * MEMF_CHIP
move.l #$10002,d1 * MEMF_CHIP!MEMF_CLEAR
lob AllocMem
move.l d0,a0
move.l a0,n_buffer+k_chan1temp(a5)
lea 256(a0),a0
move.l a0,n_buffer+k_chan2temp(a5)
lea 256(a0),a0
move.l a0,n_buffer+k_chan3temp(a5)
lea 256(a0),a0
move.l a0,n_buffer+k_chan4temp(a5)
popm all
.chip
endc
move #1,k_chan1temp+n_dmabit(a5)
move #2,k_chan2temp+n_dmabit(a5)
move #4,k_chan3temp+n_dmabit(a5)
move #8,k_chan4temp+n_dmabit(a5)
move.b #6,k_speed(a5) * nopeus: 6
move.b #4,(a5) * laskuri: 4
move #$40,k_mastervolume(a5) * päävolume: 64
move.b #125,k_tempo(a5) * tempo: 125
lea k_mt(a5),a3 * sampleinfo lista
moveq #31-1,d0
lea 20(a4),a2
k_mkm move.l a2,(a3)+
lea 30(a2),a2
dbf d0,k_mkm
lea 952(a1),a0 * tutkitaan patternien määrä
moveq #128-1,d0
moveq #0,d1
k_lop1
move.b (a0)+,d2
cmp.b d2,d1
bhi.b k_lop2
move.b d2,d1
k_lop2
dbf d0,k_lop1
addq #1,d1
mulu #1024,d1 * Eka sample patternien jälkeen
lea 1084(a4),a0
add.l d1,a0
lea 42(a4),a2
clr.l (a4) * moduulin alkuun tyhjä longwordi!
move.l a4,k_null(a5)
lea 20(a4),a1 * vetästään samplennimien päälle
lea k_pertab(pc),a3
move.l a3,d5
move.l a0,d7
moveq #0,d4
moveq #31-1,d0
k_lop3 * Tehdään omat sampleinfo (alkup.nimien päälle)
** Versio 3 (toimii, ehkä)
move.l a0,s_start(a1)
moveq #0,d1
move (a2),d1 * onk
cmp #2,d1 * joku raja pitää vetää: ei alle 4b sampleja
bhs.b k_nonol
move #1,ss_replen(a2) * To
move #1,s_length(a1) * Pi
move.l a0,-(sp)
move.l a4,a0 * nullsample
bsr.b k_noe
move.l (sp)+,a0
bra.b k_nil
k_nonol move d1,s_length(a1)
clr (a0)
bsr.b k_noe
k_nil dbf d0,k_lop3
bra.b k_konmo
k_noe
move.l d1,d4
add.l d4,d4
moveq #%1111,d1
and.b ss_finetune(a2),d1
add d1,d1
move.l d1,a3
add.l d5,a3
add (a3),a3
move.l a3,s_periodaddr(a1)
move.b ss_volume(a2),d1
move d1,s_volume(a1)
move ss_repeat(a2),d1
beq.b k_norep
moveq #0,d3
move d1,d3
add.l d3,d3
move.l a0,d2
add.l d3,d2
move.l d2,s_loopstart(a1)
move.l d2,s_wavestart(a1)
move ss_replen(a2),d2
add d2,d1
move d1,s_length(a1)
move d2,s_replen(a1)
bra.b k_wasrep
k_norep
move.l a0,s_loopstart(a1)
move.l a0,s_wavestart(a1)
move ss_replen(a2),s_replen(a1)
bne.b .ye
move #1,s_replen(a1) * Vähintään 1!!
.ye
k_wasrep
k_dud add.l d4,a0
lea 30(a1),a1
lea 30(a2),a2
rts
k_konmo
lea 1084(a4),a3
lea 952(a4),a4
move.l a4,k_songdataptr(a5)
subq.l #1,a4
moveq #'K',d0
cmp.b (a4),d0
beq.w k_what * moduuli kertaalleen convertattu
move.b d0,(a4) * tunniste
* tehdään perioidien pyöristystaulukko
moveq #36-1,d2
lea k_pt2(pc),a0
lea k_roundtable(a5),a1
moveq #100,d0
.eee move -(a0),d1
.ee cmp d0,d1
beq.b .e
move d1,(a1)+
addq #1,d0
bra.b .ee
.e dbf d2,.eee
move.l d7,a4 * patterndatan loppu
move #$fff,d6
lea k_periodtable(pc),a1
lea k_roundtable(a5),a2
k_conv * Käännetään KPlayer-muotoon
move (a3),d0
and d6,d0
beq.b k_nope
sub #100,d0 * (pyöristetty) perioidi taulukosta
add d0,d0
move -3*2(a2,d0),d0
* max=907-108
; cmp #907,d0 * onko period sallituissa rajoissa?
; bhi.b k_nope
; cmp #108,d0
; blo.b k_nope
* 36 nuottia
moveq #36-1,d2
move.l a1,a0
moveq #1,d1
k_findit
cmp (a0)+,d0
beq.b k_wasi
addq #2,d1
dbf d2,k_findit
k_nope
moveq #0,d1 * ei perioidia
k_wasi
moveq #$10,d3 * samplenum=4+1 bittiä
and.b (a3),d3
move.b 2(a3),d4
lsr.b #4,d4
or.b d4,d3 * samplenumero
lsl.b #2,d3 * kertaa 4
move 2(a3),d4
and d6,d4 * command
move d4,d5 * patternbreak
and #$0f00,d5
cmp #$0d00,d5
bne.b k_grr
move d4,d5 * muutetaan patternbreak (D00)
and #$f0,d5
lsr #4,d5
mulu #10,d5
and #$f0f,d4
add d5,d4
k_grr
cmp #$0ED0,d4 * Onko notedelay ilman delayta?
bne.b .gr * Poistetaan sellaiset.
moveq #0,d4
.gr
ror #8,d4
lsl.b #2,d4 * kerrotaan komento neljällä
rol #8,d4
move d4,(a3)+
move.b d1,(a3)+
move.b d3,(a3)+
cmp.l a4,a3
blo.b k_conv
k_what
bsr.w k_foff * filtteri pois ja ent.asento talteen
sne k_filterstore(a5)
bsr.w k_clear
st k_whichtimer(a5)
moveq #0,d0
cmp.b #1,k_timingmode(a5)
beq.b .ff
bsr.b k_moodi
bra.b .fe
.ff bsr.b k_imode3
.fe tst.l d0
x movem.l (sp)+,d1-a6
rts
k_moodi
st k_usetempo(a5) * tempo pois
ifne fast
bsr.w k_fastinit
endc
moveq #0,d0
rts
k_imode3
lea softint(pC),a0
lea intserver(pC),a1
pea k_softkiller1(pc)
move.l (sp)+,IS_CODE(a0)
pea k_intname(pc)
move.l (sp),LN_NAME(a0)
move.l (sp)+,LN_NAME(a1)
pea k_killer3(pc)
move.l (sp)+,IS_CODE(a1)
pea softint(pc)
move.l (sp)+,IS_DATA(a1)
lea dummyserver(pc),a0
pea dummy(pc)
move.l (sp)+,IS_CODE(a0)
bsr.w k_timerval
* käytetään CIAA timeriä.
lea _ciaa,a3
moveq #0,d6
lea k_cianame(pc),a1
move.b #'a',3(a1)
moveq #0,d0
move.l 4.w,a6
move.l a6,exeksi-k_cianame(a1)
lob OpenResource
move.l d0,k_ciabase(a5)
beq.b .se
move.l d0,a6
lea intserver(pc),a1
move.l d6,d0
lob AddICRVector
tst.l d0
beq.b k_gottimer * Saatiinko?
lea intserver(pc),a1
moveq #1,d6 * timer b
move.l d6,d0
lob AddICRVector
tst.l d0
beq.b k_gottimer
.se
** kokeillaan ciab:tä
lea _ciab,a3
moveq #0,d6
lea k_cianame(pc),a1
move.b #'b',3(a1)
moveq #0,d0
move.l 4.w,a6
lob OpenResource
move.l d0,k_ciabase(a5)
beq.b k_err
move.l d0,a6
lea intserver(pc),a1
move.l d6,d0 * timer a
lob AddICRVector
tst.l d0
beq.b k_gottimer * Saatiinko?
lea intserver(pc),a1
moveq #1,d6 * timer b
move.l d6,d0
lob AddICRVector
tst.l d0
beq.b k_gottimer
k_err moveq #-1,d0 * ERROR! Ei saatu varattua timeriä.
rts
k_gottimer
move.b d6,k_whichtimer(a5)
move.l a3,k_cia(a5)
lea ciatalo(a3),a2
tst.b d6
beq.b .timera
lea ciatblo(a3),a2
.timera
move.b k_timerlo(a5),(a2)
move.b k_timerhi(a5),$100(a2)
ifne fast
bsr.b k_fastinit
endc
lea ciacra(a3),a2
tst.b d6
beq.b .tima
lea ciacrb(a3),a2
.tima
move.b #%00010001,(a2) * Continuous, start
k_eiks
rts
k_timerval * Tutkii ajastimen
move.l #1773447,d0 * Pal, NTSC=1789773
move.l 4.w,a0
cmp.b #50,531(a0) * PowerSupplyFrequency
beq.b k_waspal
; move.l #1789773,d0 * NTSC
move #$4f4d,d0
k_waspal
move.l d0,k_timervalue(a5)
divu #125,d0
move d0,k_timerhi(a5)
rts
ifne fast
k_fastinit
tst.b k_fast(a5)
bne.b .f
rts
.f pushm all
bsr.w k_clear
lea $dff000,a3
move.l #$07800780,$9a(a3)
moveq #128/2,d0
move d0,$a4(a3) * len
move d0,$b4(a3)
move d0,$c4(a3)
move d0,$d4(a3)
move.l 4.w,a6
moveq #INTB_AUD0,d0
lea audi0(pc),a1
move.l a5,IS_DATA(a1)
pea audi0r(pc)
move.l (sp)+,IS_CODE(a1)
lob SetIntVector
move.l d0,k_oldis1(a5)
moveq #INTB_AUD1,d0
lea audi1(pc),a1
move.l a5,IS_DATA(a1)
pea audi1r(pc)
move.l (sp)+,IS_CODE(a1)
lob SetIntVector
move.l d0,k_oldis2(a5)
moveq #INTB_AUD2,d0
lea audi2(pc),a1
move.l a5,IS_DATA(a1)
pea audi2r(pc)
move.l (sp)+,IS_CODE(a1)
lob SetIntVector
move.l d0,k_oldis3(a5)
moveq #INTB_AUD3,d0
lea audi3(pc),a1
move.l a5,IS_DATA(a1)
pea audi3r(pc)
move.l (sp)+,IS_CODE(a1)
lob SetIntVector
move.l d0,k_oldis4(a5)
popm all
rts
endc
* d1 = rasterlines to wait
waitti
pushm d0/d1
.d move.b 6(a6),d0
.k cmp.b 6(a6),d0
beq.b .k
dbf d1,.d
popm d0/d1
rts
; pushm d1/d6/d7/a1
; lea.l 6+1(a6),a1
; move.b (a1),d7
; and.b #$f0,d7
;.loop1 move.b (a1),d6
; and.b #$f0,d6
; cmp.b d7,d6
; beq.s .loop1
;.loop2 move.b (a1),d6
; and.b #$f0,d6
; cmp.b d7,d6
; bne.s .loop2
; dbf d1,.loop1
; popm d1/d6/d7/a1
; rts
; pushm d1/a0
; lea.l $bfe001,a0
;.e rept 23
; tst.b (a0)
; endr
; dbf d1,.e
; popm d1/a0
; rts
dummyserver
dc.l 0,0
dc.b 2,0
dc.l 0
dc.l 0
dc.l 0
softint
dc.l 0,0
dc.b 2,0
dc.l 0
dc.l 0
dc.l 0
intserver
dc.l 0,0
dc.b 2,0
dc.l 0
dc.l 0
dc.l 0
dummy
moveq #0,d0
rts
ifne fast
audi0 dc.l 0,0
dc.b 2,100
dc.l 0
dc.l 0
dc.l 0
audi1 dc.l 0,0
dc.b 2,100
dc.l 0
dc.l 0
dc.l 0
audi2 dc.l 0,0
dc.b 2,100
dc.l 0
dc.l 0
dc.l 0
audi3 dc.l 0,0
dc.b 2,100
dc.l 0
dc.l 0
dc.l 0
* a1 = is_data = k_base
* a0 = $dff000
audi0r
pushm a2/a3
lea k_chan1temp(a1),a1
lea $a0(a0),a0
bsr.b dof
popm a2/a3
move #INTF_AUD0,$9c-$a0(a0)
moveq #0,d0
rts
audi1r
pushm a2/a3
lea k_chan2temp(a1),a1
lea $b0(a0),a0
bsr.b dof
popm a2/a3
move #INTF_AUD1,$9c-$b0(a0)
moveq #0,d0
rts
audi2r
pushm a2/a3
lea k_chan3temp(a1),a1
lea $c0(a0),a0
bsr.b dof
popm a2/a3
move #INTF_AUD2,$9c-$c0(a0)
moveq #0,d0
rts
audi3r
pushm a2/a3
lea k_chan4temp(a1),a1
lea $d0(a0),a0
bsr.b dof
popm a2/a3
move #INTF_AUD3,$9c-$d0(a0)
moveq #0,d0
rts
*** Kopioidaan chip-puskuriin
dof
move.l n_buffer(a1),a2
not.b n_flag(a1)
beq.b .oer
lea 128(a2),a2
.oer
move.l a2,(a0)
copys
move.l n_datapointer(a1),a3
move n_datalength(a1),d0
cmp #128/2,d0
bhi.b .big
cmp #1,d0
bhi.b .med
cmp #1,n_datarelength(a1)
bls.b .small
.med
; moveq #128/2-1,d1
;.copy move (a3)+,(a2)+
; subq #1,d0
; bne.b .ok
; move.l n_datarepointer(a1),a3
; move n_datarelength(a1),d0
;.ok dbf d1,.copy
;
;.ex move d0,n_datalength(a1)
; move.l a3,n_datapointer(a1)
; rts
moveq #128/2-1,d1
.copy move (a3)+,(a2)+
subq #1,d0
dbeq d1,.copy
tst d1
bmi.b .ex
move.l n_datarepointer(a1),a3
move n_datarelength(a1),d0
dbf d1,.copy
.ex move d0,n_datalength(a1)
move.l a3,n_datapointer(a1)
rts
.big
rept 32
move.l (a3)+,(a2)+
endr
sub #128/2,d0
bra.b .ex
*** 2 byten loopit
.small
moveq #0,d1
rept 32
move.l d1,(a2)+
endr
bra.w .ex
endc
**************
* Keskeytykset
***************
;k_killer4b
; not.b k_intid(a5)
; beq.b k_repe2
; bsr.b k_repe1
; move.b #%00011001,$bfdf00 * Timer B, one shot
; rts
* Systeemi-keskeytykset
k_softkiller1
; move #$ff0,$dff180
bsr.w k_music
; clr $dff180
moveq #0,d0
rts
* toimis muuten muttei CDTV:ssä.
;k_killer3
;k_killer5
; lob Cause
; moveq #0,d0