mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
480 lines
9.8 KiB
Plaintext
480 lines
9.8 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $E000
|
||
.TF SYS/KERNEL
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/KERNEL.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/IO.I
|
||
.INB INC/PRODOS.I
|
||
*--------------------------------------
|
||
KERNEL.Start jmp S.Kernel
|
||
*--------------------------------------
|
||
KERNEL.SYSCALL jmp (.1,x)
|
||
*--------------------------------------
|
||
.1 .DA S.GetMem $00
|
||
.DA S.FreeMemA
|
||
.DA S.ClrMemA
|
||
.DA S.GetMemPtrA
|
||
|
||
.DA S.GetMemLenA
|
||
.DA S.GetMemByIDA
|
||
.DA S.GetMemByNameA
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.NewPStr $10
|
||
.DA S.PStrCpyA
|
||
.DA S.PStrCat
|
||
.DA S.PStrCmp
|
||
|
||
.DA S.PStrGetTkn
|
||
.DA S.GetPStrIndex
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.LoadBinA $20
|
||
.DA S.LoadLib
|
||
.DA S.UnloadLibA
|
||
.DA S.LoadDrvA
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.ExpandPStrA $30
|
||
.DA S.ExpandPStr
|
||
.DA S.GetEnvVarH
|
||
.DA S.GetEnvVarP
|
||
|
||
.DA S.SetEnvVarH
|
||
.DA S.SetEnvVarP
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.MLICreate $40
|
||
.DA S.MLIDestroy
|
||
.DA S.MLIRename
|
||
.DA S.MLISetFileInfo
|
||
|
||
.DA S.MLIGetFileInfoA
|
||
.DA S.MLIOnline
|
||
.DA S.MLISetPrefix
|
||
.DA S.MLIGetPrefixA
|
||
|
||
.DA S.MLIOpenA $50
|
||
.DA S.MLINewLine
|
||
.DA S.MLIRead
|
||
.DA S.MLIWrite
|
||
|
||
.DA S.MLICloseA
|
||
.DA S.MLIFlushA
|
||
.DA S.MLISetMark
|
||
.DA S.MLIGetMark
|
||
|
||
.DA S.MLISetEOF $60
|
||
.DA S.MLIGetEOFA
|
||
.DA 0
|
||
.DA 0
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.GetDevByIDA $70
|
||
.DA S.GetDevByNameA
|
||
.DA S.GetDevTable
|
||
.DA S.GetDevInfoA
|
||
|
||
.DA S.DevOutA
|
||
.DA S.GetDevByNameYA
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.GetEvent $80
|
||
.DA S.DestroyEvent
|
||
.DA 0
|
||
.DA 0
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.ExecProcessA $90
|
||
.DA S.CreateProcessA
|
||
.DA 0
|
||
.DA 0
|
||
|
||
.DA S.GetPSByIDA
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.CheckPrefixA $A0
|
||
.DA S.FileSearch
|
||
.DA S.LoadFileA
|
||
.DA S.ListDirInitA
|
||
|
||
.DA S.ListDirNextA
|
||
.DA S.ListDirCloseA
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.AddNetCfg $B0
|
||
.DA S.SetNetCfg
|
||
.DA S.GetNetCfgA
|
||
.DA S.ClrNetCfgA
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.ScreenSelectA $C0
|
||
*--------------------------------------
|
||
S.Kernel jsr S.KernelInit
|
||
jsr S.KernelRun
|
||
jsr S.KernelQuit
|
||
|
||
bra *
|
||
*--------------------------------------
|
||
S.KernelInit >LDYAI D.STACKSEG
|
||
>STYA R.SP init Soft Stack
|
||
>STYA R.LS init LS
|
||
|
||
stz A2osX.SCREENS
|
||
stz A2osX.ACTIVESCRN
|
||
jsr S.SysScrInit
|
||
|
||
>LDYAI MSG.Init
|
||
jsr S.SysScrPPSTR
|
||
|
||
>LDYAI MSG.Init.MemMgr
|
||
jsr S.SysScrPPSTR
|
||
jsr S.MemMgrInit
|
||
jsr S.SysScrPRCode
|
||
bcs .1
|
||
|
||
>LDYAI MSG.Init.TskMgr
|
||
jsr S.SysScrPPSTR
|
||
jsr S.TskMgrInit
|
||
jsr S.SysScrPRCode
|
||
.1 bcs .2
|
||
|
||
>LDYAI MSG.Init.DevMgr
|
||
jsr S.SysScrPPSTR
|
||
jsr S.DevMgrInit
|
||
jsr S.SysScrPRCode
|
||
.2 bcs .3
|
||
|
||
>LDYAI MSG.Init.EvtMgr
|
||
jsr S.SysScrPPSTR
|
||
jsr S.EvtMgrInit
|
||
jsr S.SysScrPRCode
|
||
.3 bcs .99
|
||
|
||
>LDYAI MSG.Init.Startup
|
||
jsr S.SysScrPPSTR
|
||
|
||
>PUSHWI STARTUP.FILE Build A2osX.STARTUP full path...
|
||
jsr S.NewPStr
|
||
pha save for discard
|
||
>PUSHA
|
||
>PUSHWI ENV.A2osX get KRNL root path
|
||
ldy #S.PS.hENV
|
||
lda TSKMGR.TABLE,y
|
||
>PUSHA
|
||
jsr S.GetEnvVarP
|
||
pha save for discard
|
||
>PUSHA
|
||
jsr S.PStrCat
|
||
pha save for discard
|
||
|
||
jsr S.ExecFileA
|
||
jsr S.SysScrPRCode
|
||
|
||
pla
|
||
jsr S.FreeMemA
|
||
pla
|
||
jsr S.FreeMemA
|
||
pla
|
||
jsr S.FreeMemA
|
||
|
||
>LDYAI MSG.Init.SysEnv
|
||
jsr S.SysScrPPSTR
|
||
|
||
jsr S.PrintSysEnv
|
||
|
||
.99 rts
|
||
*--------------------------------------
|
||
S.KernelRun jsr S.TskMgrRun
|
||
bcs .98
|
||
|
||
jsr S.SysScrCPULoad
|
||
jsr S.GetEvent
|
||
bcs S.KernelRun CS=no event
|
||
|
||
jsr S.DispatchEvent
|
||
bcc S.KernelRun CC=Event Dispatched
|
||
|
||
lda (EVTMGR.EVTPTR)
|
||
and #S.EVT.F.TIMER Discard any TIMER event
|
||
beq .1
|
||
jsr S.DestroyEvent
|
||
bra S.KernelRun
|
||
|
||
.1 lda (EVTMGR.EVTPTR)
|
||
and #S.EVT.F.KEY any special key?
|
||
beq .99
|
||
|
||
ldy #S.EVT.DATAHI Open-Apple?
|
||
lda (EVTMGR.EVTPTR),y
|
||
bpl .99
|
||
|
||
ldy #S.EVT.DATALO
|
||
lda (EVTMGR.EVTPTR),y
|
||
|
||
cmp #$31
|
||
bne .2
|
||
lda #A2osX.SCREENS.S
|
||
jsr S.ScreenSelectA
|
||
bra .8
|
||
|
||
.2 cmp #$32
|
||
bne .3
|
||
lda #A2osX.SCREENS.C
|
||
jsr S.ScreenSelectA
|
||
bra .8
|
||
|
||
.3 cmp #$33
|
||
bne .8
|
||
lda #A2osX.SCREENS.G
|
||
jsr S.ScreenSelectA
|
||
.8 jsr S.DestroyEvent
|
||
bra S.KernelRun
|
||
|
||
.98 lda #A2osX.SCREENS.S
|
||
jsr S.ScreenSelectA
|
||
>LDYAI MSG.KRNLPANIC
|
||
jsr S.SysScrPPSTR
|
||
bra *
|
||
|
||
.99 >LDYAI MSG.EVNTPANIC
|
||
jsr S.SysScrPPSTR
|
||
lda (EVTMGR.EVTPTR)
|
||
jsr S.SysScrPRBYTEA
|
||
ldy #S.EVT.hDEV
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
ldy #S.EVT.DATALO
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
ldy #S.EVT.DATAHI
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
|
||
lda #'.'
|
||
jsr S.SysScrCOUTA
|
||
ldy #S.EVT.DATAW1
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
iny
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
|
||
lda #'.'
|
||
jsr S.SysScrCOUTA
|
||
ldy #S.EVT.DATAW2
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
iny
|
||
lda (EVTMGR.EVTPTR),y
|
||
jsr S.SysScrPRBYTEA
|
||
|
||
jsr S.DestroyEvent
|
||
jmp S.KernelRun
|
||
*--------------------------------------
|
||
S.KernelQuit clc
|
||
rts
|
||
*--------------------------------------
|
||
* PUBLIC
|
||
*--------------------------------------
|
||
* S.ExecFileA (R)
|
||
* in :
|
||
* A = hMem of FilePath (PSTRING)
|
||
* out :
|
||
*--------------------------------------
|
||
* LS : (8)
|
||
* 0 = hMem of Loaded File
|
||
* 2 = PTR to File data
|
||
* 4 = Data Len
|
||
* 6 = CMD hMem
|
||
* 7 = ARGS hMem
|
||
*--------------------------------------
|
||
S.ExecFileA jsr S.LoadFileA
|
||
bcc S.ExecFileAOK
|
||
rts
|
||
S.ExecFileAOK >ADDLOCAL 8
|
||
>STYAL 4 Store File Length
|
||
txa
|
||
>STAL 0 hMem of Loaded File
|
||
jsr S.GetMemPtrA
|
||
>STYAL 2
|
||
.1 stz TmpBuffer256
|
||
.2 >LDYAL 2
|
||
>STYA ZPQuickPtr1
|
||
>INCLW 2
|
||
>DECLW 4
|
||
lda (ZPQuickPtr1)
|
||
cmp #$0D
|
||
beq .3
|
||
inc TmpBuffer256
|
||
ldx TmpBuffer256
|
||
sta TmpBuffer256,x
|
||
>LDAL 4
|
||
bne .2
|
||
>LDAL 5
|
||
bne .2
|
||
.3 lda TmpBuffer256
|
||
beq .4
|
||
lda TmpBuffer256+1
|
||
cmp #'*'
|
||
beq .4
|
||
lda #'-'
|
||
jsr S.SysScrCOUTA
|
||
lda #'>'
|
||
jsr S.SysScrCOUTA
|
||
>LDYAI TmpBuffer256
|
||
jsr S.SysScrPPSTR
|
||
>PUSHWI TmpBuffer256
|
||
jsr S.NewPStr
|
||
bcs .99
|
||
pha
|
||
jsr S.ExecCmdLineA
|
||
jsr S.SysScrPRCode
|
||
pla
|
||
jsr S.FreeMemA
|
||
.4 >LDAL 4
|
||
.5 bne .6
|
||
>LDAL 5
|
||
beq .8
|
||
.6 jmp .1
|
||
.8 jsr .99
|
||
clc
|
||
rts
|
||
.99 >LDAL 0
|
||
jsr S.FreeMemA
|
||
>REMLOCAL 8
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
S.ExecCmdLineA >PUSHA
|
||
>PUSHBI $20 Push SEP=' '
|
||
>PUSHBI 0 Push Token IDX
|
||
jsr S.PStrGetTkn
|
||
bcs .99
|
||
>STAL 6
|
||
pha
|
||
txa
|
||
>STAL 7
|
||
pla
|
||
jsr S.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHWI EXECCMDS
|
||
jsr S.GetPStrIndex
|
||
bcs .98
|
||
asl
|
||
tax
|
||
>LDAL 7
|
||
jsr S.ExecCmdLine
|
||
bcs .98
|
||
jsr .98
|
||
clc
|
||
rts
|
||
.98 pha
|
||
>LDAL 7
|
||
jsr S.FreeMemA
|
||
>LDAL 6
|
||
jsr S.FreeMemA
|
||
pla
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
S.ExecCmdLine jmp (.1,x)
|
||
.1 .DA S.SetSysEnvA
|
||
.DA S.LoadDrvA VCPU!!!!
|
||
.DA S.CreateProcessA VCPU!!!!
|
||
*--------------------------------------
|
||
S.PrintSysEnv ldy #S.PS.hENV
|
||
lda TSKMGR.TABLE,y Get PS #0 ENV
|
||
jsr S.GetMemPtrA
|
||
>STYA R.AX
|
||
.1 lda (R.AX)
|
||
beq .8 Ending 0 ?
|
||
>LDYA R.AX
|
||
jsr S.SysScrPPSTR
|
||
jsr S.SysScrCROUT
|
||
lda R.AL
|
||
sec
|
||
adc (R.AX) Add len+1 to PTR
|
||
sta R.AL
|
||
bcc .1
|
||
inc R.AH
|
||
bra .1
|
||
.8 rts
|
||
*--------------------------------------
|
||
EXECCMDS >PSTRING "SET"
|
||
EXECCMDS1 >PSTRING "LOAD"
|
||
EXECCMDS2 >PSTRING "EXEC"
|
||
.DA #0
|
||
*--------------------------------------
|
||
MSG.Init >PSTRING "A2osX[Stage2]:Init\n"
|
||
MSG.Init.MemMgr >PSTRING "->MemMgr Init"
|
||
MSG.Init.TskMgr >PSTRING "->TskMgr Init"
|
||
MSG.Init.DevMgr >PSTRING "->DevMgr Init"
|
||
MSG.Init.EvtMgr >PSTRING "->EvtMgr Init"
|
||
MSG.Init.Startup >PSTRING "EXEC A2osX.Startup...\n"
|
||
MSG.Init.SysEnv >PSTRING "SYS ENV:\n"
|
||
MSG.EVNTPANIC >PSTRING "\nEVT:F/hDev/DATA/W1/W2="
|
||
MSG.KRNLPANIC >PSTRING "\n\n!!!Kernel Panic!!!"
|
||
*--------------------------------------
|
||
STARTUP.FILE >PSTRING "A2osX.STARTUP"
|
||
*--------------------------------------
|
||
ENV.A2osX >PSTRING "A2OSX"
|
||
ENV.PATH >PSTRING "PATH"
|
||
ENV.DRV >PSTRING "DRV"
|
||
ENV.ETC >PSTRING "ETC"
|
||
ENV.LIB >PSTRING "LIB"
|
||
*--------------------------------------
|
||
.INB SYS/KERNEL.S.BIN
|
||
.INB SYS/KERNEL.S.DEV
|
||
.INB SYS/KERNEL.S.ENV
|
||
.INB SYS/KERNEL.S.EVT
|
||
.INB SYS/KERNEL.S.FS
|
||
.INB SYS/KERNEL.S.MEM
|
||
.INB SYS/KERNEL.S.MLI
|
||
.INB SYS/KERNEL.S.NET
|
||
* .INB SYS/KERNEL.S.RDR
|
||
.INB SYS/KERNEL.S.SCR
|
||
.INB SYS/KERNEL.S.STR
|
||
.INB SYS/KERNEL.S.TSK
|
||
*--------------------------------------
|
||
KERNEL.End .EQ *
|
||
Kernel.Size .EQ KERNEL.End-KERNEL.Start
|
||
*--------------------------------------
|
||
.DO Kernel.Size>$1FFA
|
||
ERROR:KERNEL.SIZE too big
|
||
.FIN
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S
|
||
ASM
|