mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
397 lines
8.1 KiB
Plaintext
397 lines
8.1 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/A2OSX.I
|
||
.INB INC/IO.I
|
||
.INB INC/PRODOS.I
|
||
*--------------------------------------
|
||
ZPQuickPtr1 .EQ ZPKERNEL Temp Ptrs for use in very limited scope
|
||
ZPQuickPtr2 .EQ ZPKERNEL+2 (could be trashed by any JSR)
|
||
ZPQuickPtr3 .EQ ZPKERNEL+4
|
||
ZPQuickPtr4 .EQ ZPKERNEL+6
|
||
*--------------------------------------
|
||
* $D000-D0FF KERNEL.SYSCALL Jmp Table
|
||
*--------------------------------------
|
||
.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 0
|
||
.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.GetEnvVarA
|
||
.DA S.GetEnvVarYA
|
||
|
||
.DA S.SetEnvVarH
|
||
.DA S.SetEnvVarP
|
||
.DA S.DelEnvVarA
|
||
.DA S.DelEnvVarYA
|
||
*--------------------------------------
|
||
.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 S.GetDevInfoA
|
||
|
||
.DA S.GetKeyboardEvent
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.ExecProcessNewEnvYA $90
|
||
.DA S.ExecProcessYA
|
||
.DA S.CreateProcessNewEnvYA
|
||
.DA S.CreateProcessYA
|
||
|
||
.DA S.GetPSByIDA
|
||
.DA 0
|
||
.DA S.Sleep
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.CheckPrefixA $A0
|
||
.DA S.FileSearch
|
||
.DA S.LoadFileA
|
||
.DA S.LoadFileYA
|
||
|
||
.DA S.ListDirInitA
|
||
.DA S.ListDirNextA
|
||
.DA S.ListDirCloseA
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA 0 $B0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.ScreenSelectA $C0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA S.COutA $D0
|
||
.DA S.PSTROutA
|
||
.DA S.PSTROutYA
|
||
.DA 0
|
||
.DA S.HexOutA
|
||
.DA S.HexOutYA
|
||
.DA S.DecOutA
|
||
.DA S.DecOutYA
|
||
*--------------------------------------
|
||
.DA 0 $E0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
.DA 0 $F0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
Kernel.Init 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
|
||
|
||
jsr S.IrqMgrInit
|
||
bcs *
|
||
jsr S.MemMgrInit
|
||
bcs *
|
||
jsr S.DevMgrInit
|
||
bcs *
|
||
jsr S.EvtMgrInit
|
||
bcs *
|
||
jsr S.TskMgrInit
|
||
bcs *
|
||
|
||
>LDYAI MSG.Init
|
||
jsr S.PSTROutYA
|
||
|
||
>LDYAI MSG.Init.Startup
|
||
jsr S.PSTROutYA
|
||
|
||
>LDYAI STARTUP.ARGS Get A2osX.STARTUP full path...
|
||
jsr S.NewPStrYA
|
||
pha
|
||
>LDYAI STARTUP.CMD Get SHELL full path...
|
||
jsr S.NewPStrYA
|
||
ply get back ARGS in Y
|
||
phy
|
||
pha A=CMD, save for discard
|
||
|
||
jsr S.CreateProcessYA
|
||
bcs *
|
||
|
||
pla
|
||
jsr S.FreeMemA
|
||
pla
|
||
jsr S.FreeMemA
|
||
|
||
>LDYAI MSG.Init.OK
|
||
jsr S.PSTROutYA
|
||
*--------------------------------------
|
||
S.KernelRun jsr S.TskMgrRun
|
||
bcc S.KernelRun.EVT
|
||
lda #A2osX.SCREENS.S
|
||
jsr S.ScreenSelectA
|
||
>LDYAI MSG.KRNLPANIC
|
||
jsr S.PSTROutYA
|
||
bra *
|
||
|
||
S.KernelRun.EVT
|
||
jsr S.GetEvents
|
||
bcs S.KernelRun CS=no event
|
||
|
||
jsr S.DispatchEvents
|
||
bcc S.KernelRun CC=All Events Dispatched
|
||
|
||
jsr S.SelectProcess0
|
||
|
||
stz pEvent
|
||
|
||
.1 lda (pEvent)
|
||
beq .81
|
||
bmi .8 Discard any timer eventa
|
||
|
||
bit #S.EVT.F.KEY any special key?
|
||
beq .7
|
||
|
||
ldy #S.EVT.DATAHI Open-Apple?
|
||
lda (pEvent),y
|
||
bpl .7
|
||
|
||
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 .7
|
||
lda #A2osX.SCREENS.G
|
||
jsr S.ScreenSelectA
|
||
bra .8
|
||
|
||
.7 jsr S.DumpEvent
|
||
|
||
.8 jsr S.DestroyEvent
|
||
|
||
.81 lda pEvent
|
||
clc
|
||
adc #S.EVT
|
||
sta pEvent
|
||
lda EVTMGR.COUNT
|
||
bne .1
|
||
jmp S.KernelRun
|
||
*--------------------------------------
|
||
S.DumpEvent ldy #S.EVT.DATAW2+1
|
||
>PUSHB (pEvent),y
|
||
dey
|
||
>PUSHB (pEvent),y
|
||
|
||
ldy #S.EVT.DATAW1+1
|
||
>PUSHB (pEvent),y
|
||
dey
|
||
>PUSHB (pEvent),y
|
||
|
||
ldy #S.EVT.DATAHI
|
||
>PUSHB (pEvent),y
|
||
ldy #S.EVT.DATALO
|
||
>PUSHB (pEvent),y
|
||
|
||
ldy #S.EVT.hDEV
|
||
>PUSHB (pEvent),y
|
||
|
||
>PUSHB (pEvent)
|
||
>LDYAI MSG.DumpEvent
|
||
jmp S.PSTROutYA
|
||
*--------------------------------------
|
||
* S.ScreenSelectA
|
||
* IN :
|
||
* A = Screen to display
|
||
*--------------------------------------
|
||
S.ScreenSelectA and A2osX.SCREENS Screen is available ?
|
||
beq .9 ...not setup up
|
||
|
||
cmp #A2osX.SCREENS.S
|
||
bne .1
|
||
sta SETTEXT
|
||
sta SETALTCHAR
|
||
sta SET80DISP
|
||
sta CLR80STORE
|
||
sta SETPAGE2
|
||
bra .8
|
||
|
||
.1 cmp #A2osX.SCREENS.C
|
||
bne .2
|
||
sta SETTEXT
|
||
sta SETALTCHAR
|
||
sta SET80DISP
|
||
sta CLR80STORE
|
||
sta CLRPAGE2
|
||
bra .8
|
||
|
||
.2 cmp #A2osX.SCREENS.G
|
||
bne .9
|
||
|
||
sta CLRTEXT
|
||
sta CLRMIXED
|
||
sta SETHIRES
|
||
sta CLR80STORE
|
||
sta CLRPAGE2
|
||
sta SETIOUDIS
|
||
sta SETDHIRES
|
||
|
||
* sta CLR80DISP
|
||
* sta SETDHIRES
|
||
* sta CLRDHIRES
|
||
* sta SET80DISP
|
||
* sta SETDHIRES
|
||
* sta CLRDHIRES
|
||
* sta SETDHIRES
|
||
|
||
.8 sta A2osX.ASCREEN
|
||
.9 rts
|
||
*--------------------------------------
|
||
MSG.Init >PSTRING "A2osX[Stage2]:Init\n"
|
||
MSG.Init.Startup >PSTRING "EXEC A2osX.Startup...\n"
|
||
MSG.Init.OK >PSTRING "A2osX[Stage2]:Complete.\n"
|
||
MSG.DumpEvent >PSTRING "!Unhandled Event:Flags=%h,DevID=%h,DATALO=%h,DATAHI=%h,W1=%H,W2=%H\n"
|
||
MSG.KRNLPANIC >PSTRING "\n!!!Kernel Panic!!!\n"
|
||
*--------------------------------------
|
||
STARTUP.CMD >PSTRING "${A2OSX}SBIN/SHELL"
|
||
STARTUP.ARGS >PSTRING "${A2OSX}A2osX.STARTUP"
|
||
*--------------------------------------
|
||
ENV.A2osX >PSTRING "A2OSX"
|
||
ENV.PATH >PSTRING "PATH"
|
||
ENV.PATH.VALUE >PSTRING "${A2OSX}SBIN/;${A2OSX}BIN/"
|
||
ENV.LIB >PSTRING "LIB"
|
||
ENV.LIB.VALUE >PSTRING "${A2OSX}LIB/"
|
||
ENV.DRV >PSTRING "DRV"
|
||
ENV.DRV.VALUE >PSTRING "${A2OSX}DRV/"
|
||
*--------------------------------------
|
||
.INB SYS/KERNEL.S.IRQ
|
||
.INB SYS/KERNEL.S.MEM
|
||
.INB SYS/KERNEL.S.STR
|
||
.INB SYS/KERNEL.S.CIO
|
||
.INB SYS/KERNEL.S.FIO
|
||
.INB SYS/KERNEL.S.MLI
|
||
.INB SYS/KERNEL.S.BIN
|
||
.INB SYS/KERNEL.S.DRV
|
||
.INB SYS/KERNEL.S.LIB
|
||
.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
|