A2osX/SYS/KERNEL.S.GP.txt

251 lines
5.5 KiB
Plaintext
Raw Normal View History

2016-06-07 06:10:18 +00:00
PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
2016-06-07 06:10:18 +00:00
INC 1
AUTO 6
*--------------------------------------
2016-09-26 16:00:52 +00:00
* SYSCALL (AUXLC to AUXLC)
* Used by user & kernel for inter bank Calls
2016-06-07 06:10:18 +00:00
* In:
* X = SYSfnc.Index
* Y,A = free for Inline param
*--------------------------------------
2016-09-26 16:00:52 +00:00
jmp A2osX.SYSCALL1
2016-06-07 06:10:18 +00:00
*--------------------------------------
* LIBCALL (AUXLC to AUXLC)
2016-09-26 16:00:52 +00:00
* Used by user
2016-06-07 06:10:18 +00:00
* In:
* Y = LIB.ID
* X = LIBfnc.Index
* A = free for Inline param
*--------------------------------------
jmp A2osX.LIBCALL1
*--------------------------------------
2016-09-26 16:00:52 +00:00
* MLICALL (AUXLC to MAINLC)
* Used by Kernel
2016-06-07 06:10:18 +00:00
* In:
* X = MLI Function
* A = Param Count
*--------------------------------------
jmp A2osX.MLICALL1
*--------------------------------------
* MLICALL (AUXLC to MAINLC)
* Used by Kernel
* In:
* X = MLI Function
* A = Param Count
*--------------------------------------
jmp A2osX.ROMCALL1
*--------------------------------------
* BADCALL
*--------------------------------------
lda #MLI.ERR.BADCALL
sec
rts
2016-06-07 06:10:18 +00:00
*--------------------------------------
2016-08-17 06:25:58 +00:00
jmp (pDev) pDevJmp
2016-06-07 06:10:18 +00:00
*--------------------------------------
2016-09-26 16:00:52 +00:00
* *** MUST BE REINTRANT ***
*--------------------------------------
A2osX.SYSCALL1 bit K.SYSCALL.BANK,x
2016-09-26 16:00:52 +00:00
bpl .8 in $E000, no BNK change
sta .7+1 save A (Func Arg)
lda K.SYSCALL.BANK,x Get Target BNK
2016-09-26 16:00:52 +00:00
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.....
2016-09-26 16:00:52 +00:00
stx .5+1 save X
plx get back Source BNK
bit $C000,x
bit $C000,x
2016-09-26 16:00:52 +00:00
.5 ldx #$FF Self Modified
rts Unmodified Carry
.6 ldx #$FF Self Modified
.7 lda #$FF Self Modified
.8 jmp (K.SYSCALL.JMP,x)
2016-09-26 16:00:52 +00:00
*--------------------------------------
A2osX.LIBCALL1 pha No need to save X, K.GetMemPtr.A will leave it unmodified
2016-09-26 16:00:52 +00:00
tya Get LIB hMem in A
jsr K.GetMemPtr.A Get LIB Code Segment (MemMgr in $E000, no BNK change)
>STYA .1+1
2016-06-07 06:10:18 +00:00
pla
.1 jmp $ffff
2016-06-07 06:10:18 +00:00
*--------------------------------------
2016-09-26 16:00:52 +00:00
A2osX.MLICALL1 stx .1
sta K.MLI.PARAMS
2016-09-26 16:00:52 +00:00
jsr GO.ProDOS
2016-06-07 06:10:18 +00:00
jsr MLI
.1 .BS 1
.DA K.MLI.PARAMS
2016-09-26 16:00:52 +00:00
jsr GO.A2osX
2016-06-07 06:10:18 +00:00
rts
*--------------------------------------
A2osX.ROMCALL1 phx
ldx $D000
stx .8+1
bit RROMBNK1
plx
jsr .1
.8 ldx #$ff
bit $C000,x
bit $C000,x
rts
.1 jmp (.2,x)
.2 .DA $E7A7 FSUB
.DA $E7BE FADD
.DA $E941 LOG
.DA $E97F FMULT
.DA $EA66 FDIV
.DA $EAFD LOAD.FAC.FROM.INDEX
.DA $EB27 SETFOR
.DA $EC4A FIN
.DA $ED36 FOUT.1
.DA $EE8D SQR
.DA $EE97 FPWRT
.DA $EF09 EXP
.DA $EFEA COS
.DA $EFF1 SIN
.DA $F03A TAN
.DA $F09E ATN
*--------------------------------------
GO.DiskII.RW jsr GO.ProDOS
stx $42
sta $43
ldy #3
GO.DiskII.RW.1 lda $ffff,y Self Modified
sta $44,y
dey
bpl GO.DiskII.RW.1
jsr $D000
cli
jsr GO.A2osX
rts
*--------------------------------------
GO.ProDOS pha
lda $D000 We re coming from AUXLC, saving bank...
2016-09-26 16:00:52 +00:00
sta GO.A2osX.BNK+1
pla
php
2016-06-07 06:10:18 +00:00
clc
.HS 2C bit abs
2016-09-26 16:00:52 +00:00
GO.A2osX php
2016-06-07 06:10:18 +00:00
sec
2016-06-07 06:10:18 +00:00
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
2016-06-07 06:10:18 +00:00
ply
inx
bne .1
iny
2016-06-07 06:10:18 +00:00
.1 stx GO.EXIT.JMP+1
sty GO.EXIT.JMP+2
2016-09-26 16:00:52 +00:00
bcs GO.A2osX.BNK if CS, go AUXLC
bit RRAMWRAMBNK1 Go MAINLC (ProDOS), always BNK1
bit RRAMWRAMBNK1
tsx
2016-06-07 06:10:18 +00:00
stx A2osX.SaveSX
ldx A2osX.SaveSM
txs
sta CLRALTZP
2016-06-07 06:10:18 +00:00
bra GO.EXIT
GO.A2osX.BNK ldx #RRAMWRAMBNK1 Self Modified, initialized to BNK1 for INIT3
bit $C000,x
bit $C000,x
sta SETALTZP
2016-06-07 06:10:18 +00:00
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
2016-06-07 06:10:18 +00:00
plp
2016-09-26 16:00:52 +00:00
GO.EXIT.JMP jmp $FFFF Self Modified
2016-06-07 06:10:18 +00:00
*--------------------------------------
* 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
*--------------------------------------
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
*--------------------------------------
*GO.Reset jsr GO.A2osX
* jmp CORE.Run
*--------------------------------------
*BrkHandler bra *
*--------------------------------------
.BS $BEE0-*
*--------------------------------------
.DA #6 60hz
.BS 7
.DA #0 ChRoot Disabled
.BS 7 All Slots marked as "Free"
2016-06-07 06:10:18 +00:00
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.GP
LOAD /A2OSX.SRC/SYS/KERNEL.S
2016-06-07 06:10:18 +00:00
ASM