mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
Kernel version 0.8 : INIT2/INIT3 OK
This commit is contained in:
parent
8b2c65df01
commit
c04a398bf8
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -89,6 +89,8 @@ MemMgr.MHiMem .EQ $BE00
|
||||
MemMgr.XLoMem .EQ $2000
|
||||
MemMgr.XHiMem .EQ $C000
|
||||
*--------------------------------------
|
||||
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
|
||||
*--------------------------------------
|
||||
* A2osX GLOBAL PAGE
|
||||
* $BE00->$BE0F : Public Vetors
|
||||
*--------------------------------------
|
||||
@ -152,7 +154,7 @@ SYS.PStrMatch .EQ $16
|
||||
|
||||
SYS.PStrUprYA .EQ $18
|
||||
SYS.PStrLwrYA .EQ $1A
|
||||
* .EQ $1C
|
||||
SYS.PStrFTime .EQ $1C
|
||||
SYS.PStr2StrArrayYA .EQ $1E
|
||||
*--------------------------------------
|
||||
SYS.ExecProcessNewEnvYA .EQ $20
|
||||
@ -193,7 +195,7 @@ SYS.UnloadLibA .EQ $54
|
||||
SYS.TimeYA .EQ $58
|
||||
SYS.CTime2Time .EQ $5A
|
||||
SYS.PTime2Time .EQ $5C
|
||||
SYS.StrFTime .EQ $5E
|
||||
* .EQ $5E
|
||||
*--------------------------------------
|
||||
SYS.FOPEN .EQ $60
|
||||
SYS.FOPEN.R .EQ $01 Open For Read
|
||||
|
@ -7,14 +7,14 @@ AUTO 6
|
||||
*--------------------------------------
|
||||
* Out : A = Command line Arg Count
|
||||
*--------------------------------------
|
||||
K.GetArgC jsr S.InitArgPtr1
|
||||
K.GetArgC jsr ARG.InitArgPtr1
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda (ZPQuickPtr1)
|
||||
beq .8
|
||||
|
||||
jsr S.NextArgPtr1
|
||||
jsr ARG.NextArgPtr1
|
||||
inx
|
||||
bne .1
|
||||
|
||||
@ -29,7 +29,7 @@ K.GetArgC jsr S.InitArgPtr1
|
||||
* CS : Out Of Bound
|
||||
*--------------------------------------
|
||||
K.GetArgA sta .2+1
|
||||
jsr S.InitArgPtr1
|
||||
jsr ARG.InitArgPtr1
|
||||
|
||||
lda .2+1
|
||||
beq .8
|
||||
@ -42,7 +42,7 @@ K.GetArgA sta .2+1
|
||||
.2 cpx #$ff Self Modified
|
||||
beq .8
|
||||
|
||||
jsr S.NextArgPtr1
|
||||
jsr ARG.NextArgPtr1
|
||||
inx
|
||||
bra .1
|
||||
|
||||
@ -53,13 +53,13 @@ K.GetArgA sta .2+1
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.InitArgPtr1 ldy #S.PS.hCMDLINE
|
||||
ARG.InitArgPtr1 ldy #S.PS.hCMDLINE
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.NextArgPtr1 lda ZPQuickPtr1
|
||||
ARG.NextArgPtr1 lda ZPQuickPtr1
|
||||
sec
|
||||
adc (ZPQuickPtr1)
|
||||
sta ZPQuickPtr1
|
||||
|
@ -133,25 +133,25 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN+1
|
||||
lda BIN.Relocate.SegLen
|
||||
sec
|
||||
sbc (pDrv),y
|
||||
sta K.InsDrv.DRVLen
|
||||
sta BIN.InstallDRV.DRVLen
|
||||
iny
|
||||
lda BIN.Relocate.SegLen+1
|
||||
sbc (pDrv),y
|
||||
sta K.InsDrv.DRVLen+1 Compute DRV Len
|
||||
sta BIN.InstallDRV.DRVLen+1 Compute DRV Len
|
||||
|
||||
lda DevMgr.Free
|
||||
clc
|
||||
adc K.InsDrv.DRVLen
|
||||
sta K.InsDrv.DRVEnd
|
||||
adc BIN.InstallDRV.DRVLen
|
||||
sta BIN.InstallDRV.DRVEnd
|
||||
lda DevMgr.Free+1
|
||||
adc K.InsDrv.DRVLen+1
|
||||
sta K.InsDrv.DRVEnd+1
|
||||
adc BIN.InstallDRV.DRVLen+1
|
||||
sta BIN.InstallDRV.DRVEnd+1
|
||||
|
||||
bcs .98 we crossed $FFFF, out of mem
|
||||
|
||||
lda K.InsDrv.DRVEnd
|
||||
lda BIN.InstallDRV.DRVEnd
|
||||
cmp #DevMgr.HiMem
|
||||
lda K.InsDrv.DRVEnd+1
|
||||
lda BIN.InstallDRV.DRVEnd+1
|
||||
sbc /DevMgr.HiMem
|
||||
bcs .98 No More Room to load Driver....
|
||||
|
||||
@ -198,7 +198,7 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN+1
|
||||
|
||||
jsr BIN.MoveDRV
|
||||
|
||||
>LDYA K.InsDrv.DrvEnd
|
||||
>LDYA BIN.InstallDRV.DrvEnd
|
||||
>STYA DevMgr.Free
|
||||
clc
|
||||
rts
|
||||
@ -265,10 +265,10 @@ BIN.MoveDRV ldy #H.BIN.DEV.HEADER.O
|
||||
lda DevMgr.Free+1
|
||||
sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location
|
||||
|
||||
lda K.InsDrv.DrvLen+1
|
||||
lda BIN.InstallDRV.DrvLen+1
|
||||
eor #$ff
|
||||
pha
|
||||
lda K.InsDrv.DrvLen
|
||||
lda BIN.InstallDRV.DrvLen
|
||||
eor #$ff
|
||||
tax
|
||||
|
||||
@ -292,8 +292,8 @@ BIN.MoveDRV ldy #H.BIN.DEV.HEADER.O
|
||||
|
||||
.8 rts CC from last ADC
|
||||
*--------------------------------------
|
||||
K.InsDrv.DrvLen .BS 2
|
||||
K.InsDrv.DrvEnd .BS 2
|
||||
BIN.InstallDRV.DrvLen .BS 2
|
||||
BIN.InstallDRV.DrvEnd .BS 2
|
||||
*--------------------------------------
|
||||
BIN.Relocate.SetCodeLenAX
|
||||
eor #$ff
|
||||
|
@ -5,8 +5,6 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
|
||||
*--------------------------------------
|
||||
* K.GetDevByIDA
|
||||
* IN:
|
||||
* A = DevID
|
||||
@ -19,24 +17,23 @@ K.GetDevByIDA cmp DevMgr.LastDevID
|
||||
beq .1
|
||||
bcs K.GetDevDNF
|
||||
|
||||
.1 stz K.GetDevByIDA.T
|
||||
.1 pha save ID
|
||||
|
||||
asl
|
||||
ror K.GetDevByIDA.T
|
||||
asl
|
||||
ror K.GetDevByIDA.T
|
||||
asl
|
||||
ror K.GetDevByIDA.T
|
||||
asl
|
||||
ror K.GetDevByIDA.T
|
||||
|
||||
adc #DevMgr.Table
|
||||
tay
|
||||
lda K.GetDevByIDA.T
|
||||
pla
|
||||
php
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
plp
|
||||
adc /DevMgr.Table
|
||||
rts CC
|
||||
|
||||
K.GetDevByIDA.T .BS 1
|
||||
*--------------------------------------
|
||||
* GetDevIDByNameA
|
||||
* IN:
|
||||
@ -94,30 +91,12 @@ K.GetDevInfoA jsr K.GetDevByIDA
|
||||
ldx #DEVMGR.GETINFO
|
||||
jmp (ZPQuickPtr1)
|
||||
*--------------------------------------
|
||||
DevMgr.Free .BS 2
|
||||
DevMgr.DevID .BS 1
|
||||
DevMgr.LastDevID .BS 1
|
||||
*--------------------------------------
|
||||
DevMgr.Count .EQ 2
|
||||
DevMgr.Count .EQ 2
|
||||
DevMgr.SYS.BASL0 .EQ $800
|
||||
*--------------------------------------
|
||||
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
|
||||
DevMgr.Free .BS 2
|
||||
DevMgr.DevID .BS 1
|
||||
DevMgr.LastDevID .DA #DevMgr.Count-1
|
||||
*--------------------------------------
|
||||
DevMgr.NUL.Code .DA DevMgr.Unsup OPEN
|
||||
.DA DevMgr.Unsup GETEVENT
|
||||
@ -356,7 +335,7 @@ DevMgr.SYS.TITLE >CSTRING "A2osX System Screen"
|
||||
DevMgr.SYS.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
|
||||
DevMgr.SYS.BASEH .HS 08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B
|
||||
*--------------------------------------
|
||||
DevMgr.End .EQ *
|
||||
DevMgr.LoMem .EQ *
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.DEV
|
||||
LOAD SYS/KERNEL.S
|
||||
|
@ -12,7 +12,7 @@ AUTO 6
|
||||
* CC : Y,A = PTR to S.DIR
|
||||
* CS : A = EC
|
||||
*--------------------------------------
|
||||
K.OPENDIRYA jsr K.PFTCheckPathYA
|
||||
K.OPENDIRYA jsr PFT.CheckPathYA
|
||||
>STYA ZPQuickPtr2
|
||||
>STYA MLICALL.PARAMS+1 For MLIOPEN
|
||||
|
||||
@ -80,7 +80,7 @@ K.READDIRA.EC .BS 2
|
||||
K.READDIRA.ECIB .BS 1
|
||||
K.READDIRA.EC2Return .BS 1
|
||||
*--------------------------------------
|
||||
K.READDIRA jsr K.PFTCheckDirA
|
||||
K.READDIRA jsr PFT.CheckDirA
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
@ -514,7 +514,7 @@ K.READDIRA.AddToBuf
|
||||
* In :
|
||||
* A = hDIR
|
||||
*--------------------------------------
|
||||
K.CLOSEDIRA jsr K.PFTCheckDirA
|
||||
K.CLOSEDIRA jsr PFT.CheckDirA
|
||||
pha
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
@ -535,7 +535,7 @@ K.CLOSEDIRA.1 ldy #S.DIR.PRODOS.REF
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.MKDIRYA jsr K.PFTCheckPathYA
|
||||
K.MKDIRYA jsr PFT.CheckPathYA
|
||||
>STYA MLICALL.PARAMS+1
|
||||
lda #S.FILEINFO.ACCESS.FULL
|
||||
sta MLICALL.PARAMS+S.FILEINFO.ACCESS
|
||||
|
@ -5,33 +5,6 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
K.ExpandPStrYA.NEW
|
||||
>STYA ZPQuickPtr3
|
||||
|
||||
lda (ZPQuickPtr3)
|
||||
sta KrnBuf256
|
||||
tay
|
||||
|
||||
.1 lda (ZPQuickPtr3),y
|
||||
sta KrnBuf256,y
|
||||
dey
|
||||
bne .1
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 stz K.ExpandPStr.Start
|
||||
|
||||
.3 tya
|
||||
cmp KrnBuf256 End of PSTR?
|
||||
beq .80
|
||||
|
||||
iny
|
||||
lda KrnBuf256,y
|
||||
|
||||
.80
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* K.ExpandPStrYA
|
||||
* In:
|
||||
* Y,A = PTR to String to Expand (PSTRING)
|
||||
@ -120,15 +93,15 @@ K.ExpandPStr.AV lda K.ExpandPStr.End
|
||||
cpy K.ExpandPStr.End
|
||||
bne .1
|
||||
|
||||
jsr S.CheckSysVarPtr2
|
||||
jsr ENV.CheckSysVarPtr2
|
||||
bcs .10
|
||||
>STYA ZPQuickPtr1
|
||||
bra .11
|
||||
|
||||
.10 jsr S.FindVarPtr2
|
||||
.10 jsr ENV.FindVarPtr2
|
||||
bcs .9
|
||||
|
||||
jsr S.NextEnvPtr1 Skip NAME
|
||||
jsr ENV.NextEnvPtr1 Skip NAME
|
||||
|
||||
.11 ldy #0
|
||||
ldx KrnBuf256
|
||||
@ -232,7 +205,7 @@ K.SetEnv >PULLW ZPQuickPtr2 NAME...
|
||||
K.SetEnvPtr2Ptr3
|
||||
jsr S.UnsetEnvPtr2
|
||||
|
||||
jsr S.InitEnvPtr1 Y,A = ZPQuickPtr1 -> Env
|
||||
jsr ENV.InitEnvPtr1 Y,A = ZPQuickPtr1 -> Env
|
||||
|
||||
lda ZPQuickPtr1 Compute ENV UPPER LIMIT in Ptr4
|
||||
clc
|
||||
@ -277,7 +250,7 @@ K.SetEnvPtr2Ptr3
|
||||
dey
|
||||
bne .5
|
||||
|
||||
jsr S.NextEnvPtr1
|
||||
jsr ENV.NextEnvPtr1
|
||||
|
||||
lda (ZPQuickPtr3)
|
||||
sta (ZPQuickPtr1)
|
||||
@ -288,7 +261,7 @@ K.SetEnvPtr2Ptr3
|
||||
dey
|
||||
bne .6
|
||||
|
||||
jsr S.NextEnvPtr1
|
||||
jsr ENV.NextEnvPtr1
|
||||
|
||||
.8 lda #0
|
||||
|
||||
@ -308,12 +281,12 @@ K.SetEnvPtr2Ptr3
|
||||
* CS : not found
|
||||
*--------------------------------------
|
||||
K.GetEnvYA >STYA ZPQuickPtr2
|
||||
jsr S.CheckSysVarPtr2
|
||||
jsr ENV.CheckSysVarPtr2
|
||||
bcc .9
|
||||
|
||||
jsr S.FindVarPtr2
|
||||
jsr ENV.FindVarPtr2
|
||||
bcs .9
|
||||
jsr S.NextEnvPtr1 Skip NAME
|
||||
jsr ENV.NextEnvPtr1 Skip NAME
|
||||
>LDYA ZPQuickPtr1
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -323,17 +296,17 @@ K.GetEnvYA >STYA ZPQuickPtr2
|
||||
* Out:
|
||||
*--------------------------------------
|
||||
K.UnsetEnvYA >STYA ZPQuickPtr2 Store VAR Name
|
||||
S.UnsetEnvPtr2 jsr S.FindVarPtr2
|
||||
S.UnsetEnvPtr2 jsr ENV.FindVarPtr2
|
||||
bcs .8 not found, quit
|
||||
|
||||
jsr S.DiscardVarPtr1 Ptr1 -> ENVNAME
|
||||
jsr ENV.DiscardVarPtr1 Ptr1 -> ENVNAME
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* PRIVATE
|
||||
*--------------------------------------
|
||||
* S.CheckSysVarPtr2
|
||||
* ENV.CheckSysVarPtr2
|
||||
* In:
|
||||
* ZPQuickPtr2 -> NAME
|
||||
* Out:
|
||||
@ -341,7 +314,7 @@ S.UnsetEnvPtr2 jsr S.FindVarPtr2
|
||||
* YA -> VALUE
|
||||
* CS: Not Found
|
||||
*--------------------------------------
|
||||
S.CheckSysVarPtr2
|
||||
ENV.CheckSysVarPtr2
|
||||
lda (ZPQuickPtr2)
|
||||
cmp #1 is name 1 char?
|
||||
bne .9
|
||||
@ -370,7 +343,7 @@ S.CheckSysVarPtr2
|
||||
.9 sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
* S.FindVarPtr2
|
||||
* ENV.FindVarPtr2
|
||||
* In:
|
||||
* ZPQuickPtr2 -> NAME
|
||||
* Out:
|
||||
@ -381,7 +354,7 @@ S.CheckSysVarPtr2
|
||||
* ZPQuickPtr1 -> PTR to Ending 0
|
||||
* ZPQuickPtr2 -> NAME
|
||||
*--------------------------------------
|
||||
S.FindVarPtr2 jsr S.InitEnvPtr1 Store ENV
|
||||
ENV.FindVarPtr2 jsr ENV.InitEnvPtr1 Store ENV
|
||||
bcs .99
|
||||
|
||||
lda (ZPQuickPtr1)
|
||||
@ -400,19 +373,19 @@ S.FindVarPtr2 jsr S.InitEnvPtr1 Store ENV
|
||||
clc
|
||||
rts
|
||||
|
||||
.3 jsr S.NextEnvPtr1 Skip NAME
|
||||
jsr S.NextEnvPtr1 Skip VALUE
|
||||
.3 jsr ENV.NextEnvPtr1 Skip NAME
|
||||
jsr ENV.NextEnvPtr1 Skip VALUE
|
||||
lda (ZPQuickPtr1)
|
||||
bne .1
|
||||
|
||||
.9 sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
* S.DiscardVar
|
||||
* ENV.DiscardVarPtr1
|
||||
* In:
|
||||
* ZPQuickPtr1 -> ENV.NAME to Discard
|
||||
*--------------------------------------
|
||||
S.DiscardVarPtr1
|
||||
ENV.DiscardVarPtr1
|
||||
lda ZPQuickPtr1 Discard current NAME & VALUE definition
|
||||
sec ZPQuickPtr1 -> NAME
|
||||
adc (ZPQuickPtr1) add NAME+1 to ZPQuickPtr1
|
||||
@ -441,13 +414,13 @@ S.DiscardVarPtr1
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
S.InitEnvPtr1 ldy #S.PS.hENV
|
||||
ENV.InitEnvPtr1 ldy #S.PS.hENV
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1 Store ENV
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.NextEnvPtr1 lda ZPQuickPtr1
|
||||
ENV.NextEnvPtr1 lda ZPQuickPtr1
|
||||
sec
|
||||
adc (ZPQuickPtr1)
|
||||
sta ZPQuickPtr1
|
||||
|
@ -5,23 +5,50 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* GETEVENT :
|
||||
K.GetKeyboardEvent
|
||||
lda KBD
|
||||
bpl .9
|
||||
sta KBDSTROBE
|
||||
|
||||
and #$7F
|
||||
ldy #S.EVT.DATA
|
||||
sta (pEvent),y
|
||||
iny
|
||||
lda OPENAPPLE
|
||||
asl
|
||||
lda SOLIDAPPLE
|
||||
ror
|
||||
and #$C0
|
||||
sta (pEvent),y
|
||||
|
||||
lda #S.EVT.F.KEY
|
||||
sta (pEvent)
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 inc A2osX.RANDOM16
|
||||
bne .99
|
||||
dec A2osX.RANDOM16+1
|
||||
.99 sec no event
|
||||
rts
|
||||
*--------------------------------------
|
||||
* EVT.GetEvents :
|
||||
* IN :
|
||||
* OUT :
|
||||
* CS = no event, A = ERROR
|
||||
* CC * event in YA
|
||||
* (pEvent)
|
||||
*--------------------------------------
|
||||
K.GetEvents stz pEvent
|
||||
EVT.GetEvents stz pEvent
|
||||
stz EVTMGR.COUNT
|
||||
|
||||
lda VBL get VLINE status
|
||||
tax
|
||||
eor EVTMGR.VBLSTATE
|
||||
bpl K.GetEvents.DEV no change,no tick
|
||||
bpl EVT.GetEvents.DEV no change,no tick
|
||||
txa
|
||||
sta EVTMGR.VBLSTATE save new
|
||||
bpl K.GetEvents.DEV Up2down transition,no tick
|
||||
bpl EVT.GetEvents.DEV Up2down transition,no tick
|
||||
|
||||
* sta PDLTRIG clr VBL (IIc)
|
||||
* lda RDIOUDIS clr VBL (IIc)
|
||||
@ -31,7 +58,7 @@ K.GetEvents stz pEvent
|
||||
inc A2osX.TIMER16+1
|
||||
|
||||
.1 dec EVTMGR.HZ.CNT
|
||||
bne K.GetEvents.DEV not yet 100ms
|
||||
bne EVT.GetEvents.DEV not yet 100ms
|
||||
|
||||
ldx A2osX.HZ
|
||||
stx EVTMGR.HZ.CNT
|
||||
@ -53,8 +80,9 @@ K.GetEvents stz pEvent
|
||||
adc #S.EVT
|
||||
sta pEvent
|
||||
inc EVTMGR.COUNT
|
||||
|
||||
K.GetEvents.DEV >LDYAI DevMgr.Table
|
||||
*--------------------------------------
|
||||
EVT.GetEvents.DEV
|
||||
>LDYAI DevMgr.Table
|
||||
>STYA pDev
|
||||
|
||||
stz DevMgr.DevID
|
||||
@ -106,34 +134,8 @@ K.GetEvents.DEV >LDYAI DevMgr.Table
|
||||
.9 sec error code=0,CS=no event
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.GetKeyboardEvent
|
||||
lda KBD
|
||||
bpl .9
|
||||
sta KBDSTROBE
|
||||
|
||||
and #$7F
|
||||
ldy #S.EVT.DATA
|
||||
sta (pEvent),y
|
||||
iny
|
||||
lda OPENAPPLE
|
||||
asl
|
||||
lda SOLIDAPPLE
|
||||
ror
|
||||
and #$C0
|
||||
sta (pEvent),y
|
||||
|
||||
lda #S.EVT.F.KEY
|
||||
sta (pEvent)
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 inc A2osX.RANDOM16
|
||||
bne .99
|
||||
dec A2osX.RANDOM16+1
|
||||
.99 sec no event
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.DestroyEvent lda (pEvent)
|
||||
EVT.DestroyEvent
|
||||
lda (pEvent)
|
||||
beq .9
|
||||
|
||||
bit #S.EVT.F.hMEM1
|
||||
|
@ -7,7 +7,7 @@ AUTO 6
|
||||
*--------------------------------------
|
||||
* For All SYS.xxxx calls, X = #SYSCall
|
||||
* Must be kept in X before calling
|
||||
* K.PFTCheck*
|
||||
* PFT.Check*
|
||||
*--------------------------------------
|
||||
* K.FOPEN
|
||||
* In :
|
||||
@ -24,7 +24,7 @@ AUTO 6
|
||||
* CC : A = hFILE
|
||||
* CS : A = EC
|
||||
*--------------------------------------
|
||||
K.FOPEN jsr K.PFTCheckPathSTK
|
||||
K.FOPEN jsr PFT.CheckPathSTK
|
||||
>PULLW MLICALL.PARAMS+1
|
||||
>PULLB K.FOPEN.MODE
|
||||
>PULLB K.FOPEN.TYPE
|
||||
@ -114,7 +114,7 @@ hFILE .BS 1
|
||||
* In :
|
||||
* A = hFILE
|
||||
*--------------------------------------
|
||||
K.FCLOSEA jsr K.PFTCheckFileA
|
||||
K.FCLOSEA jsr PFT.CheckFileA
|
||||
sta hFILE
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
@ -142,7 +142,7 @@ K.FCLOSEA.1 ldy #S.FILE.PRODOS.REF
|
||||
* Out :
|
||||
* Y,A = Bytes Read
|
||||
*--------------------------------------
|
||||
K.FREAD jsr K.PFTCheckFileSTK
|
||||
K.FREAD jsr PFT.CheckFileSTK
|
||||
ldx #MLIREAD
|
||||
bra K.FREAD.1
|
||||
*--------------------------------------
|
||||
@ -154,7 +154,7 @@ K.FREAD jsr K.PFTCheckFileSTK
|
||||
* Out :
|
||||
* Y,A = Bytes Written
|
||||
*--------------------------------------
|
||||
K.FWRITE jsr K.PFTCheckFileSTK
|
||||
K.FWRITE jsr PFT.CheckFileSTK
|
||||
>PULLA
|
||||
ldx #MLIWRITE
|
||||
K.FREAD.1 jsr FILE.SetupPrt1A
|
||||
@ -173,7 +173,7 @@ K.FREAD.1 jsr FILE.SetupPrt1A
|
||||
* In :
|
||||
* A = hFILE
|
||||
*--------------------------------------
|
||||
K.FFLUSHA jsr K.PFTCheckFileA
|
||||
K.FFLUSHA jsr PFT.CheckFileA
|
||||
jsr FILE.SetupPrt1A
|
||||
>MLICALL MLIFLUSH
|
||||
rts
|
||||
@ -185,7 +185,7 @@ K.FFLUSHA jsr K.PFTCheckFileA
|
||||
* PULLW = OffsetLo
|
||||
* PULLW = OffsetHi
|
||||
*--------------------------------------
|
||||
K.FSEEK jsr K.PFTCheckFileSTK
|
||||
K.FSEEK jsr PFT.CheckFileSTK
|
||||
>PULLA
|
||||
jsr FILE.SetupPrt1A
|
||||
>PULLB K.FSEEK.FROM
|
||||
@ -243,7 +243,7 @@ K.FSEEK.OFFSET .BS 4
|
||||
* Out :
|
||||
* Y,A,X = Offset
|
||||
*--------------------------------------
|
||||
K.FTELLA jsr K.PFTCheckFileA
|
||||
K.FTELLA jsr PFT.CheckFileA
|
||||
K.FTELLA.1 jsr FILE.SetupPrt1A
|
||||
>MLICALL MLIGETMARK
|
||||
bcs .9
|
||||
@ -260,7 +260,7 @@ K.FTELLA.1 jsr FILE.SetupPrt1A
|
||||
* A !=0 NOT EOF
|
||||
* CS :
|
||||
*--------------------------------------
|
||||
K.FEOFA jsr K.PFTCheckFileA
|
||||
K.FEOFA jsr PFT.CheckFileA
|
||||
jsr FILE.SetupPrt1A
|
||||
jsr K.FTELLA.1
|
||||
bcs .9
|
||||
@ -285,7 +285,7 @@ K.FEOFA.MARK .BS 3
|
||||
*--------------------------------------
|
||||
* K.REMOVEYA
|
||||
*--------------------------------------
|
||||
K.REMOVEYA jsr K.PFTCheckPathYA
|
||||
K.REMOVEYA jsr PFT.CheckPathYA
|
||||
>STYA MLICALL.PARAMS+1
|
||||
>MLICALL MLIDESTROY
|
||||
rts
|
||||
@ -295,7 +295,7 @@ K.REMOVEYA jsr K.PFTCheckPathYA
|
||||
* PULLW = Old Name
|
||||
* PULLW = New Name
|
||||
*--------------------------------------
|
||||
K.RENAME jsr K.PFTCheckPathSTK
|
||||
K.RENAME jsr PFT.CheckPathSTK
|
||||
>PULLW MLICALL.PARAMS+1
|
||||
>PULLW MLICALL.PARAMS+3
|
||||
>MLICALL MLIRENAME
|
||||
@ -306,7 +306,7 @@ K.RENAME jsr K.PFTCheckPathSTK
|
||||
* PULLW = PTR to Filename
|
||||
* PULLW = PTR to S.STAT buffer
|
||||
*--------------------------------------
|
||||
K.STAT jsr K.PFTCheckPathSTK
|
||||
K.STAT jsr PFT.CheckPathSTK
|
||||
>PULLW MLICALL.PARAMS+1
|
||||
>PULLW ZPQuickPtr2
|
||||
>MLICALL MLIGETFILEINFO
|
||||
|
@ -5,15 +5,11 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
Kernel.Init2 >LDAXI MSG.Init2
|
||||
jsr PrintCStrAX
|
||||
Kernel.Init2 sei
|
||||
|
||||
>LDAXI MSG.Relocate
|
||||
>LDAXI MSG.Init2
|
||||
jsr PrintCStrAX
|
||||
|
||||
sei
|
||||
sta SETALTZP
|
||||
|
||||
>LDYAI A2osX.BE00
|
||||
>STYA ZPQuickPtr1
|
||||
>LDYAI $BE00
|
||||
@ -22,6 +18,13 @@ Kernel.Init2 >LDAXI MSG.Init2
|
||||
>STYA ZPQuickPtr3
|
||||
jsr Kernel.Move
|
||||
|
||||
sta CLRALTZP
|
||||
bit RROMBNK1
|
||||
|
||||
>LDAXI MSG.D000BNK2
|
||||
jsr PrintCStrAX
|
||||
|
||||
sta SETALTZP
|
||||
lda RRAMWRAMBNK2
|
||||
lda RRAMWRAMBNK2
|
||||
|
||||
@ -33,6 +36,13 @@ Kernel.Init2 >LDAXI MSG.Init2
|
||||
>STYA ZPQuickPtr3
|
||||
jsr Kernel.Move
|
||||
|
||||
sta CLRALTZP
|
||||
bit RROMBNK1
|
||||
|
||||
>LDAXI MSG.D000BNK1
|
||||
jsr PrintCStrAX
|
||||
|
||||
sta SETALTZP
|
||||
lda RRAMWRAMBNK1
|
||||
lda RRAMWRAMBNK1
|
||||
|
||||
@ -44,6 +54,16 @@ Kernel.Init2 >LDAXI MSG.Init2
|
||||
>STYA ZPQuickPtr3
|
||||
jsr Kernel.Move
|
||||
|
||||
sta CLRALTZP
|
||||
bit RROMBNK1
|
||||
|
||||
>LDAXI MSG.E000
|
||||
jsr PrintCStrAX
|
||||
|
||||
sta SETALTZP
|
||||
lda RRAMWRAMBNK1
|
||||
lda RRAMWRAMBNK1
|
||||
|
||||
>LDYAI A2osX.E000
|
||||
>STYA ZPQuickPtr1
|
||||
>LDYAI $E000
|
||||
@ -68,37 +88,15 @@ Kernel.Init2 >LDAXI MSG.Init2
|
||||
|
||||
jsr CPU.Init
|
||||
|
||||
>LDAXI MSG.Setup
|
||||
jsr PrintCStrAX
|
||||
|
||||
sta SETALTZP
|
||||
lda RRAMWRAMBNK1
|
||||
lda RRAMWRAMBNK1
|
||||
|
||||
jsr K.IrqMgrInit
|
||||
bcs *
|
||||
jsr K.MemMgrInit
|
||||
bcs *
|
||||
jsr K.DevMgrInit
|
||||
bcs *
|
||||
jsr K.EvtMgrInit
|
||||
bcs *
|
||||
jsr K.FltMgrInit
|
||||
bcs *
|
||||
jsr K.TskMgrInit
|
||||
bcs *
|
||||
|
||||
sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F
|
||||
bit RROMBNK1 Make sure ROM is enabled for X.PRINT.F
|
||||
|
||||
>LDAXI MSG.Init2.OK
|
||||
jsr PrintCStrAX
|
||||
rts
|
||||
rts Do NOT replace this JSR/RTS with a JMP
|
||||
*--------------------------------------
|
||||
MSG.Init2 >CSTRING "A2osX[Stage2]:Init\n"
|
||||
MSG.Relocate >CSTRING "Relocating KERNEL...\n"
|
||||
MSG.Init2 >CSTRING "A2osX[Stage2]:Init\nInstalling KERNEL...\n - $BE00 (Global Page)...\n"
|
||||
MSG.D000BNK1 >CSTRING " - $D000 Bank1...\n"
|
||||
MSG.D000BNK2 >CSTRING " - $D000 Bank2...\n"
|
||||
MSG.E000 >CSTRING " - $E000...\n"
|
||||
MSG.HZ >CSTRING "Kernel SYS Timer Set For %d0 hz Machine.\n"
|
||||
MSG.Setup >CSTRING "Kernel Setup...\n"
|
||||
MSG.Init2.OK >CSTRING "A2osX[Stage2]:Complete.\n"
|
||||
*--------------------------------------
|
||||
CPU.Init >LDAXI MSG.CPU
|
||||
@ -305,188 +303,6 @@ Kernel.Move ldy #0
|
||||
inc ZPQuickPtr2+1
|
||||
bne .1
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* 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.DevMgrInit
|
||||
*--------------------------------------
|
||||
K.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
|
||||
*--------------------------------------
|
||||
* K.EvtMgrInit
|
||||
*--------------------------------------
|
||||
K.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
|
||||
*--------------------------------------
|
||||
* 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.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 .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/"
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.INIT2
|
||||
LOAD SYS/KERNEL.S
|
||||
|
@ -5,13 +5,46 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
Kernel.Init3 >DEBUG
|
||||
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
|
||||
|
||||
>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
|
||||
@ -37,13 +70,211 @@ Kernel.Init3 >DEBUG
|
||||
>DEBUGOA
|
||||
jmp K.KernelRun
|
||||
|
||||
|
||||
.9 >PUSHA
|
||||
>LDYAI MSG.StartupErr
|
||||
>SYSCALL SYS.PStrOutYA
|
||||
bra *
|
||||
*--------------------------------------
|
||||
* K.DevMgrInit
|
||||
*--------------------------------------
|
||||
K.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.LoMem
|
||||
>STYA DevMgr.Free
|
||||
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
|
||||
|
||||
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.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
|
||||
|
||||
>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"
|
||||
|
@ -21,18 +21,18 @@ K.PFTRemove
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* K.PFTCheckPath___
|
||||
* PFT.CheckPath___
|
||||
* In :
|
||||
* PULLW/Y,A = PATH (PSTR)
|
||||
* Out :
|
||||
*--------------------------------------
|
||||
K.PFTCheckPathSTK
|
||||
PFT.CheckPathSTK
|
||||
lda (pStack) read PTR.LO on top of stack
|
||||
pha
|
||||
ldy #1
|
||||
lda (pStack),y read PTR.HI on top of stack
|
||||
ply
|
||||
K.PFTCheckPathYA
|
||||
PFT.CheckPathYA
|
||||
stx S.PFT.SYSCALL save #SYSCALL
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
@ -80,15 +80,15 @@ K.PFTCheckPathYA
|
||||
ldx S.PFT.SYSCALL
|
||||
rts
|
||||
*--------------------------------------
|
||||
* K.PFTCheck___
|
||||
* PFT.Check___
|
||||
* In :
|
||||
* PULLB/A = hFILE/hDIR
|
||||
* Out :
|
||||
*--------------------------------------
|
||||
K.PFTCheckFileSTK
|
||||
PFT.CheckFileSTK
|
||||
lda (pStack) read hFILE on top of stack
|
||||
K.PFTCheckFileA
|
||||
K.PFTCheckDirA stx S.PFT.SYSCALL save #SYSCALL
|
||||
PFT.CheckFileA
|
||||
PFT.CheckDirA stx S.PFT.SYSCALL save #SYSCALL
|
||||
sta S.PFT.hFILE
|
||||
jsr K.GetMemPtrA X = unmidified
|
||||
>STYA ZPQuickPtr1
|
||||
|
@ -32,12 +32,12 @@ K.CreateProcessYA
|
||||
stx K.CreateProcess.hCmdLine
|
||||
>STYA K.CreateProcess.CmdLine
|
||||
|
||||
jsr K.CreateProcess.Child
|
||||
jsr PS.CreateChild
|
||||
bcs .98
|
||||
|
||||
sta K.CreateProcess.CPSID
|
||||
|
||||
jsr K.CreateProcess.Init
|
||||
jsr PS.Init
|
||||
bcs .97
|
||||
|
||||
lda K.CreateProcess.CPSID
|
||||
@ -46,7 +46,7 @@ K.CreateProcessYA
|
||||
|
||||
.97 pha save error code
|
||||
lda K.CreateProcess.CPSID
|
||||
jsr K.FreeProcessA
|
||||
jsr PS.FreeA
|
||||
pla get back error code
|
||||
|
||||
.98 pha
|
||||
@ -123,15 +123,14 @@ K.Sleep pla get PC LO
|
||||
clc No error,
|
||||
rts back to Kernel
|
||||
*--------------------------------------
|
||||
* K.CreateProcess.Child
|
||||
* PS.CreateChild
|
||||
* in :
|
||||
* out :
|
||||
* A = PSID
|
||||
* we cannot use ZPQuickPtrs1 & 2
|
||||
* because of calling K.NewPStrYA & S.DupEnvA
|
||||
*--------------------------------------
|
||||
K.CreateProcess.Child
|
||||
>LDYAI TskMgr.Table+S.PS.SIZE
|
||||
PS.CreateChild >LDYAI TskMgr.Table+S.PS.SIZE
|
||||
>STYA ZPQuickPtr3
|
||||
|
||||
ldx #0
|
||||
@ -196,7 +195,7 @@ K.CreateProcess.Child
|
||||
|
||||
ldy #S.PS.hENV ...and hENV from parent PS
|
||||
lda (pPs),y
|
||||
jsr S.DupEnvA
|
||||
jsr PS.DupEnvA
|
||||
bcs .9
|
||||
|
||||
ldy #S.PS.hENV
|
||||
@ -244,8 +243,7 @@ K.CreateProcess.Child
|
||||
clc Exit with A=PSID
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
K.CreateProcess.Init
|
||||
>LDYA K.CreateProcess.CmdLine
|
||||
PS.Init >LDYA K.CreateProcess.CmdLine
|
||||
jsr K.PStr2StrArrayYA
|
||||
bcs .9
|
||||
|
||||
@ -290,10 +288,10 @@ K.CreateProcess.Init
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* K.FreeProcessA
|
||||
* PS.FreeA
|
||||
* In : A = PID to free
|
||||
*--------------------------------------
|
||||
K.FreeProcessA jsr K.GetPSByIDA
|
||||
PS.FreeA jsr K.GetPSByIDA
|
||||
bcs *
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
@ -336,35 +334,33 @@ K.FreeProcessA jsr K.GetPSByIDA
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* K.SelectProcessA
|
||||
* PS.SelectA
|
||||
* In : A=PSID
|
||||
*--------------------------------------
|
||||
K.SelectProcessA
|
||||
tay
|
||||
bne K.SelectProcessN
|
||||
K.SelectProcess0
|
||||
PS.SelectA tay
|
||||
bne PS.SelectN
|
||||
PS.Select0
|
||||
>LDYAI TskMgr.Table Make PS #0 as current process
|
||||
>STYA pPs
|
||||
bra K.SelectProcessDev
|
||||
K.SelectProcessN
|
||||
bra PS.SelectDev
|
||||
PS.SelectN
|
||||
jsr K.GetPSByIDA
|
||||
bcs *
|
||||
>STYA pPs
|
||||
|
||||
K.SelectProcess ldy #S.PS.hCS
|
||||
PS.Select ldy #S.PS.hCS
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtrA
|
||||
>STYA pCode
|
||||
|
||||
ldy #S.PS.hDS
|
||||
lda (pPs),y
|
||||
beq K.SelectProcessDev
|
||||
beq PS.SelectDev
|
||||
|
||||
jsr K.GetMemPtrA
|
||||
>STYA pData
|
||||
|
||||
K.SelectProcessDev
|
||||
ldy #S.PS.hOUTDEV
|
||||
PS.SelectDev ldy #S.PS.hOUTDEV
|
||||
lda (pPs),y
|
||||
beq .8
|
||||
|
||||
@ -374,13 +370,13 @@ K.SelectProcessDev
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* S.DupEnvA
|
||||
* PS.DupEnvA
|
||||
* In:
|
||||
* A = ENV hMem To Duplicate
|
||||
* Out:
|
||||
* A = hMem to new ENV
|
||||
*--------------------------------------
|
||||
S.DupEnvA jsr K.GetMemPtrA
|
||||
PS.DupEnvA jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
>PUSHWI K.ENV.SIZE
|
||||
>PUSHBI 0
|
||||
|
@ -5,16 +5,18 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
K.KernelRun jsr K.TskMgrRun
|
||||
K.KernelRun >DEBUG
|
||||
|
||||
jsr TSK.TskMgrRun
|
||||
bcs .9
|
||||
|
||||
jsr K.GetEvents
|
||||
jsr EVT.GetEvents
|
||||
bcs K.KernelRun CS=no event
|
||||
|
||||
jsr S.DispatchEvents
|
||||
jsr TSK.DispatchEvents
|
||||
bcc K.KernelRun CC=All Events Dispatched
|
||||
|
||||
jsr K.SelectProcess0
|
||||
jsr PS.Select0
|
||||
|
||||
stz pEvent
|
||||
|
||||
@ -67,7 +69,7 @@ K.KernelRun jsr K.TskMgrRun
|
||||
>LDYAI MSG.DumpEvent
|
||||
jsr K.PStrOutYA
|
||||
|
||||
.8 jsr K.DestroyEvent
|
||||
.8 jsr EVT.DestroyEvent
|
||||
|
||||
.81 lda pEvent
|
||||
clc
|
||||
@ -76,7 +78,7 @@ K.KernelRun jsr K.TskMgrRun
|
||||
lda EVTMGR.COUNT
|
||||
bne .1
|
||||
|
||||
beq K.KernelRun
|
||||
jmp K.KernelRun
|
||||
|
||||
.9 jsr DevMgr.SYS.Select
|
||||
>LDYAI MSG.KRNLPANIC
|
||||
|
@ -5,9 +5,9 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* K.TskMgrRun
|
||||
* TSK.TskMgrRun
|
||||
*--------------------------------------
|
||||
K.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
|
||||
TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
|
||||
>STYA pPs
|
||||
|
||||
lda TSKMGR.SIZE
|
||||
@ -31,7 +31,7 @@ K.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
|
||||
and #$FF^S.PS.F.HOLD unmark as HOLD
|
||||
sta (pPs)
|
||||
|
||||
.2 jsr K.SelectProcess
|
||||
.2 jsr PS.SelectA
|
||||
|
||||
lda (pPS)
|
||||
bit #S.PS.F.INIT
|
||||
@ -71,7 +71,7 @@ K.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
|
||||
|
||||
ldy #S.PS.ID
|
||||
lda (pPs),y
|
||||
jsr K.FreeProcessA
|
||||
jsr PS.FreeA
|
||||
bcs *
|
||||
|
||||
.7 lda pPs
|
||||
@ -87,13 +87,13 @@ K.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE skip PS 0
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* S.DispatchEvent
|
||||
* TSK.DispatchEvents
|
||||
* IN:
|
||||
* OUT:
|
||||
* CS: Not Dispatched
|
||||
* CC: Event Cleared
|
||||
*--------------------------------------
|
||||
S.DispatchEvents
|
||||
TSK.DispatchEvents
|
||||
>LDYAI TskMgr.Table+S.PS.SIZE
|
||||
>STYA pPs
|
||||
|
||||
@ -113,7 +113,7 @@ S.DispatchEvents
|
||||
bit #S.PS.F.EVENT Accept Events ?
|
||||
beq .4
|
||||
|
||||
jsr K.SelectProcess
|
||||
jsr PS.SelectA
|
||||
|
||||
stz pEvent
|
||||
|
||||
@ -130,7 +130,7 @@ S.DispatchEvents
|
||||
ldx #TSKMGR.DOEVENT
|
||||
jsr pCodeJmp Call DOEVENT function
|
||||
bcs .3
|
||||
jsr K.DestroyEvent
|
||||
jsr EVT.DestroyEvent
|
||||
lda EVTMGR.COUNT
|
||||
beq .8
|
||||
|
||||
@ -156,7 +156,7 @@ S.DispatchEvents
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.TskMgrQuit clc
|
||||
TSK.TskMgrQuit clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TSKMGR.SIZE .BS 1
|
||||
|
Loading…
Reference in New Issue
Block a user