home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Magazine 5
/
Mega_Magazine_05_19xx___nl_Side_B.atr
/
sampling.lzh
/
PLAYCONS.SRC
< prev
Wrap
Text File
|
1988-09-01
|
3KB
|
234 lines
*************************************
* *
* - SAMPLE PLAYER - *
* *
* PLAY ONLY ONE BIT OF EACH SAMPLE *
* THROUGH THE CONSOLE SPEAKER! *
* *
* (C)1992 FRANKENSTEIN (YEAH!) *
* *
*************************************
SPBEG EQU $0700
SPEND EQU $B3FF
ZP EQU $F0 (AND $F1)
END EQU $F2 (AND $F3)
SPLBYTE EQU $F4
TAB01 EQU $B600
TAB23 EQU $B700
TAB45 EQU $B800
TAB67 EQU $B900
TAB0123 EQU $BA00
TAB4567 EQU $BB00
ORG $B400
LDA #SPBEG:L
STA ZP
LDA #SPBEG:H
STA ZP+1
LDA #SPEND:L
STA END
LDA #SPEND:H
STA END+1
*------------------------------------
* MAIN LOOP
*------------------------------------
JSR MAKTAB
JSR INTOFF
JSR PLAY
JSR INTON
RTS
*------------------------------------
* CREATE A LOOKUP TABLES:
*
* PLAY MSB OF 4-BIT SAMPLE:
*
* TAB0123: ----x---
* TAB4567: x-------
*
* TAB01 : ------x-
* TAB23 : ----x---
* TAB45 : --x-----
* TAB67 : x-------
*
* x : BITS USED TO LOOKUP
* - : DOESN'T MATTER BITS
*------------------------------------
* 4-BITS/SAMPLE (ONLY 1 BIT USED!)
MAKTAB LDX #0
N0123 TXA
AND #%00001000
STA TAB0123,X
INX
BNE N0123
N4567 TXA
AND #%10000000
LSR
LSR
LSR
LSR
STA TAB4567,X
INX
BNE N4567
* 2-BITS/SAMPLE (ONLY 1-BIT USED)
N01 TXA
AND #%00000010
ASL
ASL
STA TAB01,X
INX
BNE N01
N23 TXA
AND #%00001000
STA TAB23,X
INX
BNE N23
N45 TXA
AND #%00100000
LSR
LSR
STA TAB45,X
INX
BNE N45
N67 TXA
AND #%10000000
LSR
LSR
LSR
LSR
STA TAB67,X
INX
BNE N67
RTS
*------------------------------------
* INTERRUPTS OFF
*------------------------------------
INTOFF LDA #0
STA $D20E
STA $D40E
RTS
*------------------------------------
* INTERRUPTS ON
*------------------------------------
INTON LDA 16
STA $D20E
LDA #$C0
STA $D40E
RTS
*------------------------------------
* THIS ROUTINE PLAYS 2-BIT SAMPLES
* HOLD FIRE FOR 4-BIT PLAYING
*------------------------------------
PLAY LDY #0
NOHO LDA (ZP),Y
STA SPLBYTE
LDA $D010
BNE TWOBIT ;NO FIRE
* PLAY: xxxx0000
LDA SPLBYTE
TAX
LDA TAB4567,X
STA $D40A
STA $D40A
STA $D01F
* PLAY: 0000xxxx
LDA SPLBYTE
TAX
LDA TAB0123,X
STA $D40A
STA $D40A
STA $D01F
JMP NEXBT
*------------------------------------
* 2-BIT PLAY ROUTINE
*------------------------------------
* PLAY: x-------
TWOBIT LDA SPLBYTE
TAX
LDA TAB67,X
STA $D40A
STA $D01F
* PLAY: --x-----
LDA SPLBYTE
TAX
LDA TAB45,X
STA $D40A
STA $D01F
* PLAY: ----x---
LDA SPLBYTE
TAX
LDA TAB23,X
STA $D40A
STA $D01F
* PLAY: ------x-
LDA SPLBYTE
TAX
LDA TAB01,X
STA $D40A
STA $D01F
*------------------------------------
* GET NEXT BYTE FROM DATA
*------------------------------------
NEXBT INC ZP
BNE NOWAY
INC ZP+1
NOWAY LDA ZP+1
CMP END+1
BNE NOHO
LDA ZP
CMP END
BNE NOHO
RTS
* VARS
LEN DFB 0,0
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯