2016-08-28 20:48:01 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2016-12-05 17:04:42 +00:00
|
|
|
|
Kernel.Init3 ldx #S.DEV*DevMgr.Count
|
|
|
|
|
|
|
|
|
|
.1 lda DevMgr.NUL-1,x
|
|
|
|
|
sta DevMgr.Table-1,x
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2016-10-12 06:28:57 +00:00
|
|
|
|
|
2016-12-05 17:04:42 +00:00
|
|
|
|
stz DevMgr.Table+S.DEV*DevMgr.Count
|
|
|
|
|
|
2016-09-29 15:30:15 +00:00
|
|
|
|
lda #1 SYS device
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetDevByIDA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
>STYA pDev
|
|
|
|
|
ldx #DEVMGR.OPEN
|
|
|
|
|
jsr pDevJmp
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init3
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
2016-09-29 15:30:15 +00:00
|
|
|
|
>LDYAI MSG.IRQ
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
jsr K.IrqMgrInit
|
|
|
|
|
bcs *
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.MEM
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
jsr K.MemMgrInit
|
|
|
|
|
bcs *
|
|
|
|
|
|
2016-12-05 17:04:42 +00:00
|
|
|
|
>LDYAI MSG.DEV
|
|
|
|
|
>SYSCALL CPrintFYA
|
|
|
|
|
jsr K.DevMgrInit
|
|
|
|
|
bcs *
|
|
|
|
|
|
2016-09-29 15:30:15 +00:00
|
|
|
|
>LDYAI MSG.EVT
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
jsr K.EvtMgrInit
|
|
|
|
|
bcs *
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.FLT
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
jsr K.FltMgrInit
|
|
|
|
|
bcs *
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.TSK
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
jsr K.TskMgrInit
|
|
|
|
|
bcs *
|
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYAI MSG.Prefix
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
|
|
|
|
>PUSHWI STARTUP.CMDLINE
|
|
|
|
|
>LDYAI MSG.Startup
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI STARTUP.CMDLINE
|
2016-11-01 17:18:04 +00:00
|
|
|
|
>SYSCALL ExpandPStrYA
|
|
|
|
|
phx Save Expanded CMDLINE for discard
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL CreateProcessYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
bcs .9
|
2016-11-01 17:18:04 +00:00
|
|
|
|
pla
|
|
|
|
|
>SYSCALL FreeMemA ...discard...
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init3.OK
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI TskMgr.Table
|
|
|
|
|
>STYA pPs
|
|
|
|
|
|
2016-09-29 06:26:54 +00:00
|
|
|
|
>DEBUGOA
|
2016-10-07 15:28:17 +00:00
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
bit RRAMWRAMBNK2
|
2016-09-29 06:26:54 +00:00
|
|
|
|
jmp K.KernelRun
|
2016-08-29 15:12:04 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
.9 >PUSHA
|
|
|
|
|
>LDYAI MSG.StartupErr
|
2016-11-03 16:23:16 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-11-01 17:18:04 +00:00
|
|
|
|
bra * No need to discard Expanded CMDLINE
|
2016-08-28 20:48:01 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-29 15:30:15 +00:00
|
|
|
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>PSTR "NUL" NAME
|
2016-09-29 15:30:15 +00:00
|
|
|
|
.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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>PSTR "SYS" NAME
|
2016-09-29 15:30:15 +00:00
|
|
|
|
.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
|
|
|
|
|
*--------------------------------------
|
2016-12-05 17:04:42 +00:00
|
|
|
|
K.DevMgrInit stz ZPQuickPtr1
|
|
|
|
|
lda #$C1
|
|
|
|
|
sta ZPQuickPtr1+1
|
|
|
|
|
|
|
|
|
|
.1 ldx #SmartPort.SIG-SmartPort.OFS-1
|
|
|
|
|
|
|
|
|
|
.2 ldy SmartPort.OFS,x Check if there is a smartport firmware
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
cmp SmartPort.SIG,x
|
|
|
|
|
bne .3 not a smartport...
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
*SmartPort!!!
|
|
|
|
|
jsr K.DevMgrInit.AddDev
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bra .7
|
|
|
|
|
|
|
|
|
|
* Disk II, or Block device ?
|
|
|
|
|
.3 dex if x=0, only first SIG byte failed
|
|
|
|
|
bpl .8
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .4 $0, Disk II, 16sect
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
beq .8 $ff, Disk II, 13sect
|
|
|
|
|
dec
|
|
|
|
|
|
|
|
|
|
.4
|
|
|
|
|
|
|
|
|
|
.7 lda ZPQuickPtr1+1
|
|
|
|
|
and #$0f
|
|
|
|
|
tax
|
|
|
|
|
lda #$80
|
|
|
|
|
sta A2osX.SLOTS,x
|
|
|
|
|
|
|
|
|
|
.8 inc ZPQuickPtr1+1
|
|
|
|
|
lda ZPQuickPtr1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.DevMgrInit.AddCtrl
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.DevMgrInit.AddDev
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SmartPort.OFS .HS 07010305
|
|
|
|
|
SmartPort.SIG .HS 00200003
|
2016-09-29 15:30:15 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-12 15:46:38 +00:00
|
|
|
|
K.EvtMgrInit
|
|
|
|
|
* lda #10
|
|
|
|
|
* sta EVTMGR.10TH.CNT WARNING!!!! WRONG BANK!!!
|
2016-09-29 15:30:15 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
* lda A2osX.HZ
|
|
|
|
|
* sta EVTMGR.HZ.CNT
|
2016-09-29 15:30:15 +00:00
|
|
|
|
|
|
|
|
|
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 stz FltMgr.Table
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
2016-10-03 15:59:36 +00:00
|
|
|
|
ldy #S.PS-1
|
2016-09-29 15:30:15 +00:00
|
|
|
|
|
|
|
|
|
.2 sta (pPs),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
lda pPs
|
|
|
|
|
clc
|
2016-10-03 15:59:36 +00:00
|
|
|
|
adc #S.PS
|
2016-09-29 15:30:15 +00:00
|
|
|
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMem create it...
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.PS.hENV
|
|
|
|
|
sta (pPs),y
|
|
|
|
|
|
|
|
|
|
>LDYAI UsrBuf256
|
|
|
|
|
>STYA MLICALL.PARAMS+1
|
|
|
|
|
>MLICALL MLIGETPREFIX
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYAI UsrBuf256
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL NewPStrYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
sta (pPs),y
|
|
|
|
|
|
|
|
|
|
>PUSHWI UsrBuf256 push ENV value
|
|
|
|
|
>PUSHWI I.ENV.A2osX push ENV name
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL SetEnv
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYAI I.ENV.PATH
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PutEnvYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYAI I.ENV.LIB
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PutEnvYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYAI I.ENV.DRV
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PutEnvYA
|
2016-09-29 15:30:15 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
I.ENV.A2osX >PSTR "A2OSX"
|
|
|
|
|
I.ENV.PATH >PSTR "PATH=${A2OSX}SBIN/;${A2OSX}BIN/"
|
|
|
|
|
I.ENV.LIB >PSTR "LIB=${A2OSX}LIB/"
|
|
|
|
|
I.ENV.DRV >PSTR "DRV=${A2OSX}DRV/"
|
|
|
|
|
STARTUP.CMDLINE >PSTR "${A2OSX}SBIN/SHELL ${A2OSX}A2osX.STARTUP"
|
2016-08-28 20:48:01 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG.Init3 >CSTR "A2osX[Stage3]:Init\n"
|
2016-12-05 17:04:42 +00:00
|
|
|
|
MSG.IRQ >CSTR "-Interrupt Manager...\n"
|
|
|
|
|
MSG.MEM >CSTR "-Memory Manager...\n"
|
|
|
|
|
MSG.DEV >CSTR "-Device Manager...\n"
|
|
|
|
|
MSG.EVT >CSTR "-Event Manager...\n"
|
|
|
|
|
MSG.FLT >CSTR "-Path Filter...\n"
|
|
|
|
|
MSG.TSK >CSTR "-Task Manager...\n"
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG.Prefix >CSTR "Prefix:%S\n"
|
|
|
|
|
MSG.Startup >CSTR "Executing Kernel Startup Script...\nCmd:%S\n"
|
|
|
|
|
MSG.StartupErr >CSTR "Failed : [$%h]\n"
|
|
|
|
|
MSG.Init3.OK >CSTR "A2osX[Stage3]:Complete.\n"
|
2016-10-13 06:21:16 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-28 20:48:01 +00:00
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.INIT3
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|