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
BYTE00A BRK
DB $F7
HELLO ASC 'Applecorn MOS 2022-11-21'
HELLO ASC 'Applecorn MOS 2022-11-22'
DB $00 ; Unify MOS messages
* TO DO: Move into RAM
GSSPEED DB $00 ; $80 if GS is fast, $00 for slow

View File

@ -510,6 +510,13 @@ CHECK4BYTES PHX
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
* On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude
* Preserves all registers
@ -525,8 +532,7 @@ AUDIONOTE PHA
* Adjust frequency of oscillator
* On entry: X - oscillator number 0-3 , Y - frequency to set
* Preserves X & Y
AUDIOFREQ
LDA AUDIOCARD
AUDIOFREQ LDA AUDIOCARD
BEQ :MOCK
JMP ENSQFREQ
:MOCK JMP MOCKFREQ
@ -535,8 +541,7 @@ AUDIOFREQ
* Adjust amplitude of oscillator
* On entry: X - oscillator number 0-3 , Y - amplitude to set
* Preserves X & Y
AUDIOAMP
LDA AUDIOCARD
AUDIOAMP LDA AUDIOCARD
BEQ :MOCK
JMP ENSQAMP
:MOCK JMP MOCKAMP

View File

@ -69,6 +69,14 @@ ENSQSILENT LDY #$00 ; Amplitude
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
* On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude
* Preserves all registers

View File

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

View File

@ -114,3 +114,6 @@ ALLOCPL HEX 02 ; Number of parameters
DB $00 ; Interrupt number returned here
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
LDA #$40 ; Configure VIA interrupt
STA MOCK_6522_ACR
LDA #$7F
LDA #$7F ; Clear all bits
STA MOCK_6522_IER
LDA #$C0
LDA #$C0 ; Set bit 6
STA MOCK_6522_IFR
STA MOCK_6522_IER
LDA #$F4 ; $27F4 => 100Hz
@ -94,6 +94,18 @@ MOCKSILENT LDX #13 ; Clear all 14 AY-3 regs
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
* On entry: X - oscillator number 0-3, A - frequency, Y - amplitude
* Preserves all registers

View File

@ -939,7 +939,8 @@ CHKNOTFND CMP #$44 ; Convert ProDOS 'not found'
* 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 CLRALTCHAR ; Alt font off
JSR MLI