A2osX/SYS/KERNEL.S.GP.txt

345 lines
7.9 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.BUILD
LOMEM $A00
INC 1
AUTO 6
*--------------------------------------
* 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
*--------------------------------------
jmp * SPARE
*--------------------------------------
* BADCALL
*--------------------------------------
lda #MLI.ERR.BADCALL
sec
rts
*--------------------------------------
jmp (pCode) pCodeJmp
jmp (*) pLibJmp
jmp (pDrv) pDrvJmp
jmp (pDev) pDevJmp
.BS $BD20-*
*--------------------------------------
GO.Reset jsr GO.A2osX
jmp CORE.Run
*--------------------------------------
* *** MUST BE REINTRANT ***
*--------------------------------------
A2osX.SYSCALL1 bit K.SYSCALL.BANK,x
bpl .8 in $E000, no BNK change
sta .7+1 save A (Func Arg)
lda K.SYSCALL.BANK,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 (K.SYSCALL.JMP,x)
*--------------------------------------
A2osX.LIBCALL1 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 jmp $ffff
*--------------------------------------
A2osX.MLICALL1 stx .1
sta K.MLI.PARAMS
jsr GO.ProDOS
jsr MLI
.1 .BS 1
.DA K.MLI.PARAMS
jsr GO.A2osX
rts
*--------------------------------------
* A2osX.DIIDrv
* X = DEVMGR.cmd
* Y,A = PTR to Params
* pDev -> Dev Header AUX!!!
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
*--------------------------------------
A2osX.DIIDrv .DA A2osX.DIIDrv.S status
.DA A2osX.DIIDrv.RW Read
.DA A2osX.DIIDrv.RW Write
.DA A2osX.BadCall Format
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
*--------------------------------------
A2osX.DIIDrv.S >LDYAI A2osx.DIIStat
clc
rts
*--------------------------------------
A2osX.DIIDrv.RW >STYA A2osX.Blk.GetParam.1+1
jsr A2osX.Blk.GetCmdAndDevAX
jsr GO.ProDOS
stx $42
sta $43
jsr A2osX.Blk.GetParam
jsr $D000
cli
jsr GO.A2osX
rts
*--------------------------------------
A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA 280
.DA #0
>PSTR "Disk II 5.25"
.BS 4
.DA #S.DEVSTAT.T.DISKII
.DA #0
.DA #0,#9
*--------------------------------------
* A2osX.BlkDrv
* X = DEVMGR.cmd
* Y,A = PTR to Params
* pDev -> Dev Header
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
*--------------------------------------
A2osX.BlkDrv .DA A2osX.BlkDrv.S status
.DA A2osX.BlkDrv.RW
.DA A2osX.BlkDrv.RW
.DA A2osX.BlkDrv.F
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
* .DA A2osX.DRV.BadCall
*--------------------------------------
A2osX.BlkDrv.S jsr A2osX.Blk.GetCmdAndDev
jsr A2osX.BlkDrv.Go
bcs .9
stx A2osx.BlkStat+S.DEVSTAT.SIZE
sty A2osx.BlkStat+S.DEVSTAT.SIZE+1
>LDYAI A2osX.BlkStat
clc
.9 rts
*--------------------------------------
A2osX.BlkDrv.RW >STYA A2osX.Blk.GetParam.1+1
jsr A2osX.Blk.GetCmdAndDev
jsr A2osX.Blk.GetParam
bra A2osX.BlkDrv.Go
*--------------------------------------
A2osX.BlkDrv.F jsr A2osX.Blk.GetCmdAndDev
A2osX.BlkDrv.Go ldy #S.DEV.ROM.JMP
lda (pDev),y
sta .8+1
iny
lda (pDev),y
sta .8+2
.8 jmp $ffff
*--------------------------------------
A2osX.BlkStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.BS 3
>PSTR "ProDOS Block Dev"
.DA #S.DEVSTAT.T.PRODOS
.DA #0
.DA #0,#9
*--------------------------------------
A2osX.Blk.GetParam
ldy #3
A2osX.Blk.GetParam.1
lda $ffff,y Self Modified
sta $44,y
dey
bpl A2osX.Blk.GetParam.1
rts
*--------------------------------------
A2osX.Blk.GetCmdAndDev
jsr A2osX.Blk.GetCmdAndDevAX
stx $42
sta $43
rts
A2osX.Blk.GetCmdAndDevAX
txa
lsr
tax CMD
ldy #S.DEV.DEVID Drive 1, or 2
lda (pDev),y
dec O or 1
lsr in Carry
php
ldy #S.DEV.BUSID
lda (pDev),y
asl
asl
asl
asl
asl
plp
ror DSSS0000
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
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
GO.EXIT.SaveY ldy #$ff
GO.EXIT.SaveX ldx #$ff
GO.EXIT.SaveA lda #$ff
plp
GO.EXIT.JMP jmp $FFFF Self Modified
*--------------------------------------
* 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 we are already in AuxZP/LC
sta SETALTZP coming from MainLC, switch to aux
tsx
stx A2osX.SaveSM
ldx A2osX.SaveSX
txs
.1 jsr K.IrqHandler
.2 lda #$ff get back ZP status when called
bmi .3 we were coming from AuxZP/LC
tsx go back to Main
stx A2osX.SaveSX
ldx A2osX.SaveSM
txs
sta CLRALTZP
.3 rts
*--------------------------------------
BrkHandler bra *
*--------------------------------------
.BS A2osX.HZ-* fill to $BEF0
*--------------------------------------
.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