-
Notifications
You must be signed in to change notification settings - Fork 8
/
mainmem.init.s
51 lines (40 loc) · 1.58 KB
/
mainmem.init.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
* MAINMEM.INIT.S
* (c) Bobbi 2021 GPLv3
*
* Initialization, interrupt handling and reset handling code
* that resides in main memory.
* 14-Nov-2021 If started from CSD, gets prefix to CMDBUF.
AUDIOCARD DB $00 ; $00 = Mockingboard, $01 = Ensoniq
* Trampoline in main memory used by aux memory IRQ handler
* to invoke Apple II / ProDOS IRQs in main memory
A2IRQ >>> IENTMAIN ; IENTMAIN does not do CLI
LDA #>A2IRQRET
PHA
LDA #<A2IRQRET
PHA
PHP ; Fake things to look like IRQ
JMP (A2IRQV) ; Call Apple II ProDOS ISR
A2IRQRET >>> XF2AUX,IRQBRKRET
* BRK handler in main memory. Used on Apple IIgs only.
GSBRK >>> XF2AUX,GSBRKAUX
* Reset handler - invoked on Ctrl-Reset
* XFER to AUXMOS ($D000) in aux, AuxZP on, LC on
RESET TSX
STX $0100
LDA AN0OFF ; AN0 off
LDA AN1OFF ; AN1 off
LDA AN2ON ; AN2 on
LDA AN3ON ; AN3 on
JSR RESETHW ; Reset hardware
>>> XF2AUX,AUXMOS
* Reset hardware
RESETHW SEC
STZ AUDIOCARD
JSR IDROUTINE ; See if this is a GS
BCS :NOTGS
JSR ENSQINIT ; Initialize Ensoniq
INC AUDIOCARD
RTS ; AUDIOCARD=1
:NOTGS
JSR MOCKINIT ; Initialize Mockingboard (sl4)
RTSINSTR RTS ; AUDIOCARD=0