SOUND commands now enqueue stuff. Proof of principle.

This commit is contained in:
Bobbi Webber-Manners 2022-09-28 01:12:14 -04:00
parent 67b2972dcf
commit aeda12e9af
3 changed files with 36 additions and 12 deletions

View File

@ -4,7 +4,12 @@
* Applecorn audio code
*
SNDBUFSZ EQU 16 ; All audio buffers are 16 bytes
* Sound buffers in aux LC for now
* Not sure where to move them to
SNDBUF0 DS 16
SNDBUF1 DS 16
SNDBUF2 DS 16
SNDBUF3 DS 16
* Get address of sound buffer
* On entry: X is buffer number
@ -43,7 +48,7 @@ INSHND PHP ; Save flags, turn off interrupts
PHA
LDY ENDINDICES,X ; Get input pointer
INY ; Next byte
CPY #SNDBUFSZ
CPY #16
BNE :NOTEND ; See if it's the end
LDY #0 ; If so, wraparound
:NOTEND TYA
@ -62,3 +67,31 @@ INSHND PHP ; Save flags, turn off interrupts
SEC ; Exit with carry set
RTS
* OSBYTE &07 - Make a sound
* On entry: (OSCTRL),Y points to eight byte parameter block (2 bytes each for
* channel, amplitude, pitch, duration)
WORD07 INY
LDA (OSCTRL),Y ; Get channel number 0-3
ORA #$04 ; Convert to buffer number 4-7
TAX ; Into X
INY ; Point to amplitude LSB
LDA (OSCTRL),Y
JMP INSHND ; SHOULD CALL THIS THRU VECTOR INSV
INY ; Point to amplitude MSB
LDA (OSCTRL),Y
JMP INSHND ; SHOULD CALL THIS THRU VECTOR INSV
INY ; Point to pitch LSB
LDA (OSCTRL),Y
JMP INSHND ; SHOULD CALL THIS THRU VECTOR INSV
INY ; Point to pitch MSB
LDA (OSCTRL),Y
JMP INSHND ; SHOULD CALL THIS THRU VECTOR INSV
INY ; Point to duration LSB
LDA (OSCTRL),Y
JMP INSHND ; SHOULD CALL THIS THRU VECTOR INSV
INY ; Point to duration MSB
LDA (OSCTRL),Y
JMP INSHND ; SHOULD CALL THIS THRU VECTOR INSV
RTS

View File

@ -94,7 +94,7 @@ OSWBASE DW WORD00 ; OSWORD 0 - Read input line
DW WORD04 ; OSWORD 4 - Write interval timer
DW WORD05 ; OSWORD 5 - Read I/O memory
DW WORD06 ; OSWORD 6 - Write I/O memory
* DW WORD07 ; OSWORD 7 - SOUND
DW WORD07 ; OSWORD 7 - SOUND
* DW WORD08 ; OSWORD 8 - ENVELOPE
* DW WORD09 ; OSWORD 9 - POINT
* DW WORD0A ; OSWORD 10 - Read character bitmap

View File

@ -92,13 +92,4 @@ OSGBPBCB EQU OSFILECB+1 ; OSGBPB control block
* $0300-$03DF
* $03E0-$03FF Used for interfacing with ProDOS XFER
* $0800-$08FF
SNDBUF0 EQU $840 ; Sound buffers (16 bytes each)
SNDBUF1 EQU $850
SNDBUF2 EQU $860
SNDBUF3 EQU $870