mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
353 lines
7.4 KiB
Plaintext
353 lines
7.4 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*--------------------------------------
|
||
* SYSCALL (AUXLC to AUXLC)
|
||
* Used by user & kernel for inter bank Calls
|
||
* In:
|
||
* X = SYSfnc.Index
|
||
* Y,A = free for Inline param
|
||
*--------------------------------------
|
||
jmp GP.SysCall
|
||
*--------------------------------------
|
||
* LIBCALL (AUXLC to AUXLC)
|
||
* Used by user
|
||
* In:
|
||
* Y = LIB.ID
|
||
* X = LIBfnc.Index
|
||
* A = free for Inline param
|
||
*--------------------------------------
|
||
jmp GP.LibCall
|
||
*--------------------------------------
|
||
* AppleTalk MLICALL (AUXLC to MAINLC)
|
||
* Used by user
|
||
* In:
|
||
* Y,A = Params
|
||
*--------------------------------------
|
||
jmp GP.AtkCall
|
||
*--------------------------------------
|
||
* MLICALL (AUXLC to MAINLC)
|
||
* Used by Kernel
|
||
* In:
|
||
* X = MLI Function
|
||
* A = Param Count
|
||
*--------------------------------------
|
||
jmp GP.RomCall
|
||
*--------------------------------------
|
||
* BADCALL
|
||
*--------------------------------------
|
||
lda #MLI.E.BADCALL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
* SLEEP
|
||
*--------------------------------------
|
||
jmp CORE.Sleep
|
||
*--------------------------------------
|
||
* *** MUST BE REINTRANT ***
|
||
*--------------------------------------
|
||
GP.SysCall dec IRQ.InKernel
|
||
|
||
bit K.SYSCALL.BANK,x
|
||
bmi .1
|
||
|
||
jsr .8 in $E000, no BNK change
|
||
|
||
inc IRQ.InKernel
|
||
rts
|
||
|
||
.1 sta .7+1 save A (Func Arg)
|
||
|
||
lda K.SYSCALL.BANK,x Get Target BNK
|
||
|
||
cmp $D000 #RRAMWRAMBNK1 or #RRAMWRAMBNK2
|
||
bne .2
|
||
|
||
jsr .7 same as actual BNK...go restore A and JMP
|
||
|
||
inc IRQ.InKernel
|
||
rts
|
||
|
||
.2 stx .6+1 save X (Func ID)
|
||
|
||
tax set Target BNK in x
|
||
lda $D000 get source BNK
|
||
bit $C000,x switch to Target BNK
|
||
bit $C000,x
|
||
pha
|
||
|
||
jsr .6 go to kernel.....
|
||
|
||
stx .5+1 save X
|
||
plx get back Source BNK
|
||
bit $C000,x
|
||
bit $C000,x
|
||
.5 ldx #$FF Self Modified
|
||
|
||
inc IRQ.InKernel
|
||
rts Unmodified Carry
|
||
|
||
.6 ldx #$FF Self Modified
|
||
.7 lda #$FF Self Modified
|
||
.8 jmp (K.SYSCALL.JMP,x)
|
||
*--------------------------------------
|
||
GP.LibCall dec IRQ.InKernel
|
||
|
||
pha No need to save X, K.GetMemPtr.A will leave it unmodified
|
||
tya Get LIB hMem in A
|
||
jsr K.GetMemPtr.A Get LIB Code Segment (MemMgr in $E000, no BNK change)
|
||
>STYA .1+1
|
||
pla
|
||
.1 jsr * SELF MODIFIED
|
||
|
||
inc IRQ.InKernel
|
||
|
||
rts
|
||
*--------------------------------------
|
||
GP.AtkCall dec IRQ.InKernel
|
||
|
||
>STYA .1
|
||
jsr GO.ProDOS
|
||
jsr MLI
|
||
.DA #MLIATALK
|
||
.1 .DA *
|
||
jsr GO.A2osX
|
||
|
||
inc IRQ.InKernel
|
||
rts
|
||
*--------------------------------------
|
||
GP.RomCall dec IRQ.InKernel
|
||
|
||
phx
|
||
ldx $D000
|
||
stx .8+1
|
||
|
||
bit RROMBNK1
|
||
|
||
plx
|
||
jsr .1
|
||
|
||
.8 ldx #$ff
|
||
bit $C000,x
|
||
bit $C000,x
|
||
|
||
inc IRQ.InKernel
|
||
|
||
rts
|
||
|
||
.1 jmp (.2,x)
|
||
|
||
* http://www.txbobsc.com/scsc/scdocumentor/E7A0.html
|
||
|
||
.2 .DA $E7AA FSUBT
|
||
.DA $E7C1 FADDT
|
||
.DA $E82E NORMALIZE.FAC.2 (L->F)
|
||
.DA $E941 LOG
|
||
.DA $E987 FMULTT.1
|
||
.DA $E9E7 LOAD.ARG.FROM.INDEX
|
||
.DA $EA6B FDIVT+2
|
||
.DA $EAFD LOAD.FAC.FROM.INDEX
|
||
|
||
.DA $EB27 SETFOR (GETFAC)
|
||
.DA $EBB2 FCOMP
|
||
.DA $EBF2 QINT (F->L)
|
||
.DA $EC4A FIN StrToF
|
||
.DA $ED36 FOUT.1 PrintF
|
||
.DA $EE8D SQR
|
||
.DA $EE97 FPWRT
|
||
.DA $EF09 EXP
|
||
|
||
.DA $EFEA COS
|
||
.DA $EFF1 SIN
|
||
.DA $F03A TAN
|
||
.DA $F09E ATN
|
||
*--------------------------------------
|
||
GP.MLICall stx .1
|
||
sta K.MLI.PARAMS
|
||
jsr GO.ProDOS
|
||
jsr MLI
|
||
.1 .BS 1
|
||
.DA K.MLI.PARAMS
|
||
jsr GO.A2osX
|
||
rts
|
||
*--------------------------------------
|
||
GO.ProDOS pha
|
||
lda $D000 We re coming from AUXLC, saving bank...
|
||
sta GO.A2osX.BNK+1
|
||
pla
|
||
php
|
||
clc
|
||
.HS 2C bit abs
|
||
|
||
GO.A2osX php
|
||
sec
|
||
|
||
sei
|
||
|
||
sta GO.EXIT.SaveA+1
|
||
stx GO.EXIT.SaveX+1
|
||
sty GO.EXIT.SaveY+1
|
||
|
||
pla Restore P in A for later
|
||
|
||
plx Get PC and add 1 for return
|
||
ply
|
||
inx
|
||
bne .1
|
||
iny
|
||
|
||
.1 stx GO.EXIT.JMP+1
|
||
sty GO.EXIT.JMP+2
|
||
|
||
bcs GO.A2osX.BNK if CS, go AUXLC
|
||
|
||
bit RRAMWRAMBNK1 Go MAINLC (ProDOS), always BNK1
|
||
bit RRAMWRAMBNK1
|
||
|
||
tsx
|
||
stx A2osX.SaveSX
|
||
ldx A2osX.SaveSM
|
||
txs
|
||
sta CLRALTZP
|
||
bra GO.EXIT
|
||
|
||
GO.A2osX.BNK ldx #RRAMWRAMBNK1 Self Modified, initialized to BNK1 for INIT3
|
||
|
||
bit $C000,x
|
||
bit $C000,x
|
||
|
||
sta SETALTZP
|
||
tsx
|
||
stx A2osX.SaveSM
|
||
ldx A2osX.SaveSX
|
||
txs
|
||
*--------------------------------------
|
||
GO.EXIT pha push P on stack
|
||
GO.EXIT.SaveY ldy #$ff
|
||
GO.EXIT.SaveX ldx #$ff
|
||
GO.EXIT.SaveA lda #$ff
|
||
plp
|
||
GO.EXIT.JMP jmp $FFFF Self Modified
|
||
*--------------------------------------
|
||
* Called from ProDOS IRQ Manager (LCBNK1)
|
||
* A,X,Y, $FA->$FF Already Saved
|
||
* Main RAM,ZP/LC selected
|
||
* must begin with CLD
|
||
* must exit with RTS
|
||
* - CC if IRQ cleared, CS if NOT
|
||
*--------------------------------------
|
||
GP.IrqH cld
|
||
|
||
bit IRQ.SkipA2osX After A2osX IRQ.H ?
|
||
|
||
stz IRQ.SkipA2osX reset flag
|
||
|
||
GP.IrqH.BPL bpl GP.IrqH.DEV SELF MODIFIED
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
GP.IrqH.TCLOCK ldy IRQ.VBL.n0
|
||
|
||
lda $c080,y
|
||
and #$20
|
||
beq GP.IrqH.DEV
|
||
|
||
lda $c080,y
|
||
lda $c088,y
|
||
|
||
inc IRQ.Tick
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
GP.IrqH.VBL jsr IRQ.VBL.MSM SERVEMOUSE
|
||
bcs GP.IrqH.DEV Not From Mouse
|
||
|
||
ldx IRQ.VBL.0n
|
||
lda MOUSESTSx,x
|
||
and #MOUSESTSx.INTVBL IRQ was caused by VBL ?
|
||
beq GP.IrqH.DEV
|
||
|
||
ldx IRQ.VBL.MRM+2 $Cn
|
||
ldy IRQ.VBL.n0
|
||
jsr IRQ.VBL.MRM READMOUSE
|
||
|
||
inc IRQ.Tick
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
GP.IrqH.DEV sta SETALTZP switch to aux LC
|
||
tsx
|
||
stx A2osX.SaveSM
|
||
ldx A2osX.SaveSX
|
||
txs
|
||
|
||
>LDYAI Dev.Table
|
||
>STYA $fe
|
||
|
||
ldx DevMgr.Count
|
||
|
||
.4 ldy #S.DEV.S
|
||
lda ($fe),y
|
||
and #S.DEV.S.IRQ
|
||
beq .6
|
||
|
||
phx
|
||
jsr GP.IrqHJMP
|
||
plx
|
||
bcc .8 CC, IRQ cleared by device
|
||
|
||
.6 lda $fe
|
||
clc
|
||
adc #S.DEV
|
||
sta $fe
|
||
bcc .7
|
||
inc $ff
|
||
|
||
.7 dex
|
||
bne .4
|
||
|
||
sec
|
||
|
||
.8 tsx go back to Main
|
||
stx A2osX.SaveSX
|
||
ldx A2osX.SaveSM
|
||
txs
|
||
sta CLRALTZP
|
||
|
||
rts
|
||
*--------------------------------------
|
||
GP.IrqHJMP ldx #DEVMGR.IRQ
|
||
jmp ($fe)
|
||
*--------------------------------------
|
||
IRQ.SkipA2osX .BS 1
|
||
IRQ.Tick .BS 1
|
||
IRQ.InKernel .BS 1
|
||
IRQ.IntNum .BS 1
|
||
IRQ.VBL.n0 .BS 1
|
||
IRQ.VBL.0n .BS 1
|
||
IRQ.VBL.MSM jmp $0000
|
||
IRQ.VBL.MRM jmp $0000
|
||
*--------------------------------------
|
||
*GO.Reset jsr GO.A2osX
|
||
* jmp CORE.Run
|
||
*--------------------------------------
|
||
*BrkHandler bra *
|
||
*--------------------------------------
|
||
.BS $BEE0-*
|
||
*--------------------------------------
|
||
* $BEE0->$BEEF : Public Variables
|
||
*--------------------------------------
|
||
.BS 16
|
||
*--------------------------------------
|
||
* $BEF0->$BEFF : Kernel Config Block
|
||
*--------------------------------------
|
||
.DA #6 60hz
|
||
.BS 7
|
||
.DA #0 ChRoot Disabled
|
||
.BS 7 All Slots marked as "Free"
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.GP
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|