A2osX/SYS/KERNEL.S.INIT.txt

191 lines
3.7 KiB
Plaintext
Raw Normal View History

2016-06-07 06:10:18 +00:00
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* Setup MainLC ($3FE)
*
*
* Setup AuxLC $FFFE->Kernel IRQ Handler
* if irq not handled, jmp (S.IrqMgrOldFFFE)
*--------------------------------------
S.IrqMgrInit php
sei
>LDYA $FFFE
cpy #S.IrqHandlerAuxLC
bne .1
cmp /S.IrqHandlerAuxLC
beq .2
.1 >STYA S.IrqMgrOldFFFE
>LDYAI S.IrqHandlerAuxLC
>STYA $FFFE
.2
* >LDYAI $BE0C
* >STYA $3F0
plp
clc
rts
*--------------------------------------
S.MemMgrInit >LDYAI MemMgr.MHiMem
>STYA MemMgr.HiMem
>STYA MemMgr.Free
>LDYAI MemMgr.MLoMem
>STYA MemMgr.LoMem
stz MemMgr.LastSlot Reserve Slot #0
sta SETWRITEAUX
>LDYAI MemMgr.XHiMem
>STYA MemMgr.HiMem
>STYA MemMgr.Free
>LDYAI MemMgr.XLoMem
>STYA MemMgr.LoMem
stz MemMgr.LastSlot Reserve Slot #0
sta CLRWRITEAUX
clc
rts
*--------------------------------------
* S.DevMgrInit
*--------------------------------------
S.DevMgrInit ldx #S.DEV.SIZE*DevMgr.Count
.1 lda DevMgr.NUL-1,x
sta DevMgr.Table-1,x
dex
bne .1
stz DevMgr.Table+S.DEV.SIZE*DevMgr.Count+1
lda #DevMgr.Count-1
sta DevMgr.LastDevID
>LDYAI DevMgr.End
>STYA DevMgr.Free
clc
rts
*--------------------------------------
* S.EvtMgrInit
*--------------------------------------
S.EvtMgrInit lda #10
sta EVTMGR.10TH.CNT
lda A2osX.HZ
sta EVTMGR.HZ.CNT
lda MACHID
and #MACHID.TYPE
cmp #MACHID.TYPE.IIc
bne .8
* sta CLRIOUDIS
* sta ENBVBLIIC
.8 lda /EvtMgr.Table
sta pEvent+1
clc
rts
*--------------------------------------
* S.TskMgrInit
*--------------------------------------
S.TskMgrInit stz TSKMGR.LASTID
lda #1
sta TSKMGR.SIZE One Slot Busy (Kernel PS=0)
>LDYAI TskMgr.Table Clear whole process table
>STYA pPs
ldx #K.PS.MAX
.1 lda #0
ldy #S.PS.SIZE-1
.2 sta (pPs),y
dey
bpl .2
lda pPs
clc
adc #S.PS.SIZE
sta pPs
bcc .3
inc pPs+1
.3 dex
bne .1
>LDYAI TskMgr.Table Select Process 0 (Kernel)
>STYA pPs
lda #1
ldy #S.PS.hINDEV
sta (pPs),y Make In DEV = SYS
ldy #S.PS.hOUTDEV
sta (pPs),y Make OUT DEV = SYS
ldy #S.PS.hERRDEV
sta (pPs),y Make ERR DEV = SYS
>SYSCALL SYS.GetDevByIDA
>STYA pDev
ldx #DEVMGR.OPEN
jsr pDevJmp
>PUSHWI K.ENV.SIZE get a buffer for ENV
>PUSHBI S.MEM.F.INIT0 make sure blank
>SYSCALL SYS.GetMem create it...
bcs *
txa
ldy #S.PS.hENV
sta (pPs),y
>LDYAI TmpBuffer256
>SYSCALL SYS.MLIGetPrefixYA
bcs *
>LDYAI TmpBuffer256
>SYSCALL SYS.NewPStrYA
bcs *
ldy #S.PS.hPREFIX
sta (pPs),y
>PUSHWI TmpBuffer256 push ENV value
>PUSHWI I.ENV.A2osX push ENV name
>SYSCALL SYS.SetEnvVarP
bcs .9
>PUSHWI I.ENV.PATH.VAL
>PUSHWI I.ENV.PATH
>SYSCALL SYS.SetEnvVarP
bcs .9
>PUSHWI I.ENV.LIB.VAL
>PUSHWI I.ENV.LIB
>SYSCALL SYS.SetEnvVarP
bcs .9
>PUSHWI I.ENV.DRV.VAL
>PUSHWI I.ENV.DRV
>SYSCALL SYS.SetEnvVarP
.9 rts
*--------------------------------------
I.ENV.A2osX >PSTRING "A2OSX"
I.ENV.PATH >PSTRING "PATH"
I.ENV.PATH.VAL >PSTRING "${A2OSX}SBIN/;${A2OSX}BIN/"
I.ENV.LIB >PSTRING "LIB"
I.ENV.LIB.VAL >PSTRING "${A2OSX}LIB/"
I.ENV.DRV >PSTRING "DRV"
I.ENV.DRV.VAL >PSTRING "${A2OSX}DRV/"
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.INIT
LOAD SYS/KERNEL.S
ASM