2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.OR $D000
|
|
|
|
|
.TF /A2OSX.BOOT/SYS/KERNEL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/KERNEL.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.INB INC/A2OSX.API.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.INB INC/IO.I
|
|
|
|
|
.INB INC/PRODOS.I
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
KERNEL jmp S.KernelInit KERNEL.COLDBOOT
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jmp (.1,x) KERNEL.SYSCALL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA S.GetMem $00
|
|
|
|
|
.DA S.FreeMemA
|
|
|
|
|
.DA S.GetMemPtrA
|
|
|
|
|
.DA S.GetMemByIDA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.GetMemByNameA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.GetMemByNameYA
|
|
|
|
|
.DA 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.NewPStrYA $10
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.PStrCpyA
|
|
|
|
|
.DA S.PStrCat
|
|
|
|
|
.DA S.PStrCmp
|
|
|
|
|
|
|
|
|
|
.DA S.PStrGetTkn
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DA S.LoadBinA $20
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.LoadLibYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.UnloadLibA
|
|
|
|
|
.DA S.LoadDrvA
|
|
|
|
|
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DA S.ExpandPStrA $30
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.ExpandPStrYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.GetEnvVarH
|
|
|
|
|
.DA S.GetEnvVarP
|
|
|
|
|
|
|
|
|
|
.DA S.SetEnvVarH
|
|
|
|
|
.DA S.SetEnvVarP
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.MLICreateFile $40
|
|
|
|
|
.DA S.MLICreateDirA
|
|
|
|
|
.DA S.MLICreateDirYA
|
|
|
|
|
.DA S.MLIDestroyA
|
|
|
|
|
|
|
|
|
|
.DA S.MLIDestroyYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.MLIRename
|
|
|
|
|
.DA S.MLISetFileInfo
|
|
|
|
|
.DA S.MLIGetFileInfoA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
.DA S.MLIGetFileInfoYA $50
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.MLIOnline
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.MLISetPrefixA
|
|
|
|
|
.DA S.MLISetPrefixYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.MLIGetPrefixA
|
|
|
|
|
.DA S.MLIGetPrefixYA
|
|
|
|
|
.DA S.MLIOpenA
|
|
|
|
|
.DA S.MLIOpenYA
|
|
|
|
|
|
|
|
|
|
.DA S.MLINewLine $60
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.MLIRead
|
|
|
|
|
.DA S.MLIWrite
|
|
|
|
|
.DA S.MLICloseA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.MLIFlushA
|
|
|
|
|
.DA S.MLISetMark
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.MLIGetMarkA
|
|
|
|
|
.DA S.MLISetEOF
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.MLIGetEOFA $70
|
|
|
|
|
.DA S.MLISetBuf
|
|
|
|
|
.DA S.MLIGetBuf
|
|
|
|
|
.DA S.MLIGetTime
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.MLIAllocIRQ
|
|
|
|
|
.DA S.MLIDeallocIRQA
|
|
|
|
|
.DA S.MLIReadBlock
|
|
|
|
|
.DA S.MLIWriteBlock
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA S.GetDevByIDA $80
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.GetDevByNameA
|
2015-03-23 07:28:03 +00:00
|
|
|
|
.DA S.GetDevByNameYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA S.GetKeyboardEvent
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA S.ExecProcessNewEnvA $90
|
|
|
|
|
.DA S.ExecProcessA
|
|
|
|
|
.DA S.CreateProcessNewEnvA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA S.CreateProcessA
|
|
|
|
|
|
|
|
|
|
.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
|
2015-03-23 07:28:03 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DA S.ScreenSelectA $C0
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
.DA S.SysScrPPSTRA
|
|
|
|
|
.DA S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
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
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
stz A2osX.CSCREEN.DEV
|
|
|
|
|
stz A2osX.GSCREEN.DEV
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
jsr S.SysScrInit
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>LDYAI MSG.Init.MemMgr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.MemMgrInit
|
|
|
|
|
jsr S.SysScrPRCode
|
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init.TskMgr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.TskMgrInit
|
|
|
|
|
jsr S.SysScrPRCode
|
|
|
|
|
.1 bcs .2
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init.DevMgr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.DevMgrInit
|
|
|
|
|
jsr S.SysScrPRCode
|
|
|
|
|
.2 bcs .3
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init.EvtMgr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.EvtMgrInit
|
|
|
|
|
jsr S.SysScrPRCode
|
|
|
|
|
.3 bcs .99
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init.Startup
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>LDYAI STARTUP.FILE Build A2osX.STARTUP full path...
|
|
|
|
|
jsr S.NewPStrYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pha save for discard
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHWI ENV.A2osX get KRNL root path
|
|
|
|
|
ldy #S.PS.hENV
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda TskMgr.Table,y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
jsr S.GetEnvVarP
|
|
|
|
|
pha save for discard
|
|
|
|
|
>PUSHA
|
|
|
|
|
jsr S.PStrCat
|
|
|
|
|
pha save for discard
|
|
|
|
|
|
|
|
|
|
jsr S.ExecFileA
|
|
|
|
|
jsr S.SysScrPRCode
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs *
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pla
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init.SysEnv
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
jsr S.PrintSysEnv
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.99 bcs *
|
|
|
|
|
|
|
|
|
|
>LDYAI MSG.Init.OK
|
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pEvent)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
and #S.EVT.F.TIMER Discard any TIMER event
|
|
|
|
|
beq .1
|
|
|
|
|
jsr S.DestroyEvent
|
|
|
|
|
bra S.KernelRun
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.1 lda (pEvent)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
and #S.EVT.F.KEY any special key?
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATAHI Open-Apple?
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pEvent),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bpl .99
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATALO
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pEvent),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
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
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.8 jsr S.DestroyEvent
|
|
|
|
|
bra S.KernelRun
|
|
|
|
|
|
|
|
|
|
.98 lda #A2osX.SCREENS.S
|
|
|
|
|
jsr S.ScreenSelectA
|
|
|
|
|
>LDYAI MSG.KRNLPANIC
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bra *
|
|
|
|
|
|
|
|
|
|
.99 >LDYAI MSG.EVNTPANIC
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.SysScrPPSTRYA
|
|
|
|
|
jsr S.DumpEvent
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
jsr S.DestroyEvent
|
|
|
|
|
jmp S.KernelRun
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
S.PrintSysEnv ldy #S.PS.hENV
|
|
|
|
|
lda TskMgr.Table,y Get PS #0 ENV
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.GetMemPtrA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA R.AX
|
|
|
|
|
.1 lda (R.AX)
|
|
|
|
|
beq .8 Ending 0 ?
|
|
|
|
|
>LDYA R.AX
|
|
|
|
|
jsr S.SysScrPPSTRYA
|
|
|
|
|
jsr S.SysScrCROUT
|
|
|
|
|
lda R.AL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2015-10-19 20:35:00 +00:00
|
|
|
|
adc (R.AX) Add len+1 to PTR
|
|
|
|
|
sta R.AL
|
|
|
|
|
bcc .1
|
|
|
|
|
inc R.AH
|
|
|
|
|
bra .1
|
|
|
|
|
.8 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
pDevJmp jmp (pDev)
|
|
|
|
|
pCodeJmp jmp (pCode)
|
|
|
|
|
pLibJmp jmp (pLib)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
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"
|
2015-06-03 18:30:57 +00:00
|
|
|
|
MSG.Init.OK >PSTRING "A2osX[Stage2]:Complete."
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
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.LIB >PSTRING "LIB"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB SYS/KERNEL.S.MEM
|
|
|
|
|
.INB SYS/KERNEL.S.SCR
|
|
|
|
|
.INB SYS/KERNEL.S.STR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.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
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.INB SYS/KERNEL.S.TSK
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.INB SYS/KERNEL.S.EVT
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.INB SYS/KERNEL.S.EXE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.INB SYS/KERNEL.S.DEV
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S
|
|
|
|
|
ASM
|