A2osX/SYS/KERNEL.S.txt
2015-12-10 19:53:30 +01:00

394 lines
8.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 $0 Temp Ptrs for use in very limited scope
ZPQuickPtr2 .EQ $2 (could be trashed by any JSR)
ZPQuickPtr3 .EQ $4
ZPQuickPtr4 .EQ $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 0
.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 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 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 A2osX.STARTUP full path...
jsr S.NewPStrYA
ply get back ARGS in Y
phy
pha A=CMH, 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
bcs .98
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 jsr S.SelectProcess0
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.PSTROutYA
bra *
.99 jsr S.DumpEvent
jsr S.DestroyEvent
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 "\nEVT:F=%h,hDev=%d,DATA=%H,W1=%H,W2=%H"
MSG.KRNLPANIC >PSTRING "\n\n!!!Kernel Panic!!!"
*--------------------------------------
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.NET
.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