A2osX/SYS/KERNEL.S.GP.txt
2017-02-08 17:42:32 +01:00

248 lines
5.5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.SRC
LOMEM $900
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* SYSCALL (AUXLC to AUXLC)
* Used by user & kernel for inter bank Calls
* In:
* X = SYSfnc.Index
* Y,A = free for Inline param
*--------------------------------------
jmp A2osX.SYSCALL1
*--------------------------------------
* LIBCALL (AUXLC to AUXLC)
* Used by user
* In:
* Y = LIB.ID
* X = LIBfnc.Index
* A = free for Inline param
*--------------------------------------
jmp A2osX.LIBCALL1
*--------------------------------------
* MLICALL (AUXLC to MAINLC)
* Used by Kernel
* In:
* X = MLI Function
* A = Param Count
*--------------------------------------
jmp A2osX.MLICALL1
*--------------------------------------
* BLKCALL (AUXLC to MAINLC)
* Used by Kernel
* In:
* Y,A = Ptr To Param Block
*--------------------------------------
jmp A2osX.BLKCALL1
*--------------------------------------
* PRTCALL (AUXLC to MAINLC)
* Used by Kernel
* In:
* Y,A = Ptr To Param Block
*--------------------------------------
jmp A2osX.PRTCALL1
*--------------------------------------
.BS $BD10-*
*--------------------------------------
jmp (pCode) pCodeJmp
jmp (pLib) pLibJmp
jmp (pDrv) pDrvJmp
jmp (pDev) pDevJmp
.BS $BD20-*
*--------------------------------------
GO.Reset jsr GO.A2osX
jmp K.KernelRun
*--------------------------------------
* *** MUST BE REINTRANT ***
*--------------------------------------
A2osX.SYSCALL1 bit KERNEL.SYSCALL.FLAGS,x
bpl .8 in $E000, no BNK change
sta .7+1 save A (Func Arg)
lda KERNEL.SYSCALL.FLAGS+1,x Get Target BNK
cmp $D000 #RRAMWRAMBNK1 or #RRAMWRAMBNK2
beq .7 same as actual BNK...go restore A and JMP
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
rts Unmodified Carry
.6 ldx #$FF Self Modified
.7 lda #$FF Self Modified
.8 jmp (KERNEL.SYSCALL,x)
*--------------------------------------
A2osX.LIBCALL1 pha No need to save X, K.GetMemPtrA will leave it unmodified
tya Get LIB hMem in A
jsr K.GetMemPtrA Get LIB Code Segment (MemMgr in $E000, no BNK change)
>STYA pLib
pla
jmp (pLib)
*--------------------------------------
A2osX.MLICALL1 stx .1
sta MLICALL.PARAMS
jsr GO.ProDOS
jsr MLI
.1 .BS 1
.DA MLICALL.PARAMS
jsr GO.A2osX
rts
*--------------------------------------
* BLKCALL.PARAMS moved to MainZP/LC
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
*--------------------------------------
A2osX.BLKCALL1 >STYA .2+1 setup device entry point $Cnxx
jsr GO.ProDOS
ldx #5
.1 lda BLKCALL.PARAMS,x
sta $42,x setup ZP in main memory for this block device calll
dex
bpl .1
.2 jsr $ffff
jsr GO.A2osX
rts
*--------------------------------------
* Smartport Call
*--------------------------------------
A2osX.PRTCALL1 >STYA .1+1
txa
lsr
sta .2
tax
lda A2osX.PRTCALL.Cnt,x
sta PRTCALL.PARAMS
.1 jsr $ffff
.2 .BS 1 CMD
.DA PRTCALL.PARAMS
rts
A2osX.PRTCALL.Cnt
.HS 03030301030101010404
*--------------------------------------
GO.ProDOS lda $D000 We re coming from AUXLC, saving bank...
sta GO.A2osX.BNK+1
php
clc
.HS 2C bit abs
GO.A2osX php
sec
sei
sta A2osX.SaveA
stx A2osX.SaveX
sty A2osX.SaveY
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
ldy pStack
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 sty pStack
pha push P on stack
ldy A2osX.SaveY
ldx A2osX.SaveX
lda A2osX.SaveA
plp
GO.EXIT.JMP jmp $FFFF Self Modified
*--------------------------------------
A2osX.SaveA .BS 1
A2osX.SaveX .BS 1
A2osX.SaveY .BS 1
*--------------------------------------
* Called for 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
*--------------------------------------
ProDOS.INTNUM .BS 1
*--------------------------------------
IrqHandler cld
lda RDALTZP
sta .2+1
bmi .1
sta SETALTZP
tsx
stx A2osX.SaveSM
ldx A2osX.SaveSX
txs
.1 jsr K.IrqHandler
.2 lda #$ff
bmi .3
tsx
stx A2osX.SaveSX
ldx A2osX.SaveSM
txs
sta CLRALTZP
.3 rts
*--------------------------------------
BrkHandler bra *
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.GP
LOAD SYS/KERNEL.S
ASM