Shutdown interrupt & deregister ISR on *QUIT.

This commit is contained in:
Bobbi Webber-Manners 2022-11-22 16:10:06 -05:00
parent d33b3cd314
commit 3e3ada7972
8 changed files with 38 additions and 8 deletions

Binary file not shown.

View File

@ -290,7 +290,7 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error
RTS ; %000x1xxx host type, 'A'pple RTS ; %000x1xxx host type, 'A'pple
BYTE00A BRK BYTE00A BRK
DB $F7 DB $F7
HELLO ASC 'Applecorn MOS 2022-11-21' HELLO ASC 'Applecorn MOS 2022-11-22'
DB $00 ; Unify MOS messages DB $00 ; Unify MOS messages
* TO DO: Move into RAM * TO DO: Move into RAM
GSSPEED DB $00 ; $80 if GS is fast, $00 for slow GSSPEED DB $00 ; $80 if GS is fast, $00 for slow

View File

@ -510,6 +510,13 @@ CHECK4BYTES PHX
RTS RTS
* Stop the sound device (no more interrupts)
AUDIOSTOP LDA AUDIOCARD
BEQ :MOCK
JMP ENSQSTOP
:MOCK JMP MOCKSTOP
* Configure an oscillator to play a note * Configure an oscillator to play a note
* On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude * On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude
* Preserves all registers * Preserves all registers
@ -525,8 +532,7 @@ AUDIONOTE PHA
* Adjust frequency of oscillator * Adjust frequency of oscillator
* On entry: X - oscillator number 0-3 , Y - frequency to set * On entry: X - oscillator number 0-3 , Y - frequency to set
* Preserves X & Y * Preserves X & Y
AUDIOFREQ AUDIOFREQ LDA AUDIOCARD
LDA AUDIOCARD
BEQ :MOCK BEQ :MOCK
JMP ENSQFREQ JMP ENSQFREQ
:MOCK JMP MOCKFREQ :MOCK JMP MOCKFREQ
@ -535,8 +541,7 @@ AUDIOFREQ
* Adjust amplitude of oscillator * Adjust amplitude of oscillator
* On entry: X - oscillator number 0-3 , Y - amplitude to set * On entry: X - oscillator number 0-3 , Y - amplitude to set
* Preserves X & Y * Preserves X & Y
AUDIOAMP AUDIOAMP LDA AUDIOCARD
LDA AUDIOCARD
BEQ :MOCK BEQ :MOCK
JMP ENSQAMP JMP ENSQAMP
:MOCK JMP MOCKAMP :MOCK JMP MOCKAMP

View File

@ -69,6 +69,14 @@ ENSQSILENT LDY #$00 ; Amplitude
RTS RTS
* Stop Ensoniq interrupt
ENSQSTOP JSR ENSQSILENT
LDX #$A4 ; Control register for osc #4
LDY #$00 ; Free run, no IRQ, start
JSR ENSQWRTDOC
RTS
* Configure an Ensoniq oscillator to play a note * Configure an Ensoniq oscillator to play a note
* On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude * On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude
* Preserves all registers * Preserves all registers

View File

@ -38,6 +38,7 @@ FBEND EQU FILEBLK+14 ; End address for SAVE
* ProDOS MLI command numbers * ProDOS MLI command numbers
ALLOCCMD EQU $40 ALLOCCMD EQU $40
DEALLOCCMD EQU $41
QUITCMD EQU $65 QUITCMD EQU $65
GTIMECMD EQU $82 GTIMECMD EQU $82
CREATCMD EQU $C0 CREATCMD EQU $C0

View File

@ -114,3 +114,6 @@ ALLOCPL HEX 02 ; Number of parameters
DB $00 ; Interrupt number returned here DB $00 ; Interrupt number returned here
DW $0000 ; Pointer to ISR DW $0000 ; Pointer to ISR
DEALLOCPL HEX 01 ; Number of parameters
DB $01 ; Interrupt number

View File

@ -71,9 +71,9 @@ MOCKINIT LDA #$FF ; All VIA pins output
SEI SEI
LDA #$40 ; Configure VIA interrupt LDA #$40 ; Configure VIA interrupt
STA MOCK_6522_ACR STA MOCK_6522_ACR
LDA #$7F LDA #$7F ; Clear all bits
STA MOCK_6522_IER STA MOCK_6522_IER
LDA #$C0 LDA #$C0 ; Set bit 6
STA MOCK_6522_IFR STA MOCK_6522_IFR
STA MOCK_6522_IER STA MOCK_6522_IER
LDA #$F4 ; $27F4 => 100Hz LDA #$F4 ; $27F4 => 100Hz
@ -94,6 +94,18 @@ MOCKSILENT LDX #13 ; Clear all 14 AY-3 regs
RTS RTS
* Stop Mockingboard interrupt
MOCKSTOP JSR MOCKSILENT
LDA #$7F ; Clear all bits
STA MOCK_6522_IER
LDA ALLOCPL+1 ; Interrupt number
STA DEALLOCPL+1
JSR MLI ; Deallocate ISR
DB DEALLOCCMD
DW DEALLOCPL
RTS
* Configure a Mockingboard oscillator to play a note * Configure a Mockingboard oscillator to play a note
* On entry: X - oscillator number 0-3, A - frequency, Y - amplitude * On entry: X - oscillator number 0-3, A - frequency, Y - amplitude
* Preserves all registers * Preserves all registers

View File

@ -939,7 +939,8 @@ CHKNOTFND CMP #$44 ; Convert ProDOS 'not found'
* Quit to ProDOS * Quit to ProDOS
QUIT INC PWRDUP ; Invalidate powerup byte QUIT JSR AUDIOSTOP ; Shut down audio, dereg ISR
INC PWRDUP ; Invalidate powerup byte
STA PAGE1 ; PAGE2 off STA PAGE1 ; PAGE2 off
STA CLRALTCHAR ; Alt font off STA CLRALTCHAR ; Alt font off
JSR MLI JSR MLI