home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Magazine 5
/
Mega_Magazine_05_19xx___nl_Side_B.atr
/
sampling.lzh
/
PLAY4BAL.SRC
< prev
next >
Wrap
Text File
|
1988-09-01
|
3KB
|
250 lines
*************************************
* *
* - SAMPLE PLAYER - *
* *
* STEREO WITH BALANCE CONTROL *
* DONE BY FRANKENSTEIN 29/10/92 *
* *
*************************************
SPBEG EQU $0700
SPEND EQU $B3FF
ZP EQU $F0 (AND $F1)
END EQU $F2 (AND $F3)
COUNT EQU $F4
VLEFT EQU $F5
VRIGHT EQU $F6
TAB0123 EQU $BA00
TAB4567 EQU $BB00
ORG $B400
* BALANCE LEFT RIGHT
* ------- ------ ------
* 7 0 14 <- MAX.RIGHT
* 6 1 13
* 5 2 12
* 4 3 11
* 3 4 10
* 2 5 9
* 1 6 8
* 0 7 7 <- NEUTRAL
* 1 8 6
* 2 9 5
* 3 10 4
* 4 11 3
* 5 12 2
* 6 13 1
* 7 14 0 <- MAX.LEFT
*------------------------------------
* MAIN LOOP
*------------------------------------
LDA #3
STA $D20F
STA $D21F
* SET BALANCE VOLUMES
LDA #%00010111
STA VLEFT
STA VRIGHT
JSR MAKTAB
JSR INTOFF
LOOP LDA #SPBEG:L
STA ZP
LDA #SPBEG:H
STA ZP+1
LDA #SPEND:L
STA END
LDA #SPEND:H
STA END+1
LDA #0
STA COUNT
STA $D400
JSR PLAY
JMP LOOP
JSR INTON
RTS
*------------------------------------
* CREATE LOOKUP TABLES:
*
* FOR 4-BIT SAMPLES:
*
* TAB0123: ----xxxx
* TAB4567: xxxx----
*
* x : BITS USED TO LOOKUP
* - : DOESN'T MATTER BITS
*
* SETS VOLUME ONLY BIT IN TABLES TOO!
*------------------------------------
* 4-BIT TABLES (8/4=2)
MAKTAB LDX #0
N0123 TXA
AND #%00001111
ORA #%00010000
STA TAB0123,X
INX
BNE N0123
N4567 TXA
AND #%11110000
LSR
LSR
LSR
LSR
ORA #%00010000
STA TAB4567,X
INX
BNE N4567
RTS
*------------------------------------
* INTERRUPTS OFF
*------------------------------------
INTOFF LDA #0
STA $D20E
STA $D40E
RTS
*------------------------------------
* INTERRUPTS ON
*------------------------------------
INTON LDA 16
STA $D20E
LDA #$C0
STA $D40E
RTS
*------------------------------------
* SELECT/OPTION FOR BALANCE CONTROL
*------------------------------------
* PLAY: xxxx0000
PLAY LDY #0
LDA (ZP),Y
TAX
LDA TAB4567,X
LDX VLEFT
LDY VRIGHT
STA $D40A
STA $D201
STA $D211
STA $D40A
STX $D203
STX $D205
STY $D213
STY $D215
INC COUNT ; DELAY
BEQ YOVOL
LDA #8
STA $D01F
BNE EXITVC
YOVOL LDA $D01F
EOR #%00000111
BEQ EXITVC
CMP #%00000100 ; OPTION
BNE OPTNO
* OPTION = BALANCE TO RIGHT
LDX VRIGHT
CPX #16+14 ; R.MAX?
BEQ EXITVC
INX
STX VRIGHT
LDX VLEFT
DEX
STX VLEFT
BNE EXITVC
* SELECT = BALANCE TO LEFT
OPTNO CMP #%00000010 ; SELECT
BNE EXITVC
LDX VLEFT
CPX #16+14 ; L.MAX?
BEQ EXITVC
INX
STX VLEFT
LDX VRIGHT
DEX
STX VRIGHT
NOP
* PLAY: 0000xxxx
EXITVC LDY #0
LDA (ZP),Y
TAX
LDA TAB0123,X
LDX VLEFT
LDY VRIGHT
STA $D40A
STA $D201
STA $D211
STA $D40A
STX $D203
STX $D205
STY $D213
STY $D215
*------------------------------------
* GET NEXT BYTE FROM DATA
*------------------------------------
NEXBT INC ZP
BNE NOWAY
INC ZP+1
NOWAY LDA ZP+1
CMP END+1
BEQ COULD
NOP
NOP
NOP
NOP
JMP PLAY
COULD LDA ZP
CMP END
BEQ QPLAY
JMP PLAY
QPLAY RTS
* VARS
LEN DFB 0,0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯