A2osX/SYS/KERNEL.S.txt

393 lines
8.0 KiB
Plaintext
Raw Normal View History

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/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
2015-03-14 21:48:35 +00:00
*--------------------------------------
.DA S.GetMem $00
2015-03-14 21:48:35 +00: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
.DA S.GetEnvVarA
.DA S.GetEnvVarYA
2015-03-14 21:48:35 +00:00
.DA S.SetEnvVarH
.DA S.SetEnvVarP
.DA S.DelEnvVarA
.DA S.DelEnvVarYA
2015-03-14 21:48:35 +00:00
*--------------------------------------
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
.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
*--------------------------------------
.DA S.ExecProcessNewEnvYA $90
.DA S.ExecProcessYA
.DA S.CreateProcessNewEnvYA
.DA S.CreateProcessYA
2015-03-14 21:48:35 +00:00
.DA S.GetPSByIDA
.DA 0
.DA S.Sleep
2015-03-14 21:48:35 +00:00
.DA 0
*--------------------------------------
.DA S.CheckPrefixA $A0
.DA S.FileSearch
.DA S.LoadFileA
2015-10-20 08:31:11 +00:00
.DA S.LoadFileYA
2015-03-14 21:48:35 +00:00
2015-10-20 08:31:11 +00:00
.DA S.ListDirInitA
2015-03-14 21:48:35 +00:00
.DA S.ListDirNextA
.DA S.ListDirCloseA
.DA 0
*--------------------------------------
2016-01-16 22:03:23 +00:00
.DA 0 $B0
.DA 0
.DA 0
.DA 0
2015-03-14 21:48:35 +00:00
.DA 0
.DA 0
.DA 0
.DA 0
*--------------------------------------
.DA S.ScreenSelectA $C0
2015-06-03 18:30:57 +00:00
.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
2015-03-14 21:48:35 +00:00
*--------------------------------------
.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
2015-06-03 18:30:57 +00:00
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
jsr S.IrqMgrInit
bcs *
2015-03-14 21:48:35 +00:00
jsr S.MemMgrInit
bcs *
2015-03-14 21:48:35 +00:00
jsr S.DevMgrInit
bcs *
2015-03-14 21:48:35 +00:00
jsr S.EvtMgrInit
bcs *
jsr S.TskMgrInit
bcs *
>LDYAI MSG.Init
jsr S.PSTROutYA
2015-03-14 21:48:35 +00:00
>LDYAI MSG.Init.Startup
jsr S.PSTROutYA
2015-03-14 21:48:35 +00:00
>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
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
2015-06-03 18:30:57 +00:00
>LDYAI MSG.Init.OK
jsr S.PSTROutYA
2015-03-14 21:48:35 +00:00
*--------------------------------------
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
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
.1 jsr S.SelectProcess0
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
jsr S.PSTROutYA
2015-03-14 21:48:35 +00:00
bra *
.99 jsr S.DumpEvent
2015-03-14 21:48:35 +00:00
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
2015-03-14 21:48:35 +00:00
*--------------------------------------
MSG.Init >PSTRING "A2osX[Stage2]:Init\n"
MSG.Init.Startup >PSTRING "EXEC A2osX.Startup...\n"
MSG.Init.OK >PSTRING "A2osX[Stage2]:Complete.\n"
2016-01-09 22:41:34 +00:00
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"
2015-03-14 21:48:35 +00:00
*--------------------------------------
STARTUP.CMD >PSTRING "${A2OSX}SBIN/SHELL"
STARTUP.ARGS >PSTRING "${A2OSX}A2osX.STARTUP"
2015-03-14 21:48:35 +00:00
*--------------------------------------
ENV.A2osX >PSTRING "A2OSX"
ENV.PATH >PSTRING "PATH"
ENV.PATH.VALUE >PSTRING "${A2OSX}SBIN/;${A2OSX}BIN/"
2015-03-14 21:48:35 +00:00
ENV.LIB >PSTRING "LIB"
ENV.LIB.VALUE >PSTRING "${A2OSX}LIB/"
ENV.DRV >PSTRING "DRV"
ENV.DRV.VALUE >PSTRING "${A2OSX}DRV/"
2015-03-14 21:48:35 +00:00
*--------------------------------------
.INB SYS/KERNEL.S.IRQ
2015-03-14 21:48:35 +00:00
.INB SYS/KERNEL.S.MEM
.INB SYS/KERNEL.S.STR
.INB SYS/KERNEL.S.CIO
.INB SYS/KERNEL.S.FIO
2015-06-03 18:30:57 +00:00
.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
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-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