mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-04 03:05:43 +00:00
295 lines
6.1 KiB
Plaintext
295 lines
6.1 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
Kernel.Init3 jsr K.DevMgrInit
|
||
bcs *
|
||
|
||
lda #1 SYS device
|
||
>SYSCALL SYS.GetDevByIDA
|
||
>STYA pDev
|
||
ldx #DEVMGR.OPEN
|
||
jsr pDevJmp
|
||
|
||
ldx #DEVMGR.SELECT
|
||
jsr pDevJmp
|
||
|
||
lda #2
|
||
sta A2osX.ASCREEN
|
||
|
||
>LDYAI MSG.Init3
|
||
>SYSCALL SYS.PStrOutYA
|
||
|
||
>LDYAI MSG.IRQ
|
||
>SYSCALL SYS.PStrOutYA
|
||
jsr K.IrqMgrInit
|
||
bcs *
|
||
|
||
>LDYAI MSG.MEM
|
||
>SYSCALL SYS.PStrOutYA
|
||
jsr K.MemMgrInit
|
||
bcs *
|
||
|
||
>LDYAI MSG.EVT
|
||
>SYSCALL SYS.PStrOutYA
|
||
jsr K.EvtMgrInit
|
||
bcs *
|
||
|
||
>LDYAI MSG.FLT
|
||
>SYSCALL SYS.PStrOutYA
|
||
jsr K.FltMgrInit
|
||
bcs *
|
||
|
||
>LDYAI MSG.TSK
|
||
>SYSCALL SYS.PStrOutYA
|
||
jsr K.TskMgrInit
|
||
bcs *
|
||
|
||
ldy #S.PS.hPREFIX
|
||
lda (pPs),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
|
||
>PUSHYA
|
||
>LDYAI MSG.Prefix
|
||
>SYSCALL SYS.PStrOutYA
|
||
|
||
>PUSHWI STARTUP.CMDLINE
|
||
>LDYAI MSG.Startup
|
||
>SYSCALL SYS.PStrOutYA
|
||
|
||
>LDYAI STARTUP.CMDLINE
|
||
>SYSCALL SYS.CreateProcessYA
|
||
bcs .9
|
||
|
||
>LDYAI MSG.Init3.OK
|
||
>SYSCALL SYS.PStrOutYA
|
||
|
||
>LDYAI TskMgr.Table
|
||
>STYA pPs
|
||
|
||
>DEBUGOA
|
||
bit RRAMWRAMBNK2
|
||
bit RRAMWRAMBNK2
|
||
jmp K.KernelRun
|
||
|
||
.9 >PUSHA
|
||
>LDYAI MSG.StartupErr
|
||
>SYSCALL SYS.PStrOutYA
|
||
bra *
|
||
*--------------------------------------
|
||
* K.DevMgrInit
|
||
*--------------------------------------
|
||
K.DevMgrInit ldx #S.DEV*DevMgr.Count
|
||
.1 lda DevMgr.NUL-1,x
|
||
sta DevMgr.Table-1,x
|
||
dex
|
||
bne .1
|
||
|
||
stz DevMgr.Table+S.DEV*DevMgr.Count
|
||
|
||
* >LDYAI DevMgr.LoMem Hard Coded
|
||
* >STYA DevMgr.Free
|
||
* lda #DevMgr.Count-1
|
||
* sta DevMgr.LastDevID
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DevMgr.NUL cld
|
||
jmp (DevMgr.NUL.Code,x)
|
||
.DA #0 DevID=0
|
||
.DA #S.DEV.F.INUSE+S.DEV.F.SHARE+S.DEV.F.COUT+S.DEV.F.CHAR
|
||
>PSTRING "NUL" NAME
|
||
.HS 00 NAME must Be 5 bytes long
|
||
.HS 00
|
||
.HS 00.00.00.00
|
||
*--------------------------------------
|
||
DevMgr.SYS cld
|
||
jmp (DevMgr.SYS.Code,x)
|
||
.DA #1 DevID=1
|
||
.DA #S.DEV.F.INUSE+S.DEV.F.EVENT+S.DEV.F.SHARE+S.DEV.F.COUT+S.DEV.F.CHAR
|
||
>PSTRING "SYS" NAME
|
||
.HS 00 NAME must Be 5 bytes long
|
||
.HS 00
|
||
.HS 00.00.00.00
|
||
*--------------------------------------
|
||
* Setup MainLC ($3FE)
|
||
*
|
||
*
|
||
* Setup AuxLC $FFFE->Kernel IRQ Handler
|
||
* if irq not handled, jmp (S.IrqMgrOldFFFE)
|
||
*--------------------------------------
|
||
K.IrqMgrInit php
|
||
sei
|
||
>LDYA $FFFE
|
||
cpy #K.IrqHandlerAuxLC
|
||
bne .1
|
||
cmp /K.IrqHandlerAuxLC
|
||
beq .2
|
||
|
||
.1 >STYA K.IrqMgrOldFFFE
|
||
>LDYAI K.IrqHandlerAuxLC
|
||
>STYA $FFFE
|
||
|
||
.2
|
||
|
||
* >LDYAI $BE0C
|
||
* >STYA $3F0
|
||
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
K.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
|
||
*--------------------------------------
|
||
* K.EvtMgrInit
|
||
*--------------------------------------
|
||
K.EvtMgrInit
|
||
* lda #10
|
||
* sta EVTMGR.10TH.CNT WARNING!!!! WRONG BANK!!!
|
||
|
||
* 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
|
||
*--------------------------------------
|
||
* K.FltMgrInit
|
||
*--------------------------------------
|
||
K.FltMgrInit stz FltMgr.Table
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
* K.TskMgrInit
|
||
*--------------------------------------
|
||
K.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-1
|
||
|
||
.2 sta (pPs),y
|
||
dey
|
||
bpl .2
|
||
|
||
lda pPs
|
||
clc
|
||
adc #S.PS
|
||
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
|
||
|
||
>PUSHWI K.ENV.SIZE get a buffer for ENV
|
||
>PUSHBI S.MEM.F.INIT0 make sure blank
|
||
>SYSCALL SYS.GetMem create it...
|
||
bcs .9
|
||
|
||
txa
|
||
ldy #S.PS.hENV
|
||
sta (pPs),y
|
||
|
||
>LDYAI UsrBuf256
|
||
>STYA MLICALL.PARAMS+1
|
||
>MLICALL MLIGETPREFIX
|
||
bcs .9
|
||
|
||
>LDYAI UsrBuf256
|
||
>SYSCALL SYS.NewPStrYA
|
||
bcs .9
|
||
|
||
txa
|
||
ldy #S.PS.hPREFIX
|
||
sta (pPs),y
|
||
|
||
>PUSHWI UsrBuf256 push ENV value
|
||
>PUSHWI I.ENV.A2osX push ENV name
|
||
>SYSCALL SYS.SetEnv
|
||
bcs .9
|
||
|
||
>LDYAI I.ENV.PATH
|
||
>SYSCALL SYS.PutEnvYA
|
||
bcs .9
|
||
|
||
>LDYAI I.ENV.LIB
|
||
>SYSCALL SYS.PutEnvYA
|
||
bcs .9
|
||
|
||
>LDYAI I.ENV.DRV
|
||
>SYSCALL SYS.PutEnvYA
|
||
.9 rts
|
||
*--------------------------------------
|
||
I.ENV.A2osX >PSTRING "A2OSX"
|
||
I.ENV.PATH >PSTRING "PATH=${A2OSX}SBIN/;${A2OSX}BIN/"
|
||
I.ENV.LIB >PSTRING "LIB=${A2OSX}LIB/"
|
||
I.ENV.DRV >PSTRING "DRV=${A2OSX}DRV/"
|
||
*--------------------------------------
|
||
MSG.Init3 >PSTRING "A2osX[Stage3]:Init\n"
|
||
MSG.IRQ >PSTRING " - Interrupt Manager...\n"
|
||
MSG.MEM >PSTRING " - Memory Manager...\n"
|
||
MSG.EVT >PSTRING " - Event Manager...\n"
|
||
MSG.FLT >PSTRING " - Path Filter...\n"
|
||
MSG.TSK >PSTRING " - Task Manager...\n"
|
||
MSG.Prefix >PSTRING "Prefix:%S\n"
|
||
MSG.Startup >PSTRING "Executing Kernel Startup Script...\nCmd:%S\n"
|
||
MSG.StartupErr >PSTRING "Failed : [$%h]\n"
|
||
MSG.Init3.OK >PSTRING "A2osX[Stage3]:Complete.\n"
|
||
*--------------------------------------
|
||
STARTUP.CMDLINE >PSTRING "${A2OSX}SBIN/SHELL ${A2OSX}A2osX.STARTUP"
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.INIT3
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|