mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-01-30 01:34:28 +00:00
Merge code from ensoniq branch. Disabled by default.
This commit is contained in:
parent
812a38a758
commit
88dd400535
BIN
applecorn.po
BIN
applecorn.po
Binary file not shown.
@ -264,6 +264,7 @@ MAINZP MAC
|
||||
PUT AUXMEM.OSCLI
|
||||
PUT AUXMEM.BYTWRD
|
||||
PUT AUXMEM.CHARIO
|
||||
PUT AUXMEM.AUDIO
|
||||
PUT AUXMEM.MISC
|
||||
PUT MAINMEM.MENU
|
||||
PUT MAINMEM.FSEQU
|
||||
@ -274,6 +275,8 @@ MAINZP MAC
|
||||
PUT MAINMEM.WILD
|
||||
PUT MAINMEM.LISTS
|
||||
PUT MAINMEM.MISC
|
||||
PUT MAINMEM.AUDIO
|
||||
PUT MAINMEM.FREQ
|
||||
|
||||
* Automatically save the object file:
|
||||
SAV APLCORN.SYSTEM
|
||||
|
111
auxmem.audio.s
Normal file
111
auxmem.audio.s
Normal file
@ -0,0 +1,111 @@
|
||||
* AUXMEM.AUDIO.S
|
||||
* (c) Bobbi 2022 GPLv3
|
||||
*
|
||||
* Applecorn audio code
|
||||
*
|
||||
|
||||
* OSWORD &07 - Make a sound
|
||||
* On entry: (OSCTRL),Y points to eight byte parameter block (2 bytes each for
|
||||
* channel, amplitude, pitch, duration)
|
||||
WORD07 LDA (OSCTRL),Y ; Get channel number/flush byte
|
||||
ORA #$04 ; Convert to buffer number 4-7
|
||||
AND #$0F ; Mask off flush nybble
|
||||
PHA ; Stash
|
||||
LDA (OSCTRL),Y ; Get channel number/flush byte
|
||||
AND #$F0 ; Mask off channel number nybble
|
||||
BEQ :WAITLOOP ; If no flush, skip
|
||||
PLX ; Buffer num -> X
|
||||
PHX
|
||||
PHY
|
||||
BIT :RTS ; Set V, means flush buffer
|
||||
JSR CNPHND ; Go flush buffer
|
||||
PLY
|
||||
:WAITLOOP LDA $C000 ; See if key pressed
|
||||
BPL :NOKEY
|
||||
EOR #$80
|
||||
JSR KBDCHKESC ; Was Escape pressed?
|
||||
BIT ESCFLAG
|
||||
BMI :ESCAPE ; If so, bail!
|
||||
:NOKEY PLX ; Buffer num -> X
|
||||
PHX
|
||||
CLV ; Ask to count buffer
|
||||
SEC ; Ask for space remaining
|
||||
JSR CNPHND ; Go count it
|
||||
CPX #3 ; Less than 4 bytes remaining?
|
||||
BMI :WAITLOOP
|
||||
PLX ; Buffer num -> X
|
||||
INY ; Point to channel num MSB
|
||||
LDA (OSCTRL),Y
|
||||
JSR INSHND ; Insert into queue X
|
||||
INY ; Point to amplitude LSB
|
||||
LDA (OSCTRL),Y
|
||||
JSR INSHND ; Insert into queue X
|
||||
INY ; Point to amplitude MSB
|
||||
INY ; Point to pitch LSB
|
||||
LDA (OSCTRL),Y
|
||||
JSR INSHND ; Insert into queue X
|
||||
INY ; Point to pitch MSB
|
||||
INY ; Point to duration LSB
|
||||
LDA (OSCTRL),Y
|
||||
JSR INSHND ; Insert into queue X
|
||||
:RTS RTS
|
||||
:ESCAPE PLX ; Fix up stack
|
||||
STA $C010 ; Ack keypress
|
||||
RTS
|
||||
|
||||
|
||||
* OSWORD &08 - Envelope
|
||||
* On entry: (OSCTRL),Y points to 14 byte parameter block
|
||||
WORD08
|
||||
* TODO: IMPLEMENT THIS!!!
|
||||
RTS
|
||||
|
||||
|
||||
* Insert value into buffer (INSV)
|
||||
* On entry: A is value, X is buffer number.
|
||||
* On exit: A, X, Y preserved. C clear on success.
|
||||
* Stub that calls into main memory
|
||||
INSHND PHA ; Preserve all regs
|
||||
PHX
|
||||
PHY
|
||||
PHX ; X->Y for transfer
|
||||
PLY
|
||||
>>> XF2MAIN,MAININS
|
||||
INSHNDRET >>> ENTAUX
|
||||
PHA ; A->Flags after transfer
|
||||
PLP
|
||||
PLY ; Recover all regs
|
||||
PLX
|
||||
PLA
|
||||
RTS
|
||||
|
||||
|
||||
* Count space in buffer or purge buffer (CNPV)
|
||||
* On entry: X is buffer number. V set means purge, V clear means count.
|
||||
* C set means space left, C clear means entries used
|
||||
* On exit: For purge, X & Y are preserved.
|
||||
* For count, value in X (Y=0).
|
||||
* A undef. V,C flags preserved.
|
||||
* Stub that calls into main memory
|
||||
CNPHND PHP
|
||||
PHX
|
||||
PHY
|
||||
PHP ; Flags->A for transfer
|
||||
PLA
|
||||
PHX ; X->Y for transfer
|
||||
PLY
|
||||
>>> XF2MAIN,MAINCNP
|
||||
CNPHNDRET1 >>> ENTAUX ; Return after count
|
||||
PHY ; Y->X after transfer
|
||||
PLX
|
||||
PLY ; Discard stacked Y
|
||||
PLY ; Discard stacked X
|
||||
LDY #$00 ; Y=0 for count
|
||||
PLP
|
||||
RTS
|
||||
CNPHNDRET2 >>> ENTAUX ; Return after purge
|
||||
PLY ; Recover X,Y and flags
|
||||
PLX
|
||||
PLP
|
||||
RTS
|
||||
|
@ -94,8 +94,8 @@ 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 WORD08 ; OSWORD 8 - ENVELOPE
|
||||
DW WORD07 ; OSWORD 7 - SOUND
|
||||
DW WORD08 ; OSWORD 8 - ENVELOPE
|
||||
* DW WORD09 ; OSWORD 9 - POINT
|
||||
* DW WORD0A ; OSWORD 10 - Read character bitmap
|
||||
* DW WORD0B ; OSWORD 11 - Read palette
|
||||
|
477
mainmem.audio.s
Normal file
477
mainmem.audio.s
Normal file
@ -0,0 +1,477 @@
|
||||
* MAINMEM.AUDIO.S
|
||||
* (c) Bobbi 2022 GPLv3
|
||||
*
|
||||
* Applecorn audio code
|
||||
*
|
||||
|
||||
* Sound buffers
|
||||
SNDBUFSZ EQU 21 ; FOR 4 NOTES + spare byte
|
||||
SNDBUF0 DS SNDBUFSZ
|
||||
SNDBUF1 DS SNDBUFSZ
|
||||
SNDBUF2 DS SNDBUFSZ
|
||||
SNDBUF3 DS SNDBUFSZ
|
||||
|
||||
* Pointers for circular buffers
|
||||
* Buffers 4-7 correspond to audio channels 0 to 3
|
||||
* Buffers 0-3 are currently unused
|
||||
SND0STARTIDX DB $00 ; Start indices for sound bufs
|
||||
SND1STARTIDX DB $00
|
||||
SND2STARTIDX DB $00
|
||||
SND3STARTIDX DB $00
|
||||
STARTINDICES EQU SND0STARTIDX - 4
|
||||
|
||||
SND0ENDIDX DB $00 ; End indices for sound bufs
|
||||
SND1ENDIDX DB $00
|
||||
SND2ENDIDX DB $00
|
||||
SND3ENDIDX DB $00
|
||||
ENDINDICES EQU SND0ENDIDX - 4
|
||||
|
||||
* Get address of sound buffer
|
||||
* On entry: X is buffer number
|
||||
* On exit: OSIRQWS points to start of buffer
|
||||
* Called with interrupts disabled
|
||||
GETBUFADDR LDA :BUFADDRL,X
|
||||
STA OSINTWS+0
|
||||
LDA :BUFADDRH,X
|
||||
STA OSINTWS+1
|
||||
RTS
|
||||
:BUFADDRL DB $00
|
||||
DB $00
|
||||
DB $00
|
||||
DB $00
|
||||
DB <SNDBUF0
|
||||
DB <SNDBUF1
|
||||
DB <SNDBUF2
|
||||
DB <SNDBUF3
|
||||
DB $00
|
||||
:BUFADDRH DB $00
|
||||
DB $00
|
||||
DB $00
|
||||
DB $00
|
||||
DB >SNDBUF0
|
||||
DB >SNDBUF1
|
||||
DB >SNDBUF2
|
||||
DB >SNDBUF3
|
||||
DB $00
|
||||
|
||||
|
||||
* Insert value into buffer (API same as Acorn MOS INSV)
|
||||
* On entry: A is value, X is buffer number.
|
||||
* On exit: A, X, Y preserved. C clear on success.
|
||||
INS PHP ; Save flags, turn off interrupts
|
||||
SEI
|
||||
PHY
|
||||
PHA
|
||||
LDY ENDINDICES,X ; Get input pointer
|
||||
INY ; Next byte
|
||||
CPY #SNDBUFSZ
|
||||
BNE :NOTEND ; See if it's the end
|
||||
LDY #0 ; If so, wraparound
|
||||
:NOTEND TYA ; New input pointer in A
|
||||
CMP STARTINDICES,X ; See if buffer is full
|
||||
BEQ :FULL
|
||||
LDY ENDINDICES,X ; Current position
|
||||
STA ENDINDICES,X ; Write updated input pointer
|
||||
JSR GETBUFADDR ; Buffer address into OSINTWS
|
||||
PLA ; Get value to write back
|
||||
STA (OSINTWS),Y ; Write to buffer
|
||||
PLY
|
||||
PLP ; Restore flags
|
||||
CLC ; Exit with carry clear
|
||||
RTS
|
||||
:FULL PLA ; Restore A
|
||||
PLY
|
||||
PLP ; Restore flags
|
||||
SEC ; Exit with carry set
|
||||
RTS
|
||||
|
||||
|
||||
* Entry point to INS for code running in aux
|
||||
MAININS >>> ENTMAIN
|
||||
PHY ; Y->X after transfer
|
||||
PLX
|
||||
JSR INS
|
||||
PHP ; Flags->A before transfer back
|
||||
PLA
|
||||
>>> XF2AUX,INSHNDRET
|
||||
|
||||
|
||||
* Remove value from buffer or examine buffer (API same as Acorn MOS REMV)
|
||||
* On entry: X is buffer number, V=1 if only examination is requested
|
||||
* On exit: If examination, A next byte, X preserved, Y=offset to next char
|
||||
* If removal, A undef, X preserved, Y value of byte removed
|
||||
* If buffer already empty C=1, else C=0
|
||||
REM PHP ; Save flags, turn off interrupts
|
||||
SEI
|
||||
LDA STARTINDICES,X ; Output pointer for buf X
|
||||
CMP ENDINDICES,X
|
||||
BEQ :EMPTY ; Buffer is empty
|
||||
TAY ; Buffer pointer into Y
|
||||
JSR GETBUFADDR ; Buffer address into OSINTWS
|
||||
LDA (OSINTWS),Y ; Read byte from buffer
|
||||
PHA ; Stash for later
|
||||
BVS :EXAM ; If only examination, done
|
||||
INY ; Next byte
|
||||
CPY #SNDBUFSZ
|
||||
BNE :NOTEND ; See if it's the end
|
||||
LDY #0 ; If so, wraparound
|
||||
:NOTEND TYA
|
||||
STA STARTINDICES,X ; Set output pointer
|
||||
PLY ; Char read from buffer
|
||||
PLP
|
||||
CLC ; Success
|
||||
RTS
|
||||
:EXAM PLA ; Char read from buffer
|
||||
PLP
|
||||
CLC ; Success
|
||||
RTS
|
||||
:EMPTY PLP
|
||||
SEC ; Buffer already empty
|
||||
RTS
|
||||
|
||||
* Remove value from buffer according to audio channel (0-4)
|
||||
* On entry: X is audio channel number
|
||||
* On exit: A undef, X preserved, Y value of byte removed
|
||||
REMAUDIO PHX ; Preserve X
|
||||
TXA ; Audio channel X->A
|
||||
ORA #$04 ; Convert to queue number
|
||||
TAX ; Queue number ->X
|
||||
CLV ; Remove byte from queue
|
||||
JSR REM
|
||||
PLX ; Recover original X
|
||||
RTS
|
||||
|
||||
* Inspect value in buffer according to audio channel (0-4)
|
||||
* On entry: X is audio channel number
|
||||
* On exit: A next byte, X preserved, Y offset to next char
|
||||
PEEKAUDIO PHX ; Preserve X
|
||||
TXA ; Audio channel X->A
|
||||
ORA #$04 ; Convert to queue number
|
||||
TAX ; Queue number ->X
|
||||
BIT :RTS ; Set V, inspect queue
|
||||
JSR REM
|
||||
PLX ; Recover original X
|
||||
:RTS RTS
|
||||
|
||||
|
||||
* Count space in buffer or purge buffer (API same as Acorn MOS CNPV)
|
||||
* On entry: X is buffer number. V set means purge, V clear means count.
|
||||
* C set means space left, C clear means entries used
|
||||
* On exit: For purge, X & Y are preserved.
|
||||
* For count, value in X (Y=0).
|
||||
* A undef. V,C flags preserved.
|
||||
CNP PHP ; Preserve flags
|
||||
BVS :PURGE ; Purge if V set
|
||||
SEC ; Compute space used
|
||||
LDA ENDINDICES,X
|
||||
SBC STARTINDICES,X
|
||||
BPL :POS ; No wrap-around
|
||||
CLC ; Wrap-around - add SNDBUFSZ
|
||||
ADC #SNDBUFSZ
|
||||
:POS LDY #$00 ; MSB of count always zero
|
||||
PLP ; Recover flags
|
||||
BCS :CNTREM ; If C set on entry, count remainder
|
||||
TAX ; Return value in X
|
||||
RTS
|
||||
:CNTREM EOR #$FF ; Negate and add SNDBUFSZ
|
||||
SEC
|
||||
ADC #SNDBUFSZ
|
||||
TAX ; Return value in X
|
||||
RTS
|
||||
:PURGE LDA ENDINDICES,X ; Eat all buffer contents
|
||||
STA STARTINDICES,X
|
||||
STZ OSCTIMES-4,X ; Set to zero time remaining
|
||||
PLP ; Recover flags
|
||||
RTS
|
||||
|
||||
|
||||
* Entry point to CNP for code running in aux
|
||||
MAINCNP >>> ENTMAIN
|
||||
PHY ; Y->X after transfer
|
||||
PLX
|
||||
PHA ; A->flags after transfer
|
||||
PLP
|
||||
BVS :PURGE
|
||||
JSR CNP ; Count space
|
||||
PHX ; X->Y for transfer back
|
||||
PLY
|
||||
>>> XF2AUX,CNPHNDRET1 ; Return for counting
|
||||
:PURGE JSR CNP ; Purge buffer
|
||||
PHX ; X->Y for transfer back
|
||||
PLY
|
||||
>>> XF2AUX,CNPHNDRET2 ; Return for purging
|
||||
|
||||
|
||||
* Process releasing of notes once chord is complete.
|
||||
* On entry: A chord sequence number, X audio channel
|
||||
* Preserves all registers
|
||||
CHORD PHA
|
||||
PHX
|
||||
PHY
|
||||
*
|
||||
* Part 1: Count all notes at head of queues with seq number = A
|
||||
*
|
||||
STA :SEQ ; Sequence number looking for
|
||||
STZ :CNT ; Initialize counter
|
||||
LDX #3 ; Process all audio queues
|
||||
:L1 JSR PEEKAUDIO ; See byte at head of queue
|
||||
BCS :NEXT ; Empty queue
|
||||
AND #$0F ; Mask out hold nybble
|
||||
CMP :SEQ ; If matches ..
|
||||
BNE :NEXT
|
||||
INC :CNT ; .. count it
|
||||
:NEXT DEX
|
||||
BPL :L1 ; Next audio queue
|
||||
*
|
||||
* Part 2: If count = seq number + 1
|
||||
*
|
||||
INC :SEQ ; Seq number + 1
|
||||
LDA :CNT ; Compare with counter
|
||||
CMP :SEQ
|
||||
BEQ :RELCHORD ; Release notes
|
||||
:DONE PLY
|
||||
PLX
|
||||
PLA
|
||||
RTS
|
||||
*
|
||||
* Part 3: Overwrite seq numbers with zero to release notes.
|
||||
*
|
||||
:RELCHORD DEC :SEQ ; Put seq back how it was
|
||||
LDX #3 ; All audio queues
|
||||
:L2 JSR PEEKAUDIO ; See byte at head of queue
|
||||
BCS :NEXT2 ; Empty queue
|
||||
AND #$0F ; Mask out hold nybble
|
||||
CMP :SEQ ; See if matches
|
||||
BNE :NEXT2 ; Nope, skip
|
||||
PHX
|
||||
TXA
|
||||
ORA #$04 ; Convert to buffer number
|
||||
TAX
|
||||
JSR GETBUFADDR ; Audio buf addr -> OSINTWS
|
||||
PLX
|
||||
LDA #$00
|
||||
STA (OSINTWS),Y ; Zero sync nybble (+ hold nybble)
|
||||
:NEXT2 DEX
|
||||
BPL :L2 ; Next audio queue
|
||||
BRA :DONE
|
||||
:SEQ DB $00 ; Sequence number
|
||||
:CNT DB $00 ; Counter
|
||||
|
||||
|
||||
* Called from Ensoniq interrupt handler - process audio queue
|
||||
* Should be called at 100Hz
|
||||
ENSQISR INC COUNTER+0 ; Increment centisecond timer
|
||||
BNE :S1
|
||||
INC COUNTER+1
|
||||
:S1 DEC :CNT ; Find every 5th cycle
|
||||
BNE :NOT20HZ
|
||||
LDA #5
|
||||
STA :CNT
|
||||
|
||||
LDX #3 ; Process four audio queues
|
||||
:L1 LDA OSCTIMES,X ; Time remaining on current note
|
||||
BEQ :NONOTE ; No note playing
|
||||
DEC OSCTIMES,X
|
||||
BRA :NEXT
|
||||
:NONOTE LDY #$00 ; Zero volume
|
||||
LDA #$00 ; Zero freq
|
||||
JSR ENSQNOTE ; Silence channel Y
|
||||
|
||||
JSR PEEKAUDIO ; Inspect byte at head of queue
|
||||
BCS :NEXT ; Nothing in queue
|
||||
; NOTE: A contains HS byte of &HSFC
|
||||
AND #$0F ; Mask out hold nybble
|
||||
BNE :SYNCSET ; Do not play if sync != 0
|
||||
|
||||
* The following is paranoid maybe. Perhaps can be removed once I am debugged.
|
||||
PHX
|
||||
PHY
|
||||
INX ; Convert audio channel to buf num
|
||||
INX
|
||||
INX
|
||||
INX
|
||||
CLV ; Ask to count buffer
|
||||
CLC ; Ask for space used
|
||||
JSR CNP ; Go count it
|
||||
TXA
|
||||
PLY
|
||||
PLX
|
||||
CMP #3 ; At least 4 bytes used?
|
||||
BMI :NEXT
|
||||
* End paranoid section.
|
||||
|
||||
JSR REMAUDIO ; Remove byte from queue
|
||||
JSR REMAUDIO ; Remove byte from queue
|
||||
PHY ; Amplitude
|
||||
JSR REMAUDIO ; Remove byte from queue
|
||||
PHY ; Frequency
|
||||
JSR REMAUDIO ; Remove byte from queue
|
||||
TYA ; Duration
|
||||
STA OSCTIMES,X
|
||||
PLA ; Recover frequency
|
||||
PLY ; Recover amplitude
|
||||
JSR ENSQNOTE ; Start note playing
|
||||
:NEXT DEX
|
||||
BPL :L1 ; Next audio queue
|
||||
:NOT20HZ
|
||||
*
|
||||
* TODO: Envelope processing on all cycles (AT 100Hz)
|
||||
*
|
||||
CLC
|
||||
RTL
|
||||
:SYNCSET JSR CHORD ; See if chord can be released
|
||||
BRA :NEXT
|
||||
:CNT DB $05 ; Used to determine 20Hz cycles
|
||||
COUNTER DW $0000 ; Centisecond counter
|
||||
|
||||
* Time remaining for current note, in 1/20th of second
|
||||
OSCTIMES DB $00
|
||||
DB $00
|
||||
DB $00
|
||||
DB $00
|
||||
|
||||
|
||||
* Ensoniq control registers
|
||||
ENSQSNDCTL EQU $C03C
|
||||
ENSQSNDDAT EQU $C03D
|
||||
ENSQADDRL EQU $C03E
|
||||
ENSQADDRH EQU $C03F
|
||||
|
||||
* Initialize Ensoniq
|
||||
* Setup wavetable - one period of a square wave
|
||||
* Start timer on oscillator #4, silence oscillators 0 to 3
|
||||
ENSQINIT LDX #3
|
||||
LDA #$80 ; Initialize sound queues
|
||||
:L0 STZ SND0STARTIDX,X
|
||||
STZ SND0ENDIDX,X
|
||||
DEX
|
||||
BNE :L0
|
||||
|
||||
LDA ENSQSNDCTL ; Get settings
|
||||
ORA #$60 ; DOC RAM, autoincrement on
|
||||
STA ENSQSNDCTL ; Set it
|
||||
LDA #$00
|
||||
STA ENSQADDRL ; DOC RAM addr $0000
|
||||
STA ENSQADDRH ; DOC RAM addr $0000
|
||||
LDA #120 ; High value of square wave
|
||||
LDX #$00
|
||||
:L1 STA ENSQSNDDAT ; 128 cycles of high value
|
||||
INX
|
||||
CPX #128
|
||||
BNE :L1
|
||||
LDA #80 ; Low value of square wave
|
||||
:L2 STA ENSQSNDDAT ; 128 cycles of low value
|
||||
INX
|
||||
CPX #0
|
||||
BNE :L2
|
||||
|
||||
LDA #$5C ; GS IRQ.SOUND initialization
|
||||
STAL $E1002C
|
||||
LDA #<ENSQISR
|
||||
STAL $E1002D
|
||||
LDA #>ENSQISR
|
||||
STAL $E1002E
|
||||
LDA #$00 ; Bank $00
|
||||
STAL $E1002F
|
||||
|
||||
LDX #$E1 ; DOC Osc Enable register $E1
|
||||
LDY #10 ; Five oscillators enabled
|
||||
JSR ENSQWRTDOC
|
||||
LDY #$00 ; Amplitude for osc #4 (timer)
|
||||
LDA #$20 ; Frequency for osc #4 (timer)
|
||||
LDX #$04
|
||||
JSR ENSQNOTE ; Start oscillator 4
|
||||
LDX #$A4 ; Control register for osc #4
|
||||
LDY #$08 ; Free run, with IRQ, start
|
||||
JSR ENSQWRTDOC
|
||||
; Fall through
|
||||
* Silence all channels
|
||||
ENSQSILENT LDY #$00 ; Amplitude
|
||||
LDA #$80 ; Frequency
|
||||
LDX #$03
|
||||
:L1 JSR ENSQNOTE ; Initialize channel Y
|
||||
STZ OSCTIMES,X ; No note playing
|
||||
DEX
|
||||
BPL :L1
|
||||
RTS
|
||||
|
||||
|
||||
* Configure an Ensoniq oscillator to play a note
|
||||
* On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude
|
||||
* Preserves all registers
|
||||
ENSQNOTE PHA
|
||||
PHX
|
||||
PHY
|
||||
STX OSCNUM ; Stash oscillator number 0-3
|
||||
|
||||
PHA ; Stash orig freq
|
||||
TAY
|
||||
LDA FREQLOW,Y
|
||||
TAY ; Frequency value LS byte
|
||||
LDA #$00 ; DOC register base $00 (Freq Lo)
|
||||
JSR ADDOSC ; Actual register in X
|
||||
JSR ENSQWRTDOC
|
||||
|
||||
PLA ; Get orig freq back
|
||||
TAY
|
||||
LDA FREQHIGH,Y
|
||||
TAY ; Frequency value MS byte
|
||||
LDA #$20 ; DOC register base $20 (Freq Hi)
|
||||
JSR ADDOSC ; Actual register in X
|
||||
JSR ENSQWRTDOC
|
||||
|
||||
PLY ; Amplitude value
|
||||
PHY
|
||||
LDA #$40 ; DOC register base $40 (Volume)
|
||||
JSR ADDOSC ; Actual register in X
|
||||
JSR ENSQWRTDOC
|
||||
|
||||
LDY #$00 ; Wavetable pointer $00
|
||||
LDA #$80 ; DOC register base $80 (Wavetable)
|
||||
JSR ADDOSC ; Actual register in X
|
||||
JSR ENSQWRTDOC
|
||||
|
||||
LDY #$00 ; Free run, no IRQ, start
|
||||
LDA #$A0 ; DOC register base $A0 (Control)
|
||||
JSR ADDOSC ; Actual register in X
|
||||
JSR ENSQWRTDOC
|
||||
|
||||
LDY #$00 ; For 256 byte wavetable
|
||||
LDA #$C0 ; DOC register base $C0 (WT size)
|
||||
JSR ADDOSC ; Actual register in X
|
||||
JSR ENSQWRTDOC
|
||||
|
||||
PLY
|
||||
PLX
|
||||
PLA
|
||||
RTS
|
||||
|
||||
* Add oscillator number to value in A, return sum in X
|
||||
* Used by ENSQNOTE
|
||||
ADDOSC CLC
|
||||
ADC OSCNUM
|
||||
TAX
|
||||
RTS
|
||||
OSCNUM DB $00
|
||||
|
||||
|
||||
* Wait for Ensoniq to be ready
|
||||
ENSQWAIT LDA ENSQSNDCTL
|
||||
BMI ENSQWAIT
|
||||
RTS
|
||||
|
||||
* Write to a DOC register
|
||||
* On entry: Value in Y, register in X
|
||||
* Preserves all registers
|
||||
ENSQWRTDOC PHA
|
||||
JSR ENSQWAIT ; Wait for DOC to be ready
|
||||
LDA ENSQSNDCTL
|
||||
AND #$90 ; DOC register, no autoincr
|
||||
ORA #$0F ; Master volume maximum
|
||||
STA ENSQSNDCTL
|
||||
STX ENSQADDRL ; Select DOC register
|
||||
STZ ENSQADDRH
|
||||
STY ENSQSNDDAT ; Write data
|
||||
PLA
|
||||
RTS
|
||||
|
768
mainmem.freq.s
768
mainmem.freq.s
@ -6,6 +6,198 @@
|
||||
*
|
||||
|
||||
FREQHIGH
|
||||
DB >77
|
||||
DB >78
|
||||
DB >79
|
||||
DB >81
|
||||
DB >82
|
||||
DB >83
|
||||
DB >84
|
||||
DB >85
|
||||
DB >87
|
||||
DB >88
|
||||
DB >89
|
||||
DB >90
|
||||
DB >92
|
||||
DB >93
|
||||
DB >94
|
||||
DB >96
|
||||
DB >97
|
||||
DB >99
|
||||
DB >100
|
||||
DB >102
|
||||
DB >103
|
||||
DB >105
|
||||
DB >106
|
||||
DB >108
|
||||
DB >109
|
||||
DB >111
|
||||
DB >112
|
||||
DB >114
|
||||
DB >116
|
||||
DB >117
|
||||
DB >119
|
||||
DB >121
|
||||
DB >122
|
||||
DB >124
|
||||
DB >126
|
||||
DB >128
|
||||
DB >130
|
||||
DB >132
|
||||
DB >134
|
||||
DB >136
|
||||
DB >137
|
||||
DB >139
|
||||
DB >142
|
||||
DB >144
|
||||
DB >146
|
||||
DB >148
|
||||
DB >150
|
||||
DB >152
|
||||
DB >154
|
||||
DB >157
|
||||
DB >159
|
||||
DB >161
|
||||
DB >164
|
||||
DB >166
|
||||
DB >168
|
||||
DB >171
|
||||
DB >173
|
||||
DB >176
|
||||
DB >178
|
||||
DB >181
|
||||
DB >184
|
||||
DB >186
|
||||
DB >189
|
||||
DB >192
|
||||
DB >194
|
||||
DB >197
|
||||
DB >200
|
||||
DB >203
|
||||
DB >206
|
||||
DB >209
|
||||
DB >212
|
||||
DB >215
|
||||
DB >218
|
||||
DB >221
|
||||
DB >225
|
||||
DB >228
|
||||
DB >231
|
||||
DB >235
|
||||
DB >238
|
||||
DB >241
|
||||
DB >245
|
||||
DB >249
|
||||
DB >252
|
||||
DB >256
|
||||
DB >260
|
||||
DB >263
|
||||
DB >267
|
||||
DB >271
|
||||
DB >275
|
||||
DB >279
|
||||
DB >283
|
||||
DB >287
|
||||
DB >291
|
||||
DB >296
|
||||
DB >300
|
||||
DB >304
|
||||
DB >309
|
||||
DB >313
|
||||
DB >318
|
||||
DB >322
|
||||
DB >327
|
||||
DB >332
|
||||
DB >337
|
||||
DB >342
|
||||
DB >346
|
||||
DB >352
|
||||
DB >357
|
||||
DB >362
|
||||
DB >367
|
||||
DB >372
|
||||
DB >378
|
||||
DB >383
|
||||
DB >389
|
||||
DB >395
|
||||
DB >400
|
||||
DB >406
|
||||
DB >412
|
||||
DB >418
|
||||
DB >424
|
||||
DB >430
|
||||
DB >437
|
||||
DB >443
|
||||
DB >449
|
||||
DB >456
|
||||
DB >462
|
||||
DB >469
|
||||
DB >476
|
||||
DB >483
|
||||
DB >490
|
||||
DB >497
|
||||
DB >504
|
||||
DB >512
|
||||
DB >519
|
||||
DB >527
|
||||
DB >534
|
||||
DB >542
|
||||
DB >550
|
||||
DB >558
|
||||
DB >566
|
||||
DB >574
|
||||
DB >583
|
||||
DB >591
|
||||
DB >600
|
||||
DB >608
|
||||
DB >617
|
||||
DB >626
|
||||
DB >635
|
||||
DB >645
|
||||
DB >654
|
||||
DB >664
|
||||
DB >673
|
||||
DB >683
|
||||
DB >693
|
||||
DB >703
|
||||
DB >713
|
||||
DB >724
|
||||
DB >734
|
||||
DB >745
|
||||
DB >756
|
||||
DB >767
|
||||
DB >778
|
||||
DB >789
|
||||
DB >801
|
||||
DB >812
|
||||
DB >824
|
||||
DB >836
|
||||
DB >848
|
||||
DB >861
|
||||
DB >873
|
||||
DB >886
|
||||
DB >899
|
||||
DB >912
|
||||
DB >925
|
||||
DB >938
|
||||
DB >952
|
||||
DB >966
|
||||
DB >980
|
||||
DB >994
|
||||
DB >1009
|
||||
DB >1023
|
||||
DB >1038
|
||||
DB >1053
|
||||
DB >1069
|
||||
DB >1084
|
||||
DB >1100
|
||||
DB >1116
|
||||
DB >1132
|
||||
DB >1149
|
||||
DB >1165
|
||||
DB >1182
|
||||
DB >1200
|
||||
DB >1217
|
||||
DB >1235
|
||||
DB >1253
|
||||
DB >1271
|
||||
@ -70,200 +262,200 @@ FREQHIGH
|
||||
DB >2979
|
||||
DB >3023
|
||||
DB >3067
|
||||
DB >3111
|
||||
DB >3157
|
||||
DB >3202
|
||||
DB >3249
|
||||
DB >3296
|
||||
DB >3344
|
||||
DB >3393
|
||||
DB >3442
|
||||
DB >3492
|
||||
DB >3543
|
||||
DB >3595
|
||||
DB >3647
|
||||
DB >3700
|
||||
DB >3754
|
||||
DB >3808
|
||||
DB >3864
|
||||
DB >3920
|
||||
DB >3977
|
||||
DB >4035
|
||||
DB >4093
|
||||
DB >4153
|
||||
DB >4213
|
||||
DB >4275
|
||||
DB >4337
|
||||
DB >4400
|
||||
DB >4464
|
||||
DB >4529
|
||||
DB >4595
|
||||
DB >4662
|
||||
DB >4729
|
||||
DB >4798
|
||||
DB >4868
|
||||
DB >4939
|
||||
DB >5011
|
||||
DB >5084
|
||||
DB >5157
|
||||
DB >5232
|
||||
DB >5309
|
||||
DB >5386
|
||||
DB >5464
|
||||
DB >5544
|
||||
DB >5624
|
||||
DB >5706
|
||||
DB >5789
|
||||
DB >5873
|
||||
DB >5959
|
||||
DB >6045
|
||||
DB >6133
|
||||
DB >6222
|
||||
DB >6313
|
||||
DB >6405
|
||||
DB >6498
|
||||
DB >6593
|
||||
DB >6688
|
||||
DB >6786
|
||||
DB >6884
|
||||
DB >6985
|
||||
DB >7086
|
||||
DB >7189
|
||||
DB >7294
|
||||
DB >7400
|
||||
DB >7507
|
||||
DB >7617
|
||||
DB >7727
|
||||
DB >7840
|
||||
DB >7954
|
||||
DB >8070
|
||||
DB >8187
|
||||
DB >8306
|
||||
DB >8427
|
||||
DB >8549
|
||||
DB >8674
|
||||
DB >8800
|
||||
DB >8928
|
||||
DB >9058
|
||||
DB >9190
|
||||
DB >9323
|
||||
DB >9459
|
||||
DB >9596
|
||||
DB >9736
|
||||
DB >9878
|
||||
DB >10021
|
||||
DB >10167
|
||||
DB >10315
|
||||
DB >10465
|
||||
DB >10617
|
||||
DB >10772
|
||||
DB >10928
|
||||
DB >11087
|
||||
DB >11248
|
||||
DB >11412
|
||||
DB >11578
|
||||
DB >11747
|
||||
DB >11917
|
||||
DB >12091
|
||||
DB >12267
|
||||
DB >12445
|
||||
DB >12626
|
||||
DB >12810
|
||||
DB >12996
|
||||
DB >13185
|
||||
DB >13377
|
||||
DB >13571
|
||||
DB >13769
|
||||
DB >13969
|
||||
DB >14172
|
||||
DB >14378
|
||||
DB >14587
|
||||
DB >14800
|
||||
DB >15015
|
||||
DB >15233
|
||||
DB >15455
|
||||
DB >15680
|
||||
DB >15908
|
||||
DB >16139
|
||||
DB >16374
|
||||
DB >16612
|
||||
DB >16854
|
||||
DB >17099
|
||||
DB >17348
|
||||
DB >17600
|
||||
DB >17856
|
||||
DB >18116
|
||||
DB >18379
|
||||
DB >18646
|
||||
DB >18918
|
||||
DB >19193
|
||||
DB >19472
|
||||
DB >19755
|
||||
DB >20043
|
||||
DB >20334
|
||||
DB >20630
|
||||
DB >20930
|
||||
DB >21234
|
||||
DB >21543
|
||||
DB >21857
|
||||
DB >22174
|
||||
DB >22497
|
||||
DB >22824
|
||||
DB >23156
|
||||
DB >23493
|
||||
DB >23835
|
||||
DB >24181
|
||||
DB >24533
|
||||
DB >24890
|
||||
DB >25252
|
||||
DB >25619
|
||||
DB >25992
|
||||
DB >26370
|
||||
DB >26754
|
||||
DB >27143
|
||||
DB >27538
|
||||
DB >27938
|
||||
DB >28344
|
||||
DB >28757
|
||||
DB >29175
|
||||
DB >29599
|
||||
DB >30030
|
||||
DB >30467
|
||||
DB >30910
|
||||
DB >31359
|
||||
DB >31816
|
||||
DB >32278
|
||||
DB >32748
|
||||
DB >33224
|
||||
DB >33707
|
||||
DB >34198
|
||||
DB >34695
|
||||
DB >35200
|
||||
DB >35712
|
||||
DB >36231
|
||||
DB >36758
|
||||
DB >37293
|
||||
DB >37835
|
||||
DB >38386
|
||||
DB >38944
|
||||
DB >39510
|
||||
DB >40085
|
||||
DB >40668
|
||||
DB >41260
|
||||
DB >41860
|
||||
DB >42469
|
||||
DB >43086
|
||||
DB >43713
|
||||
DB >44349
|
||||
DB >44994
|
||||
DB >45648
|
||||
DB >46312
|
||||
DB >46986
|
||||
DB >47669
|
||||
DB >48363
|
||||
DB >49066
|
||||
|
||||
FREQLOW
|
||||
DB <77
|
||||
DB <78
|
||||
DB <79
|
||||
DB <81
|
||||
DB <82
|
||||
DB <83
|
||||
DB <84
|
||||
DB <85
|
||||
DB <87
|
||||
DB <88
|
||||
DB <89
|
||||
DB <90
|
||||
DB <92
|
||||
DB <93
|
||||
DB <94
|
||||
DB <96
|
||||
DB <97
|
||||
DB <99
|
||||
DB <100
|
||||
DB <102
|
||||
DB <103
|
||||
DB <105
|
||||
DB <106
|
||||
DB <108
|
||||
DB <109
|
||||
DB <111
|
||||
DB <112
|
||||
DB <114
|
||||
DB <116
|
||||
DB <117
|
||||
DB <119
|
||||
DB <121
|
||||
DB <122
|
||||
DB <124
|
||||
DB <126
|
||||
DB <128
|
||||
DB <130
|
||||
DB <132
|
||||
DB <134
|
||||
DB <136
|
||||
DB <137
|
||||
DB <139
|
||||
DB <142
|
||||
DB <144
|
||||
DB <146
|
||||
DB <148
|
||||
DB <150
|
||||
DB <152
|
||||
DB <154
|
||||
DB <157
|
||||
DB <159
|
||||
DB <161
|
||||
DB <164
|
||||
DB <166
|
||||
DB <168
|
||||
DB <171
|
||||
DB <173
|
||||
DB <176
|
||||
DB <178
|
||||
DB <181
|
||||
DB <184
|
||||
DB <186
|
||||
DB <189
|
||||
DB <192
|
||||
DB <194
|
||||
DB <197
|
||||
DB <200
|
||||
DB <203
|
||||
DB <206
|
||||
DB <209
|
||||
DB <212
|
||||
DB <215
|
||||
DB <218
|
||||
DB <221
|
||||
DB <225
|
||||
DB <228
|
||||
DB <231
|
||||
DB <235
|
||||
DB <238
|
||||
DB <241
|
||||
DB <245
|
||||
DB <249
|
||||
DB <252
|
||||
DB <256
|
||||
DB <260
|
||||
DB <263
|
||||
DB <267
|
||||
DB <271
|
||||
DB <275
|
||||
DB <279
|
||||
DB <283
|
||||
DB <287
|
||||
DB <291
|
||||
DB <296
|
||||
DB <300
|
||||
DB <304
|
||||
DB <309
|
||||
DB <313
|
||||
DB <318
|
||||
DB <322
|
||||
DB <327
|
||||
DB <332
|
||||
DB <337
|
||||
DB <342
|
||||
DB <346
|
||||
DB <352
|
||||
DB <357
|
||||
DB <362
|
||||
DB <367
|
||||
DB <372
|
||||
DB <378
|
||||
DB <383
|
||||
DB <389
|
||||
DB <395
|
||||
DB <400
|
||||
DB <406
|
||||
DB <412
|
||||
DB <418
|
||||
DB <424
|
||||
DB <430
|
||||
DB <437
|
||||
DB <443
|
||||
DB <449
|
||||
DB <456
|
||||
DB <462
|
||||
DB <469
|
||||
DB <476
|
||||
DB <483
|
||||
DB <490
|
||||
DB <497
|
||||
DB <504
|
||||
DB <512
|
||||
DB <519
|
||||
DB <527
|
||||
DB <534
|
||||
DB <542
|
||||
DB <550
|
||||
DB <558
|
||||
DB <566
|
||||
DB <574
|
||||
DB <583
|
||||
DB <591
|
||||
DB <600
|
||||
DB <608
|
||||
DB <617
|
||||
DB <626
|
||||
DB <635
|
||||
DB <645
|
||||
DB <654
|
||||
DB <664
|
||||
DB <673
|
||||
DB <683
|
||||
DB <693
|
||||
DB <703
|
||||
DB <713
|
||||
DB <724
|
||||
DB <734
|
||||
DB <745
|
||||
DB <756
|
||||
DB <767
|
||||
DB <778
|
||||
DB <789
|
||||
DB <801
|
||||
DB <812
|
||||
DB <824
|
||||
DB <836
|
||||
DB <848
|
||||
DB <861
|
||||
DB <873
|
||||
DB <886
|
||||
DB <899
|
||||
DB <912
|
||||
DB <925
|
||||
DB <938
|
||||
DB <952
|
||||
DB <966
|
||||
DB <980
|
||||
DB <994
|
||||
DB <1009
|
||||
DB <1023
|
||||
DB <1038
|
||||
DB <1053
|
||||
DB <1069
|
||||
DB <1084
|
||||
DB <1100
|
||||
DB <1116
|
||||
DB <1132
|
||||
DB <1149
|
||||
DB <1165
|
||||
DB <1182
|
||||
DB <1200
|
||||
DB <1217
|
||||
DB <1235
|
||||
DB <1253
|
||||
DB <1271
|
||||
@ -328,195 +520,3 @@ FREQLOW
|
||||
DB <2979
|
||||
DB <3023
|
||||
DB <3067
|
||||
DB <3111
|
||||
DB <3157
|
||||
DB <3202
|
||||
DB <3249
|
||||
DB <3296
|
||||
DB <3344
|
||||
DB <3393
|
||||
DB <3442
|
||||
DB <3492
|
||||
DB <3543
|
||||
DB <3595
|
||||
DB <3647
|
||||
DB <3700
|
||||
DB <3754
|
||||
DB <3808
|
||||
DB <3864
|
||||
DB <3920
|
||||
DB <3977
|
||||
DB <4035
|
||||
DB <4093
|
||||
DB <4153
|
||||
DB <4213
|
||||
DB <4275
|
||||
DB <4337
|
||||
DB <4400
|
||||
DB <4464
|
||||
DB <4529
|
||||
DB <4595
|
||||
DB <4662
|
||||
DB <4729
|
||||
DB <4798
|
||||
DB <4868
|
||||
DB <4939
|
||||
DB <5011
|
||||
DB <5084
|
||||
DB <5157
|
||||
DB <5232
|
||||
DB <5309
|
||||
DB <5386
|
||||
DB <5464
|
||||
DB <5544
|
||||
DB <5624
|
||||
DB <5706
|
||||
DB <5789
|
||||
DB <5873
|
||||
DB <5959
|
||||
DB <6045
|
||||
DB <6133
|
||||
DB <6222
|
||||
DB <6313
|
||||
DB <6405
|
||||
DB <6498
|
||||
DB <6593
|
||||
DB <6688
|
||||
DB <6786
|
||||
DB <6884
|
||||
DB <6985
|
||||
DB <7086
|
||||
DB <7189
|
||||
DB <7294
|
||||
DB <7400
|
||||
DB <7507
|
||||
DB <7617
|
||||
DB <7727
|
||||
DB <7840
|
||||
DB <7954
|
||||
DB <8070
|
||||
DB <8187
|
||||
DB <8306
|
||||
DB <8427
|
||||
DB <8549
|
||||
DB <8674
|
||||
DB <8800
|
||||
DB <8928
|
||||
DB <9058
|
||||
DB <9190
|
||||
DB <9323
|
||||
DB <9459
|
||||
DB <9596
|
||||
DB <9736
|
||||
DB <9878
|
||||
DB <10021
|
||||
DB <10167
|
||||
DB <10315
|
||||
DB <10465
|
||||
DB <10617
|
||||
DB <10772
|
||||
DB <10928
|
||||
DB <11087
|
||||
DB <11248
|
||||
DB <11412
|
||||
DB <11578
|
||||
DB <11747
|
||||
DB <11917
|
||||
DB <12091
|
||||
DB <12267
|
||||
DB <12445
|
||||
DB <12626
|
||||
DB <12810
|
||||
DB <12996
|
||||
DB <13185
|
||||
DB <13377
|
||||
DB <13571
|
||||
DB <13769
|
||||
DB <13969
|
||||
DB <14172
|
||||
DB <14378
|
||||
DB <14587
|
||||
DB <14800
|
||||
DB <15015
|
||||
DB <15233
|
||||
DB <15455
|
||||
DB <15680
|
||||
DB <15908
|
||||
DB <16139
|
||||
DB <16374
|
||||
DB <16612
|
||||
DB <16854
|
||||
DB <17099
|
||||
DB <17348
|
||||
DB <17600
|
||||
DB <17856
|
||||
DB <18116
|
||||
DB <18379
|
||||
DB <18646
|
||||
DB <18918
|
||||
DB <19193
|
||||
DB <19472
|
||||
DB <19755
|
||||
DB <20043
|
||||
DB <20334
|
||||
DB <20630
|
||||
DB <20930
|
||||
DB <21234
|
||||
DB <21543
|
||||
DB <21857
|
||||
DB <22174
|
||||
DB <22497
|
||||
DB <22824
|
||||
DB <23156
|
||||
DB <23493
|
||||
DB <23835
|
||||
DB <24181
|
||||
DB <24533
|
||||
DB <24890
|
||||
DB <25252
|
||||
DB <25619
|
||||
DB <25992
|
||||
DB <26370
|
||||
DB <26754
|
||||
DB <27143
|
||||
DB <27538
|
||||
DB <27938
|
||||
DB <28344
|
||||
DB <28757
|
||||
DB <29175
|
||||
DB <29599
|
||||
DB <30030
|
||||
DB <30467
|
||||
DB <30910
|
||||
DB <31359
|
||||
DB <31816
|
||||
DB <32278
|
||||
DB <32748
|
||||
DB <33224
|
||||
DB <33707
|
||||
DB <34198
|
||||
DB <34695
|
||||
DB <35200
|
||||
DB <35712
|
||||
DB <36231
|
||||
DB <36758
|
||||
DB <37293
|
||||
DB <37835
|
||||
DB <38386
|
||||
DB <38944
|
||||
DB <39510
|
||||
DB <40085
|
||||
DB <40668
|
||||
DB <41260
|
||||
DB <41860
|
||||
DB <42469
|
||||
DB <43086
|
||||
DB <43713
|
||||
DB <44349
|
||||
DB <44994
|
||||
DB <45648
|
||||
DB <46312
|
||||
DB <46986
|
||||
DB <47669
|
||||
DB <48363
|
||||
DB <49066
|
||||
|
@ -111,6 +111,7 @@ DISCONN LDA MACHID
|
||||
STA DEVADR32+1
|
||||
DEC DEVCNT
|
||||
:S1
|
||||
* JSR ENSQINIT ; INITIALIZE ENSONIQ
|
||||
JSR ROMMENU ; This really needs to happen elsewhere
|
||||
|
||||
LDA #<:FDFILE
|
||||
|
Loading…
x
Reference in New Issue
Block a user