home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 3 #11
/
Commodore_Disk_User_Vol.3_11_1990_-.d64
/
sampleplayer.asm
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
4KB
|
181 lines
1000 *=$c300
1010 ! --------------------------------
1020 ! c64 sample kit - sample player
1030 ! source file for mikro & 6510+.
1040 !
1050 ! written by ian (NULL)ffe 1990
1060 ! for commodore disk user.
1070 !
1080 ! memory requirements:-
1090 !
1100 ! sample:- $2000-$a000
1110 ! split data:- $c000-$c100
1120 ! tune:- $c100-$c300
1130 !
1140 !
1150 !
1160 sample=$2000
1170 splits=$c000
1180 tune=$c100
1190 !
1200 zero1=$fb
1210 !
1220 ! --------------------------------
1230 ! object code len:- $c5(197) bytes
1240 ! --------------------------------
1250 !
1260 lda #0
1270 sta 53280
1280 sta 53281 ! screen->black
1290 !
1300 sei ! disable for speed
1310 lda $d011
1320 and #%11101111
1330 sta $d011 ! blank screen
1340 jsr clearsid ! clear sound chip
1350 jsr playseq ! main player
1360 lda $d011
1370 ora #%00010000
1380 sta $d011 ! restore screen
1390 cli ! interrupts back on
1400 rts
1410 !
1420 !
1430 ! --------------------------
1440 clearsid ! clear sound chip
1450 ldx #0
1460 txa
1470 lp1 sta $d400,x
1480 inx
1490 cpx #24
1500 bne lp1
1510 rts
1520 ! --------------------------
1530 !
1540 !
1550 ! --------------------------
1560 ! play a single sample split.
1570 ! 'start' holds start hi byte.
1580 ! of the sample data.
1590 ! 'last' holds the end-hi byte
1600 ! address of the sample.
1610 ! --------------------------
1620 playasample ldx #0
1630 ldy start
1640 stx zero1
1650 sty zero1+1
1660 ldy #0
1670 play ! ! loop a page of data
1680 lda (zero1),y ! get sample byte
1690 lsr a ! get desired nibble
1700 lsr a
1710 lsr a
1720 lsr a
1730 sta $d418 ! output as volume
1740 ldx speed ! delay between bytes
1750 del2 dex
1760 bne del2
1770 iny ! next byte in page
1780 bne play
1790 inc zero1+1 ! add 256 (hi byte+1)
1800 lda zero1+1 ! to read next page
1810 cmp last ! check for last page
1820 bne play
1830 rts
1840 !
1850 start byt <sample
1860 last byt $a0
1870 speed byt 09
1880 !
1890 ! --------------------------------
1900 ! main player to play a "tune"
1910 ! of samples.
1920 ! --------------------------------
1930 playseq !
1940 ldx #0
1950 stx inseq
1960 rds !
1970 ldy tune,x ! read sample # to y
1980 !
1990 ! ------> check for flags
2000 !
2010 cpy #131 ! 131=exit/end
2020 beq exitseq
2030 !
2040 cpy #129 ! 129=speed change
2050 beq makespeed
2060 cpy #130 ! 130=repeat tune
2070 beq repeat
2080 cpy #128 ! 128=delay with value
2090 beq dowait
2100 !
2110 !
2120 ! now y must be a "split" to play.
2130 !
2140 ! ----> read page numbers to play
2150 ! from .... to ....
2160 ! for the 'playasample' routine.
2170 !
2180 lda splits,y
2190 sta start
2200 lda splits+128,y
2210 sta last
2220 !
2230 ! read # times to play this split.
2240 !
2250 lda tune+256,x
2260 sta loopcount
2270 !
2280 ! -----> loopcount=repeat value.
2290 !
2300 lll jsr playasample ! play split
2310 lda $dc01 ! exit if space
2320 and #%00010000 ! bar pressed.
2330 bne iew
2340 jmp exitseq
2350 iew !
2360 dec loopcount ! loop repeats
2370 bne lll
2380 nextinseq !
2390 inc inseq ! seq. index+1
2400 ldx inseq
2410 jmp rds ! next step
2420 !
2430 exitseq rts
2440 !
2450 inseq byt 0
2460 loopcount byt 0
2470 ! --------------------------------
2480 !
2490 ! handle the "sp" flag....
2500 !
2510 makespeed lda tune+256,x
2520 sta speed
2530 jmp nextinseq
2540 !
2550 ! "rp" flag....
2560 !
2570 repeat jmp playseq
2580 !
2590 ! "wt" flag....
2600 !
2610 dowait lda tune+256,x
2620 sta loopcount
2630 lli jsr delay
2640 dec loopcount
2650 bne lli
2660 jmp nextinseq
2670 !
2680 delay ldx #10
2690 d2 dey
2700 bne d2
2710 dex
2720 bne d2
2730 rts
2740 !
2750 !
2760 ! ig'1990.
2770 !
2780 !
2790 !