A2osX/SYS/KERNEL.S.GP.txt

394 lines
8.1 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2018-11-17 17:17:13 +00:00
PREFIX
2017-12-22 21:24:30 +00:00
AUTO 4,1
2016-06-07 06:10:18 +00:00
*--------------------------------------
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
*--------------------------------------
GP.CodeStart jmp GP.SysCall
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
*--------------------------------------
2017-10-27 14:56:46 +00:00
jmp GP.LibCall
2016-06-07 06:10:18 +00:00
*--------------------------------------
* AppleTalk MLICALL (AUXLC to MAINLC)
* Used by user
2016-06-07 06:10:18 +00:00
* In:
* Y,A = Params
2016-06-07 06:10:18 +00:00
*--------------------------------------
jmp GP.AtkCall
*--------------------------------------
2018-06-14 15:31:36 +00:00
* ROMCALL (AUXLC to ROMLC)
* Used by Kernel
* In:
2018-06-14 15:31:36 +00:00
* X = ROM Function
* Y,A = Param
*--------------------------------------
jmp GP.RomCall
*--------------------------------------
* BADCALL
*--------------------------------------
lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
* SLEEP
*--------------------------------------
php
sei
phy
ldy #S.PS.A
sta (pPs),y
txa
iny #S.PS.X
sta (pPs),y
pla
iny #S.PS.Y
sta (pPs),y
pla
iny #S.PS.P
sta (pPs),y
pla get PC LO
plx get PC HI
inc Advance one byte because of return by RTI
bne .1
inx
.1 iny #S.PS.PC
sta (pPs),y
txa
iny #S.PS.PC+1
sta (pPs),y
tsx
2019-01-04 13:17:31 +00:00
inx
inx keep PC HI,LO from KERNEL jsr PSExec/PSResume
inx Stack Ptr is $1ff if empty
txa
2019-01-04 13:17:31 +00:00
beq .3
tay Save !Byte count for later
.2 pla
>PUSHA
inx
bne .2
tya
2019-01-04 13:17:31 +00:00
.3 >PUSHA push CPU Stack BC to restore on top of Soft Stack
2019-01-04 13:17:31 +00:00
inc $1fe PC=PC+1
bne .4
inc $1ff because of RTI
.4 lda (pPs)
ora #S.PS.F.SLEEP
sta (pPs)
lda #0 cld,clc,cli
pha
rti exit to kernel with CC
2016-06-07 06:10:18 +00:00
*--------------------------------------
2016-09-26 16:00:52 +00:00
* *** MUST BE REINTRANT ***
*--------------------------------------
GP.SysCall dec IRQ.InKernel
bit K.SYSCALL.BANK,x
bmi .1
2016-09-26 16:00:52 +00:00
jsr .8 in $E000, no BNK change
inc IRQ.InKernel
rts
.1 sta .7+1 save A (Func Arg)
2016-09-26 16:00:52 +00:00
lda K.SYSCALL.BANK,x Get Target BNK
2016-09-26 16:00:52 +00:00
cmp $D000 #RRAMWRAMBNK1 or #RRAMWRAMBNK2
bne .2
jsr .7 same as actual BNK...go restore A and JMP
inc IRQ.InKernel
rts
2016-09-26 16:00:52 +00:00
.2 stx .6+1 save X (Func ID)
2016-09-26 16:00:52 +00:00
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
inc IRQ.InKernel
2016-09-26 16:00:52 +00:00
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
*--------------------------------------
GP.LibCall dec IRQ.InKernel
2018-06-21 15:12:10 +00:00
pha No need to save X, K.GetMemPtr will leave it unmodified
2016-09-26 16:00:52 +00:00
tya Get LIB hMem in A
2019-01-04 13:17:31 +00:00
jsr K.GetMemPtr Get LIB Code Segment (MemMgr in $E000, no BNK change)
>STYA .1+1
2016-06-07 06:10:18 +00:00
pla
2019-01-04 13:17:31 +00:00
.1 jsr $FFFF SELF MODIFIED
inc IRQ.InKernel
rts
2016-06-07 06:10:18 +00:00
*--------------------------------------
GP.AtkCall dec IRQ.InKernel
>STYA .1
2016-09-26 16:00:52 +00:00
jsr GO.ProDOS
2016-06-07 06:10:18 +00:00
jsr MLI
.DA #MLIATALK
.1 .DA *
2016-09-26 16:00:52 +00:00
jsr GO.A2osX
inc IRQ.InKernel
2016-06-07 06:10:18 +00:00
rts
*--------------------------------------
2019-01-04 13:17:31 +00:00
GP.RomCallPushFAC
jsr GP.ROMCALL
lda pStack
sec
sbc #5
sta pStack
sta FORPNT Ptr to dst buffer
lda pStack+1
sta FORPNT+1
ldx #ROM.GETFAC
jsr GP.ROMCALL
clc
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
2017-10-27 14:56:46 +00:00
.DA $E9E7 LOAD.ARG.FROM.INDEX
.DA $EA6B FDIVT+2
2017-10-27 14:56:46 +00:00
.DA $EAFD LOAD.FAC.FROM.INDEX
.DA $EB27 SETFOR (GETFAC)
.DA $EBB2 FCOMP
.DA $EBF2 QINT (F->L)
2017-10-27 14:56:46 +00:00
.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...
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
2018-11-19 07:43:00 +00:00
GO.EXIT.JMP jmp $FFFF SELF MODIFIED
2016-06-07 06:10:18 +00:00
*--------------------------------------
2017-11-23 16:51:52 +00:00
* 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 ?
bmi GP.IrqH.Exit
sta SETALTZP switch to aux LC
tsx
stx A2osX.SaveSM
ldx A2osX.SaveSX
txs
GP.IrqH.JSR jsr K.IrqH.DEV SELF MODIFIED
tsx go back to Main
stx A2osX.SaveSX
ldx A2osX.SaveSM
txs
sta CLRALTZP
rts
GP.IrqH.Exit stz IRQ.SkipA2osX reset flag
sec
rts
*--------------------------------------
2019-01-13 13:10:14 +00:00
CORE.VBLState .BS 1
CORE.IRQMode .BS 1
CORE.TickPerSec .BS 1
CORE.TickPer10t .BS 1
CORE.TickSec .BS 1
CORE.Tick10t .BS 1
CORE.CPUStatCnt .DA #100
CORE.LastPSID .DA #0
2019-01-24 13:53:29 +00:00
*--------------------------------------
DevMgr.Stat .DA DevMgr.FreeMem
DevMgr.Free .DA DevMgr.FreeMem
.DA DevMgr.HiMem
DevMgr.DevCnt .DA #0
DevMgr.NodCnt .DA #0
2019-01-13 13:10:14 +00:00
*--------------------------------------
2018-12-17 07:02:03 +00:00
IRQ.Mode .BS 1
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
2019-01-04 13:17:31 +00:00
IRQ.Vectors .BS K.IRQDEV.MAX*2
*--------------------------------------
*GO.Reset jsr GO.A2osX
* jmp CORE.Run
*--------------------------------------
*BrkHandler bra *
*--------------------------------------
GP.CodeEnd .BS $BEE0-*
2017-10-27 14:56:46 +00:00
*--------------------------------------
* $BEE0->$BEEF : Public Variables
*--------------------------------------
.BS 16
*--------------------------------------
* $BEF0->$BEFF : Kernel Config Block
*--------------------------------------
.DA #6 A2osX.HZ=60hz
2019-01-21 21:45:47 +00:00
.DA #2 A2osX.TTYDEVS=2
2018-12-10 16:45:37 +00:00
.HS 000000000000
.DA #0 ChRoot/Preemptive Disabled
.HS 00000000000000 All Slots marked as "Free"
2016-06-07 06:10:18 +00:00
*--------------------------------------
GP.End .EQ *
2016-06-07 06:10:18 +00:00
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SYS/KERNEL.S.GP
LOAD USR/SRC/SYS/KERNEL.S
2016-06-07 06:10:18 +00:00
ASM