mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-28 10:52:33 +00:00
464 lines
9.5 KiB
Plaintext
464 lines
9.5 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $D000
|
||
.TF /A2OSX.BOOT/SYS/KERNEL
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/KERNEL.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/A2OSX.API.I
|
||
.INB INC/IO.I
|
||
.INB INC/PRODOS.I
|
||
*--------------------------------------
|
||
KERNEL jmp S.KernelInit KERNEL.COLDBOOT
|
||
*--------------------------------------
|
||
jmp (.1,x) KERNEL.SYSCALL
|
||
*--------------------------------------
|
||
.1 .DA S.GetMem $00
|
||
.DA S.FreeMemA
|
||
.DA S.GetMemPtrA
|
||
.DA S.GetMemByIDA
|
||
|
||
.DA S.GetMemByNameA
|
||
.DA S.GetMemByNameYA
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.NewPStrYA $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.LoadLibYA
|
||
.DA S.UnloadLibA
|
||
.DA S.LoadDrvA
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.ExpandPStrA $30
|
||
.DA S.ExpandPStrYA
|
||
.DA S.GetEnvVarH
|
||
.DA S.GetEnvVarP
|
||
|
||
.DA S.SetEnvVarH
|
||
.DA S.SetEnvVarP
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.MLICreateFile $40
|
||
.DA S.MLICreateDirA
|
||
.DA S.MLICreateDirYA
|
||
.DA S.MLIDestroyA
|
||
|
||
.DA S.MLIDestroyYA
|
||
.DA S.MLIRename
|
||
.DA S.MLISetFileInfo
|
||
.DA S.MLIGetFileInfoA
|
||
|
||
.DA S.MLIGetFileInfoYA $50
|
||
.DA S.MLIOnline
|
||
.DA S.MLISetPrefixA
|
||
.DA S.MLISetPrefixYA
|
||
|
||
.DA S.MLIGetPrefixA
|
||
.DA S.MLIGetPrefixYA
|
||
.DA S.MLIOpenA
|
||
.DA S.MLIOpenYA
|
||
|
||
.DA S.MLINewLine $60
|
||
.DA S.MLIRead
|
||
.DA S.MLIWrite
|
||
.DA S.MLICloseA
|
||
|
||
.DA S.MLIFlushA
|
||
.DA S.MLISetMark
|
||
.DA S.MLIGetMarkA
|
||
.DA S.MLISetEOF
|
||
|
||
.DA S.MLIGetEOFA $70
|
||
.DA S.MLISetBuf
|
||
.DA S.MLIGetBuf
|
||
.DA S.MLIGetTime
|
||
|
||
.DA S.MLIAllocIRQ
|
||
.DA S.MLIDeallocIRQA
|
||
.DA S.MLIReadBlock
|
||
.DA S.MLIWriteBlock
|
||
*--------------------------------------
|
||
.DA S.GetDevByIDA $80
|
||
.DA S.GetDevByNameA
|
||
.DA S.GetDevByNameYA
|
||
.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
|
||
.DA 0
|
||
.DA S.SysScrPPSTRA
|
||
.DA S.SysScrPPSTRYA
|
||
*--------------------------------------
|
||
S.KernelInit sei
|
||
ldx #$FF init 6502 stack to highest
|
||
txs
|
||
stx A2osX.SaveSM
|
||
stx A2osX.SaveSX
|
||
cli
|
||
|
||
>LDYAI D.STACK.TOP
|
||
>STYA pStack init Soft Stack
|
||
|
||
stz A2osX.SCREENS
|
||
stz A2osX.ASCREEN
|
||
|
||
stz A2osX.CSCREEN.DEV
|
||
stz A2osX.GSCREEN.DEV
|
||
|
||
jsr S.SysScrInit
|
||
|
||
>LDYAI MSG.Init
|
||
jsr S.SysScrPPSTRYA
|
||
|
||
>LDYAI MSG.Init.MemMgr
|
||
jsr S.SysScrPPSTRYA
|
||
jsr S.MemMgrInit
|
||
jsr S.SysScrPRCode
|
||
bcs .1
|
||
|
||
>LDYAI MSG.Init.TskMgr
|
||
jsr S.SysScrPPSTRYA
|
||
jsr S.TskMgrInit
|
||
jsr S.SysScrPRCode
|
||
.1 bcs .2
|
||
|
||
>LDYAI MSG.Init.DevMgr
|
||
jsr S.SysScrPPSTRYA
|
||
jsr S.DevMgrInit
|
||
jsr S.SysScrPRCode
|
||
.2 bcs .3
|
||
|
||
>LDYAI MSG.Init.EvtMgr
|
||
jsr S.SysScrPPSTRYA
|
||
jsr S.EvtMgrInit
|
||
jsr S.SysScrPRCode
|
||
.3 bcs .99
|
||
|
||
>LDYAI MSG.Init.Startup
|
||
jsr S.SysScrPPSTRYA
|
||
|
||
>LDYAI STARTUP.FILE Build A2osX.STARTUP full path...
|
||
jsr S.NewPStrYA
|
||
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
|
||
bcs *
|
||
|
||
pla
|
||
jsr S.FreeMemA
|
||
pla
|
||
jsr S.FreeMemA
|
||
pla
|
||
jsr S.FreeMemA
|
||
|
||
>LDYAI MSG.Init.SysEnv
|
||
jsr S.SysScrPPSTRYA
|
||
|
||
jsr S.PrintSysEnv
|
||
|
||
.99 bcs *
|
||
|
||
>LDYAI MSG.Init.OK
|
||
jsr S.SysScrPPSTRYA
|
||
*--------------------------------------
|
||
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 (pEvent)
|
||
and #S.EVT.F.TIMER Discard any TIMER event
|
||
beq .1
|
||
jsr S.DestroyEvent
|
||
bra S.KernelRun
|
||
|
||
.1 lda (pEvent)
|
||
and #S.EVT.F.KEY any special key?
|
||
beq .99
|
||
|
||
ldy #S.EVT.DATAHI Open-Apple?
|
||
lda (pEvent),y
|
||
bpl .99
|
||
|
||
ldy #S.EVT.DATALO
|
||
lda (pEvent),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.SysScrPPSTRYA
|
||
bra *
|
||
|
||
.99 >LDYAI MSG.EVNTPANIC
|
||
jsr S.SysScrPPSTRYA
|
||
jsr S.DumpEvent
|
||
|
||
jsr S.DestroyEvent
|
||
jmp S.KernelRun
|
||
*--------------------------------------
|
||
S.KernelQuit bra *
|
||
*--------------------------------------
|
||
* PUBLIC
|
||
*--------------------------------------
|
||
* S.ExecFileA (R)
|
||
* in :
|
||
* A = hMem of FilePath (PSTRING)
|
||
* out :
|
||
*
|
||
*--------------------------------------
|
||
S.ExecFileA jsr S.LoadFileA
|
||
bcc S.ExecFileAOK
|
||
rts
|
||
|
||
S.ExecFileAOK >STYA S.ExecFileA.DataLen
|
||
stx S.ExecFileA.hData
|
||
txa
|
||
jsr S.GetMemPtrA
|
||
>STYA S.ExecFileA.DataPtr
|
||
|
||
.1 stz TmpBuffer256
|
||
|
||
.2 >LDYA S.ExecFileA.DataPtr
|
||
>STYA ZPQuickPtr1
|
||
|
||
inc S.ExecFileA.DataPtr
|
||
bne .21
|
||
inc S.ExecFileA.DataPtr+1
|
||
|
||
.21 lda S.ExecFileA.DataLen
|
||
bne .22
|
||
dec S.ExecFileA.DataLen+1
|
||
.22 dec S.ExecFileA.DataLen
|
||
|
||
lda (ZPQuickPtr1)
|
||
cmp #$0D
|
||
beq .3
|
||
inc TmpBuffer256
|
||
ldx TmpBuffer256
|
||
sta TmpBuffer256,x
|
||
|
||
lda S.ExecFileA.DataLen
|
||
bne .2
|
||
lda S.ExecFileA.DataLen+1
|
||
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.SysScrPPSTRYA
|
||
>LDYAI TmpBuffer256
|
||
jsr S.NewPStrYA
|
||
bcs .99
|
||
|
||
pha
|
||
jsr S.ExecCmdLineA
|
||
jsr S.SysScrPRCode
|
||
pla
|
||
jsr S.FreeMemA
|
||
|
||
.4 lda S.ExecFileA.DataLen
|
||
bne .1
|
||
lda S.ExecFileA.DataLen+1
|
||
bne .1
|
||
|
||
jsr .99
|
||
clc
|
||
rts
|
||
|
||
.99 lda S.ExecFileA.hData
|
||
jsr S.FreeMemA
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
S.ExecCmdLineA >PUSHA Push Cmd Line
|
||
>PUSHBI $20 Push SEP=' '
|
||
>PUSHBI 0 Push Token IDX
|
||
jsr S.PStrGetTkn
|
||
bcs .99
|
||
|
||
sta S.ExecFileA.hCMD
|
||
stx S.ExecFileA.hARGS
|
||
jsr S.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHWI EXECCMDS
|
||
jsr S.GetPStrIndex
|
||
bcs .98
|
||
|
||
asl
|
||
tax
|
||
lda S.ExecFileA.hARGS
|
||
jsr S.ExecCmdLine
|
||
bcs .98
|
||
|
||
jsr .98
|
||
clc
|
||
rts
|
||
|
||
.98 pha
|
||
lda S.ExecFileA.hARGS
|
||
jsr S.FreeMemA
|
||
lda S.ExecFileA.hCMD
|
||
jsr S.FreeMemA
|
||
pla
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
S.ExecFileA.hData .BS 1
|
||
S.ExecFileA.DataLen .BS 2
|
||
S.ExecFileA.DataPtr .BS 2
|
||
S.ExecFileA.hCMD .BS 1
|
||
S.ExecFileA.hARGS .BS 1
|
||
*--------------------------------------
|
||
S.ExecCmdLine jmp (.1,x)
|
||
.1 .DA S.SetSysEnvA
|
||
.DA S.LoadDrvA VCPU!!!!
|
||
.DA S.CreateProcessA VCPU!!!!
|
||
*--------------------------------------
|
||
pDevJmp jmp (pDev)
|
||
pCodeJmp jmp (pCode)
|
||
pLibJmp jmp (pLib)
|
||
*--------------------------------------
|
||
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.Init.OK >PSTRING "A2osX[Stage2]:Complete."
|
||
|
||
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.MEM
|
||
.INB SYS/KERNEL.S.SCR
|
||
.INB SYS/KERNEL.S.STR
|
||
.INB SYS/KERNEL.S.FS
|
||
.INB SYS/KERNEL.S.MLI
|
||
.INB SYS/KERNEL.S.BIN
|
||
.INB SYS/KERNEL.S.DRV
|
||
.INB SYS/KERNEL.S.LIB
|
||
.INB SYS/KERNEL.S.NET
|
||
.INB SYS/KERNEL.S.RDR
|
||
.INB SYS/KERNEL.S.ENV
|
||
.INB SYS/KERNEL.S.TSK
|
||
.INB SYS/KERNEL.S.EVT
|
||
*--------------------------------------
|
||
.INB SYS/KERNEL.S.DEV
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S
|
||
ASM
|