;; WavPlayer...
;ALTERED player by Chris Born 2015/2016

 	ORG 32768

MainLoop:
        
        CALL ORGZSND    ;; ORGANIZE PACKED DATA FROM ADDRTABLE
                        ;; (ASSUMES 'WAV'  has been poked with Sample TO PLAY)

        CALL DEPACKER   ;; UNZIP THE SAMPLE (ASSUMES HL & DE)

        CALL PLAYWAV   ;; Plays the WAV

        RET             ;; THATS IT FOLKS, THATS YOUR MAIN ROUTINE DONE!
        
ORGZSND:
        ;; ORGANIZE SOUND SAMPLE DATA ACCORDING TO ADDRTABLE OFFSETS
        ;; INPUT Poke 'WAV' with SAMPLE number first
        ;; OUTPUTS HL=ADDRESS OF SAMPLE, DE=DESTINATION OF WHERE TO DUMP IT
        ;; THEN ACTUALLY DUMPS THE PACK INTO THE UNPACKED AREA (ADDRESS DE)

        LD DE,WAV
        LD A,(DE)

        SLA     A               ; DOUBLE THE CONTENTS OF A (A*2)
        LD DE, ADDRTABLE-2      ; COS WE'RE STARTING COUNT AT 1 (*2), NOT AT ZERO
        ;ADDING A TO DE NOW     ; TO GET SND ADDRESS TABLE OFFSET
        ADD A,E
        LD E,A                  ; DE NOW POINTS TO CORRECT ADDRTABLE OFFSET

         LD A,(DE)              ; WE NEED TO PEEK TWO VALUES NOW FROM
         LD L,A                 ; ADDRESS DE, & ADDRESS DE+1
         INC DE                 ; VALUE IS DUMPED INTO HL
         LD A,(DE)
         LD H,A
                                ;HL NOW HOLDS THE CONTENTS OF THE ADDR OF ADDRTABLE OFFSET,
                                ; THE CONTENTS OF WHICH POINT NOW TO SAMPLE

        LD DE,UNPACKED          ; ACTUALLY OFFSET TO 2 BYTES PRIOR THE MAIN WAV BUFFER
        RET                     ; BUT FINE FOR ANY OTHER DEPACKED DATA
        
DEPACKER:
        ;; INSERT YOUR FAV DEPACKER HERE (EG: EXOZIP OR MEGALZ)..
        ;; INPUT HL=LOCATION OF PACKED DATA, DE=WHERE YOU WANT TO DUMP IT
        ;; OUTPUT: THIS WILL DEPACK YOUR DATA & DUMP IT WHERE TOLD...
        ;; USING EXOZIP HERE...

deexo:          ld      ixh,128

                ld      b,52
                ld      iy,exo_mapbasebits
                push    de
exo_initbits:   ld      a,b
                sub     4
                and     15
                jr      nz,exo_node1

                ld      de,1            ;DE=b2
exo_node1:      ld      c,16
exo_get4bits:   call    exo_getbit
                rl      c
                jr      nc,exo_get4bits
                ld      (iy+0),c        ;bits(i)=b1

                push    hl
                inc     c
                ld      hl,0
                scf
exo_setbit:     adc     hl,hl
                dec     c
                jr      nz,exo_setbit
                ld      (iy+52),e
                ld      (iy+104),d      ;base(i)=b2
                add     hl,de
                ex      de,hl
                inc     iy

                pop     hl
                djnz    exo_initbits
                inc     c

exo_literalseq: pop     de
exo_literalcopy:ldir                    ;copy literal(s)
exo_mainloop:   ld      c,1
                call    exo_getbit      ;literal?
                jr      c,exo_literalcopy
                ld      c,255
exo_getindex:   inc     c
                call    exo_getbit
                jr      nc,exo_getindex
                ld      a,c             ;C=index
                cp      16
                ret     z
                jr      c,exo_continue
                push    de
                ld      d,16
                call    exo_getbits
                jr      exo_literalseq
exo_continue:   push    de
                call    exo_getpair
                push    bc
                pop     af
                ex      af,af'          ;lenght in AF'
                ld      de,512+48       ;1?
                dec     bc
                ld      a,b
                or      c
                jr      z,exo_goforit
                ld      de,1024+32
                dec     bc              ;2?
                ld      a,b
                or      c
                jr      z,exo_goforit
                ld      e,16
exo_goforit:    call    exo_getbits
                ld      a,e
                add     a,c
                ld      c,a
                call    exo_getpair     ;bc=offset
                pop     de              ;de=destination
                push    hl
                ld      h,d
                ld      l,e
                sbc     hl,bc           ;hl=origin
                ex      af,af'
                push    af
                pop     bc              ;bc=lenght
                ldir
                pop     hl              ;Keep HL, DE is updated
                jr      exo_mainloop    ;Next!

exo_getpair:    ld      iy,exo_mapbasebits
                ld      b,0
                add     iy,bc
                ld      d,(iy+0)
                call    exo_getbits
                ld      a,c
                add     a,(iy+52)
                ld      c,a
                ld      a,b
                adc     a,(iy+104)
                ld      b,a
                ret

exo_getbits:    ld      bc,0            ;get D bits in BC
exo_gettingbits:dec     d
                ret     m
                call    exo_getbit
                rl      c
                rl      b
                jr      exo_gettingbits

exo_getbit:     ld      a,ixh           ;get one bit
                add     a,a
                ld      ixh,a
                ret     nz
                ld      a,(hl)
                inc     hl
                rla
                ld      ixh,a
		ret

exo_mapbasebits:
                defs    156     ;tables for bits, baseL, baseH


; New Wave Player n_wAYv

;Based on wav2ay player
;my 64bits calculator has problems with decimal
;0xffffffffffffffff=1.844674407×10¹⁹. with a 'nine digit' max 9876543210.123456789
; sample player uses 317 tstates per sample =
; 1 tstate = 1/3,500,000 = 0.000,000,286 second on 48k spectrum, 1/3.500000=0.285714286 >>0.000000285714286
; 1 tstate = 1/3,546,900 = 0.000,000,282 second on 128k spectrum 1/3.546900=0.281936339 >>0.000000281936339

; 0.286 *  317 =  90.662 millisecond per sample on 48k spectrum
; 3500000/317 = 11041.009463722 = 11.041 khz 

; 0.282 *  317 =  89.394 millisecond per sample on 128k spectrum
; 3546900/317 = 11188.958990536 = 11.188 khz

; if 'bb2' is fully eliminated even shorter, 279 tstate seems possible
;but 'short samples need big data' is a zx problem...!!!
; on 128 , 3 channels
; 3546900/279 = 12712.903225806 = 12.713 khz
; on 128 , 1 channel
; 3546900/195 = 18189.230769231 = 18.189 khz

; timing is a loop with 3 main parts:
; wavtime, 4bits being 'outed'
; worktime, prepare the music now called 'short'
; delaytime, fill the gabs until they are equal, now called 'long'
; 1 bytes holds 2 samples. we loop twice with 317 tstate
; 1st loop = wavtime + delaytime(big)
; 2nd loop = wavtime + worktime + delaytime(small)
; the more worktime, the smaller the delaytime as compensation

; 'AYreg' is the adres for the 14 byte AY register settings
PLAYWAV:
	  di                ; disable interrupts, so that they don't mess with our carefully planned timings
	  ld hl,AYreg+13
          call vox          ; set 'formant' or other preset sound

        ;; ACTUALLY PLAYS THE DATA
        ;; INPUT HL=START OF SAMPLE & BC=LENGTH OF SAMPLE PRIOR CALLING WPLAYER...

	  LD HL,UNPACKED+2   ;; NOTE YOUR SAM_LEN IS ONLY 2 BYTES
	  LD BC,(UNPACKED)   ;; PRIOR THE SAM_BUFFER WHERE ITS PLAYED..

WPLAYER: ;; EXTRA ENTRY POINT, IN CASE YOU WISH TO ASSUME OTHER HL/BC VALUES...
; time between 1st call and 2nd call MUST be 317 and full loop is entered here, but the TIMING ZERO PIONT comes later
samplelp:
          push bc         ;11t
	  ld c,$fd        ; 7t
	  ld e,2          ; 7t e counts down to loops for 2 digits
          xor a           ; 4t wipe msb_digit since it will set SOME TONE in AY
                          ; work_1 = 11+7+7+4 = 29
; YOU CAN NOT(!) USE  reg A   ANY FURTHER WHILE PLAYING !!!!!! use AF'; thats becouse 'RRD' is an destructive opcode !!!!; get 4 bits/1 digit from (HL) to use as the first volume level
; timing starts HERE !, starting with the 'wavtime' part
c1	  rrd             ; 18  1st rotate A(HL) to LAH and  2nd rotate LAH to HLA; output that volume level to channels 8/9/10
; 1 channel=18+45+4= 67 tstate, 2 chan=67+42=109 and 3 chan=67+42+42=151t tstate wavtime
ch_a	  ld d,8          ; 7
	  ld b,$ff        ; t
	  out (c),d       ; 12
	  ld b,$bf        ; 7
	  out (c),a       ; 12  =45

ch_b	  inc d           ; 4
	  ld b,$ff        ; 7
	  out (c),d       ; 12
	  ld b,$bf        ; 7
	  out (c),a       ; 12  =42

ch_c	  inc d           ; 4
	  ld b,$ff        ; 7
	  out (c),d       ; 12
	  ld b,$bf        ; 7
	  out (c),a       ; 12  =42

;      ld b,1    ; 7t
;loop  djnz loop ; 1*13-5=8   minimum delayloop=15 tstate making 279+15= 294 tstate 

	  dec e           ; 4t loop 2 times for 2 RRD's, bin 10 to 01 and second to 00
                          ; wavtime=18+45+42+42+4 =151
	  jr z,short      ; 7t (+5 on jump)
;delay to reach equal timing for both runs of loop 'e=2'
long	  nop             ; 4t delay 1byte ;long = worktime = 128t defined
          inc bc          ; 6t delay 1byte
          dec bc          ; 6t delay 1byte
          ld b,7          ; 7t delay 1byte
wait	  djnz wait       ;   (7*13)-5
          jr c1           ; 12 t          
; long =7+4+6+6+7+(7*13)-5+12=128   (128-12-7= 109 tstate 'free' for other code)
;151+128=279 tstate

;work time is delaytime aswell
                          ; 12 t from jump (INSTEAD of 7t counted in 'long')
short:	  rrd             ;18t 3rd rotate (HL)A to A(HL); now reg A is 'FREE' again, until next RRD in the next loop
	  inc hl          ; 6t move on to next byte, 2 digits
          pop bc          ;10t pop down counter

;check any-key here, AFTER THE POP bc
keytest   in    a,($fe)       ; 11t port $00fe read keyboard
          and   $1F           ;  7t filter ANY key touch with bin 11111
          cp    $1F           ;  7t 
          jr   nz,eisil    ;  7 t+5t

	  dec bc          ; 6t
	  ld a,b          ; 4t
	  or c            ; 4t ;loop if we haven't reached the end of the sample
	  jr nz,samplelp  ;12t  => work_2 =12+18+6+10+13+7+7+6+4+4+12= 99t  calculate work time delay
;worktime =work_1 +12thump+ work_2 = 29 + 99 = 128
eisil	  ei
silence   ld hl,silen+13  ; set Ay registers all to 0 for real silence
;hl points to 14 byte buffer at the BEGIN of the last compressed data block

vox	  ld c,$fd 
	  ld d,14
xov                       ; set AY channels to preset Formant voice 
	  ld a,(hl)
	  dec hl
	  dec d           ; 13,12,..,2,1,0
	  ld b,$ff
	  out (c),d       ;
	  ld b,$bf
	  out (c),a       
	  jr nz,xov       ; z/nz from dec d
          ret             ; return to basic or not

silen     defb 0,0,0,0,0,0,0,0,0,0,0,0,0,0  ; set all AY channels to zero 'silence'

;preset AY with a Formant voice chord, or any other full sized  AYregister group
; reg 7 should be/is usualy set to 63 !!!!
AYreg	  defb 0,0,0,0,0,0,0,63,0,0,0,0,0,0


WAV:				; WAV is at Address 32768+3
	DEFB 1			; Set to =1 for 128k version, Else
				; change for the 48k version...

ADDRTABLE:

        DEFW SAMPLE1

SAMPLE1:
; 3074 bytes now follow:
	DEFW $2022,$3634,$4797,$5297,$4444,$6645,$8B68,$CD9A,$0011,$2000,$1543,$3645,$1100,$C032,$BB4B,$BC03
	DEFW $CC02,$4420,$22BC,$0041,$BCD2,$18CB,$5875,$1840,$053A,$F095,$8ECB,$C080,$AE00,$CCE6,$0869,$4CCB
	DEFW $3ACC,$BCAB,$A951,$AC22,$CAA8,$48B7,$23A4,$C308,$58AE,$60AA,$CB39,$D6C1,$0379,$E258,$C8BC,$9E6E
	DEFW $ABA5,$AAA9,$02B8,$AABD,$BA0B,$3082,$4078,$CB0C,$DCFD,$CDDD,$99AB,$AA09,$5008,$9128,$64C8,$05CD
	DEFW $8576,$6BC9,$46BC,$621B,$AB3B,$29A5,$BADC,$285D,$6A89,$4944,$A9AC,$B922,$9C48,$AC20,$0BE2,$3652
	DEFW $DCFB,$10EE,$BAD7,$CD40,$0861,$1515,$42CA,$6B56,$DDED,$E461,$25EB,$5DD0,$59D3,$7724,$1053,$DDF2
	DEFW $AC87,$B999,$CCA6,$C371,$063E,$561C,$BA7A,$DEDD,$9A6A,$4EF2,$24B9,$4A8E,$8136,$5C42,$94DD,$708B
	DEFW $DA38,$4DF2,$20CD,$20D9,$36B7,$B74C,$A892,$D9D8,$557B,$D6BB,$8D35,$BA9D,$BC52,$46BB,$6D46,$72DC
	DEFW $1BCB,$6626,$AA9A,$8550,$ED7A,$AEA8,$1E91,$3E73,$2828,$6FC8,$9D99,$D1A9,$CB91,$34EE,$2912,$E5C1
	DEFW $D945,$3857,$0176,$13C7,$83BC,$7288,$2120,$93E2,$6730,$5212,$3929,$C2E6,$75A9,$77C2,$4E8F,$5346
	DEFW $ED09,$4E4F,$38AA,$06F2,$279F,$DC62,$867D,$FE0C,$C839,$E4AA,$2603,$2007,$9B15,$2533,$799B,$646E
	DEFW $C120,$4A09,$7288,$CC33,$E491,$2820,$AFAA,$6648,$2325,$2D38,$3A08,$1231,$0C5C,$0132,$05AA,$A013
	DEFW $5E34,$F8D5,$79A1,$929C,$6BB9,$B3CA,$A518,$6650,$81BC,$2CC5,$E374,$8836,$9C88,$46E0,$0E79,$AE12
	DEFW $B02A,$F879,$EA40,$B7B3,$0AC8,$831C,$8D52,$7FAA,$2BB7,$3E33,$CB89,$B90E,$3B52,$779C,$CD60,$D48B
	DEFW $B308,$4A6E,$2910,$5DC9,$AE74,$650C,$8EE1,$A486,$DCF9,$9525,$5154,$0393,$0819,$6C78,$698C,$8144
	DEFW $D202,$D7DC,$08FB,$BACE,$5372,$41A1,$6843,$B63C,$9D5F,$C210,$2403,$ABE7,$55CB,$989E,$8A01,$B113
	DEFW $5782,$C840,$4322,$6A06,$931A,$764A,$9932,$CA54,$9572,$EA19,$3601,$97A6,$65E2,$6A11,$5454,$69E5
	DEFW $CD4C,$3888,$E01C,$BC12,$03AD,$3010,$1F33,$70BB,$B290,$892A,$54DE,$F74E,$5681,$1874,$7722,$6EF1
	DEFW $85E7,$A813,$D954,$45C3,$21D9,$0B09,$1D0E,$16B6,$0D20,$70C0,$9A8E,$063F,$EC33,$A8F3,$D65A,$846A
	DEFW $E2C4,$E2C0,$30D0,$0015,$E363,$9CA4,$E0F9,$BEF0,$C9A2,$DB13,$3115,$A648,$0A68,$0E82,$638B,$11CB
	DEFW $5886,$2E87,$BA09,$C152,$BE6E,$C814,$4129,$C38E,$2356,$8617,$48E1,$BA1D,$0A20,$7A25,$7436,$1DD0
	DEFW $4477,$AE04,$9D80,$0405,$084C,$C046,$D879,$E900,$027B,$01BC,$6691,$4A1A,$CE7B,$0080,$011C,$22F7
	DEFW $B00D,$02C2,$8DAA,$90AD,$04FA,$E404,$9A6D,$73C3,$CFC9,$AB32,$8099,$6617,$29E7,$DD9C,$7B00,$8AAB
	DEFW $BFE9,$899A,$9988,$AAA9,$BA93,$036C,$170A,$3969,$09DC,$DD5C,$7293,$A998,$278F,$E51E,$7139,$F97E
	DEFW $26DE,$F2DB,$ECA9,$EC62,$DB10,$9558,$76D9,$881D,$968D,$5E87,$E139,$C79B,$2842,$33F9,$E876,$BA51
	DEFW $72B0,$C3CF,$132C,$9AD7,$D852,$5A62,$E138,$5EC7,$2B2D,$E71C,$A56A,$3B1D,$E318,$54C6,$BA56,$9B3C
	DEFW $8888,$1172,$C6C4,$1A1C,$F8FC,$1BCC,$8146,$B252,$C719,$CB23,$2E8E,$AA70,$2060,$CB73,$DB15,$C16D
	DEFW $C14A,$3A8A,$1B79,$F233,$37B6,$057E,$CCD2,$C323,$582F,$6928,$2A17,$1CB0,$C73E,$40E6,$AABA,$6F00
	DEFW $8A97,$AA0F,$6023,$D099,$7ECD,$A545,$E769,$826D,$440E,$9180,$BA64,$D18A,$2864,$0EC1,$39E5,$A4AB
	DEFW $1A89,$D8B0,$ACA4,$6236,$1157,$AB34,$2216,$0137,$9839,$9C16,$C210,$548E,$80F0,$7AF5,$034A,$B771
	DEFW $1E12,$DE7A,$BC1D,$F4AA,$81B8,$CEB6,$5330,$04A4,$51B1,$755B,$D5E9,$E2A2,$EC28,$CD4C,$0226,$8164
	DEFW $BD12,$99D1,$0424,$6C12,$4E36,$9503,$4382,$39C6,$9022,$C97C,$BACE,$38C0,$4790,$5801,$792F,$859D
	DEFW $A4BA,$8911,$6E0B,$781C,$8C0E,$1678,$16AA,$33C8,$08C8,$79C5,$01C9,$F758,$2735,$503A,$BA65,$ADCD
	DEFW $6C1D,$4218,$45BA,$3D70,$D028,$E342,$A999,$220C,$A416,$7C31,$61CB,$4320,$3650,$66AC,$896C,$8717
	DEFW $134D,$10B5,$9FBA,$D588,$A403,$6954,$75E1,$6549,$3270,$222C,$3CA4,$002D,$BD4D,$E214,$3BBC,$AE98
	DEFW $A169,$2A67,$F6A9,$4C03,$86C4,$0C1E,$1CB3,$E2E4,$7761,$2544,$DC0A,$2362,$CBAE,$2145,$8E8D,$AB6B
	DEFW $3B04,$C6A0,$A538,$A8C1,$50E5,$BF39,$CFEB,$60FA,$18D5,$F431,$330F,$69B0,$3A98,$4329,$12CC,$CE00
	DEFW $8707,$0038,$A6B7,$00EA,$9B2F,$DED9,$0530,$01D0,$00CB,$B9F6,$557A,$1400,$8000,$73CB,$0F41,$7E60
	DEFW $CCBC,$A130,$5DAD,$1C05,$66C5,$440B,$4928,$D08B,$5210,$5045,$1D96,$CB2A,$1281,$8412,$4CE0,$0509
	DEFW $FD60,$8789,$2DEC,$F207,$1E28,$3AE0,$29D5,$A458,$56A0,$5910,$50AB,$0348,$039A,$826D,$D103,$37C7
	DEFW $7022,$618E,$C394,$B395,$0CE6,$30D4,$ADB8,$037C,$9A21,$A126,$74EE,$0322,$370C,$F961,$A22F,$7D1D
	DEFW $73DC,$C477,$ABC5,$2D20,$1294,$8BEE,$DAE8,$9AFA,$9307,$5591,$E0F1,$EDF7,$F21E,$AEF3,$870F,$F531
	DEFW $6104,$B936,$ADB6,$41B8,$FCF1,$1EF3,$0AE7,$DFA3,$0B86,$E116,$AE40,$6746,$3903,$DF09,$5CB1,$9E43
	DEFW $7B2E,$0EB3,$A330,$6A10,$FDBC,$4446,$7CED,$DD66,$037D,$390B,$A942,$553B,$3D16,$D986,$3F9B,$8A5A
	DEFW $1BA9,$3792,$6F0C,$27BC,$916E,$3719,$56EB,$6254,$8651,$0898,$6EB3,$0446,$7DAF,$73CD,$7A9D,$6BC3
	DEFW $1A6B,$C3F4,$3E81,$8A5E,$175E,$A2C4,$362A,$E0EB,$D556,$EC1C,$E6C9,$C0BB,$A1EE,$4A72,$AAD7,$B919
	DEFW $1363,$A20B,$DA4E,$9486,$B105,$E4B5,$1BB7,$BC9B,$C24C,$181E,$F46D,$2389,$413C,$AAB9,$FDAA,$A69B
	DEFW $551E,$B371,$2E68,$5C47,$DADD,$C06C,$0634,$3CD4,$A14D,$3947,$DC42,$8763,$6EBE,$89D0,$E21C,$8076
	DEFW $06BB,$AEB1,$45A8,$9E62,$2C7B,$C1BA,$DF8B,$734A,$4BA4,$3CD1,$4245,$E123,$87B1,$2051,$A9ED,$4B87
	DEFW $3B08,$2DF2,$B441,$56A4,$11BD,$9C63,$CBF6,$DA1C,$4531,$17DC,$B01E,$F4CB,$FA9A,$1CC2,$A778,$D8C9
	DEFW $997D,$D1D5,$AA4C,$17AE,$0E2A,$75DA,$BDCC,$ECDB,$4CFD,$6B44,$0C4D,$0CA8,$8B82,$9D10,$A105,$AAA7
	DEFW $2C42,$4386,$1279,$CDB0,$A30A,$D9E7,$429B,$E8E7,$67A4,$7822,$C9D1,$BC64,$4523,$C288,$648E,$34A2
	DEFW $BD56,$722D,$3752,$C5E9,$0D49,$D6FB,$5390,$EB3A,$E486,$B0E2,$6A43,$CC78,$5F11,$DC4B,$3286,$A97D
	DEFW $B811,$C32F,$BA1B,$BC59,$6616,$11D9,$90EC,$A0AD,$78CA,$C5CD,$1CA8,$E1EC,$DBD1,$508C,$BD2A,$1BF7
	DEFW $380B,$3213,$D9A8,$60A7,$AC3B,$D634,$699A,$B9CA,$267B,$3F23,$5DA1,$960C,$ABA5,$DCA5,$CDB0,$9E2B
	DEFW $6A3C,$6641,$43A3,$D129,$A234,$289D,$B336,$A1CC,$D563,$4946,$3969,$6179,$8645,$86CC,$0D16,$60A2
	DEFW $145F,$E5E9,$E488,$AB93,$0E25,$ADD9,$29FC,$FE00,$F3AB,$83D0,$38CE,$9A44,$F1D5,$EC95,$9AF8,$A5D1
	DEFW $B6DD,$0A2E,$3B08,$0139,$2DD0,$D28F,$AD82,$6CAA,$CBDD,$9D88,$18E8,$828A,$6046,$DCB6,$F609,$84AA
	DEFW $D28C,$175A,$4661,$CED2,$ABA7,$9658,$1392,$6471,$D89E,$5B80,$3C20,$39AD,$2B29,$1698,$5244,$4A42
	DEFW $6870,$3BCC,$05FE,$3AD8,$7668,$38A3,$DC00,$842B,$30A1,$D82F,$3312,$2A3C,$1400,$7296,$0897,$1D26
	DEFW $01E5,$DC34,$3906,$D152,$A951,$E51A,$2082,$F362,$6C20,$9B05,$507A,$E51F,$71D3,$0BE0,$BEF7,$C80E
	DEFW $00AA,$9701,$B8D7,$9C88,$44BA,$33C1,$3508,$B5D2,$7740,$B888,$7717,$CF15,$9E4F,$9D72,$7B20,$A168
	DEFW $4CDB,$D736,$E70D,$54E5,$0373,$3C62,$AA81,$FB42,$4810,$2AA8,$4531,$DB8E,$7387,$1702,$DA82,$3451
	DEFW $2686,$E8D9,$2C11,$6ACE,$DC93,$0BC8,$17B4,$8ED8,$A87A,$7038,$C070,$0078,$E783,$C6C0,$9888,$264C
	DEFW $750F,$979C,$9CFA,$BB24,$EC1B,$899A,$5D46,$0D62,$3BA1,$34E0,$4AF8,$4B2F,$BAC4,$813D,$87EE,$A4ED
	DEFW $38DE,$EFE1,$CFB0,$D1AA,$C7B8,$1A05,$A993,$6A0B,$53E4,$B7BE,$0DA3,$6B31,$8A2C,$9935,$691C,$E7DB
	DEFW $7644,$E6AC,$3E88,$A6E3,$DC65,$6E9D,$8C82,$729D,$A157,$776A,$0745,$260B,$6EF3,$11ED,$67EC,$E3D4
	DEFW $962F,$4641,$4941,$4AA9,$77B7,$C690,$E38A,$360D,$4C04,$99D6,$75FE,$D901,$8641,$CCD5,$EC88,$65B1
	DEFW $FD04,$483A,$BF08,$C821,$A2E3,$8E76,$1392,$723B,$22A0,$0752,$20D4,$5945,$70E4,$9E33,$06E4,$167B
	DEFW $5061,$0650,$A55F,$233A,$0A91,$5DCA,$94CD,$D234,$1895,$A3D1,$A011,$58F2,$E476,$335C,$7CBD,$F43A
	DEFW $47A9,$5C7F,$DB45,$A901,$DDF4,$085C,$5A16,$88EF,$4720,$D392,$C1C4,$40E9,$8E2C,$893A,$8B8A,$0712
	DEFW $2159,$95E9,$95E5,$C5D4,$882C,$58CB,$80EA,$D8F9,$AB8E,$7909,$0510,$1F4F,$C113,$2C0F,$16A1,$341A
	DEFW $0C88,$1348,$F730,$3CF0,$707E,$B501,$0D70,$C389,$FA77,$7002,$6D88,$1E79,$1C4A,$DE70,$330A,$83AD
	DEFW $E897,$4FAA,$D747,$C6CD,$7E88,$815A,$E334,$8D85,$E678,$64AA,$BA10,$6EE2,$EBAE,$D807,$E0D1,$A292
	DEFW $6A05,$0823,$40E8,$BADE,$8913,$E01D,$0370,$B856,$5464,$FA07,$4E43,$7458,$E2F1,$BDF0,$53E0,$862A
	DEFW $3DE4,$0D44,$C128,$AC9B,$1805,$FB1C,$D607,$CBC2,$C150,$2584,$140C,$1780,$0753,$147D,$3041,$EE98
	DEFW $7718,$09D4,$17C0,$E8D7,$B831,$B977,$9233,$15AE,$A560,$AA82,$B8D7,$8714,$570F,$FA81,$1E22,$78C8
	DEFW $1694,$B37A,$8028,$4662,$3A1A,$AE0B,$FE41,$56C7,$0503,$32CE,$3D53,$BAA3,$4882,$E528,$4B80,$0EE9
	DEFW $0E1B,$7362,$04A5,$3C64,$20DF,$D767,$18F2,$055C,$12FB,$9905,$F795,$3680,$52F4,$2A00,$9ADE,$CC18
	DEFW $DD04,$A1EB,$A2CB,$5960,$8FFB,$C107,$1096,$4A60,$28E0,$7CA2,$D48F,$1B80,$E507,$02A8,$79A7,$CB94
	DEFW $25FE,$2390,$FED5,$A60E,$4E10,$C144,$65F6,$30CE,$E014,$6E3F,$BC2A,$12A6,$7A40,$1B30,$E5F8,$0415
	DEFW $915F,$F7E0,$4B07,$8080,$C0B3,$40F7,$A286,$DD75,$0FA8,$1874,$C51E,$7209,$D718,$62BF,$60AA,$26C0
	DEFW $B521,$6BF2,$2EFB,$17B1,$5AD4,$B517,$9ECA,$2BFC,$0A15,$CA52,$8D32,$9C04,$67D8,$1D2E,$0294,$F3F9
	DEFW $6F8F,$4CE8,$A681,$4036,$6A0A,$85FD,$5B63,$36AC,$2E0F,$44BC,$E53C,$6E19,$0CE5,$6218,$7E12,$4688
	DEFW $8DEC,$6416,$F584,$0A08,$6540,$8F7B,$059D,$1E90,$1115,$3A9A,$4731,$ABDB,$8B35,$F445,$8EFC,$4F4A
	DEFW $8348,$8B2B,$A8EA,$A129,$0FCF,$BDE9,$A9B0,$68F3,$AA8B,$A70F,$E364,$DACD,$A818,$F4D1,$41AA,$BD62
	DEFW $73E5,$FD04,$8E94,$7B78,$644E,$6F1E,$39D6,$915C,$9387,$AB1D,$2D66,$E768,$25CF,$FE23,$1086,$F938
	DEFW $3A3F,$E48E,$249A,$7E14,$64BC,$E404,$A37A,$B5BB,$0A8E,$3E77,$E89B,$EC26,$0FEF,$7CDE,$C2D8,$CD66
	DEFW $4DC8,$8129,$DC7B,$E800,$0AAD,$B834,$4C0D,$28E6,$693A,$347F,$DB4C,$FA3C,$909C,$91EB,$00BF,$BFCE
	DEFW $D97E,$C264,$0BF4,$CF8A,$A399,$7921,$584A,$A948,$3FE7,$5806,$76C4,$8E2C,$317B,$F443,$8624,$00EF
	DEFW $C760,$7F1F,$615F,$802A,$547C,$5189,$ECE0,$9372,$60B0,$7A1F,$0059,$9239,$6950,$F0A1,$0F98,$18CD
	DEFW $B31A,$E44A,$D220,$6970,$31E0,$03B4,$7996,$38C2,$D2F3,$5071,$ED2A,$F0B8,$841D,$9442,$DC3A,$5692
	DEFW $8011,$019A,$61BB,$5CA0,$2DF4,$4DC8,$D640,$010C,$3EFD,$7E04,$43C7,$0A01,$97D0,$A499,$B008,$C544
	DEFW $C2EA,$682D,$B08E,$4B01,$AF57,$5CF0,$3F38,$52ED,$7FCB,$6957,$4E65,$09AB,$188F,$875D,$E440,$9178
	DEFW $0C48,$EE41,$648E,$8E80,$DC84,$7A04,$C081,$F7B4,$8D11,$ED07,$31F6,$8E59,$64C0,$01BF,$ACC9,$4978
	DEFW $5F44,$C024,$FD15,$399E,$1418,$8055,$54BF,$B069,$1CE0,$9C6A,$6B3C,$0034,$2C33,$C741,$00E8,$00F0
	DEFW $0200
SAMPLE1_END:


;; CALLED SUBROUTINES NOW FOLLOW...
UNPACKED:
SAM_LEN:
        ;; WHEN UNZIPPED, THE 2 BYTE ENCODING SAMPLE LENGTH GETS DUMPED HERE

        DEFW 0

SAM_BUFFER:
        ;; SAMPLES GET DUMPED HERE PRIOR PLAYING... (VAR LENGTH)


END ;32768
