A2osX/SYS/KERNEL.S.txt

264 lines
6.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
2016-06-07 06:10:18 +00:00
.OR $2000
2015-06-03 18:30:57 +00:00
.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
*--------------------------------------
2016-06-07 06:10:18 +00:00
TmpPtr1 .EQ $0 for X.PRINTF.S
2016-03-13 21:47:19 +00:00
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
*--------------------------------------
2016-06-07 06:10:18 +00:00
* Kernel Stage 2
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
Kernel.Init2 >LDAXI MSG.Init2
jsr PrintCStrAX
sei
ldx #$FF init 6502 stack to highest
txs
sta SETALTZP
2015-06-03 18:30:57 +00:00
2016-06-07 06:10:18 +00:00
stx A2osX.SaveSM
stx A2osX.SaveSX
sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F
lda RROMBNK1 Make sure ROM is enabled for X.PRINT.F
cli
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
>LDAXI MSG.Relocate
jsr PrintCStrAX
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
sei
sta SETALTZP
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
>LDYAI A2osX.BE00
>STYA ZPQuickPtr1
>LDYAI $BE00
>STYA ZPQuickPtr2
>LDYAI A2osX.BE00.SIZE^$FFFF
>STYA ZPQuickPtr3
2015-06-03 18:30:57 +00:00
2016-06-07 06:10:18 +00:00
jsr Kernel.Move
lda RRAMWRAMBNK2
lda RRAMWRAMBNK2
2015-06-03 18:30:57 +00:00
2016-06-07 06:10:18 +00:00
>LDYAI A2osX.D002
>STYA ZPQuickPtr1
>LDYAI $D000
>STYA ZPQuickPtr2
>LDYAI A2osX.D002.SIZE^$FFFF
>STYA ZPQuickPtr3
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
jsr Kernel.Move
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
2016-06-07 06:10:18 +00:00
>LDYAI A2osX.D001
>STYA ZPQuickPtr1
>LDYAI $D000
>STYA ZPQuickPtr2
>LDYAI A2osX.D001.SIZE^$FFFF
>STYA ZPQuickPtr3
jsr Kernel.Move
>LDYAI A2osX.E000
>STYA ZPQuickPtr1
>LDYAI $E000
>STYA ZPQuickPtr2
>LDYAI A2osX.E000.SIZE^$FFFF
>STYA ZPQuickPtr3
jsr Kernel.Move
2015-06-03 18:30:57 +00:00
>LDYAI D.STACK.TOP
>STYA pStack init Soft Stack
2016-06-07 06:10:18 +00:00
sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F
lda RROMBNK1 Make sure ROM is enabled for X.PRINT.F
cli
lda #6
sta A2osX.HZ
pha push HZ
>LDAXI MSG.HZ
jsr PrintCStrAX
jsr CPU.Init
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
>LDAXI MSG.K.INIT
jsr PrintCStrAX
sta SETALTZP
lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
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 *
2016-08-17 06:25:58 +00:00
sta CLRALTZP Make sure MAIN ZP...
lda RROMBNK1 ... & ROM is enabled for X.PRINT.F
2016-06-07 06:10:18 +00:00
>LDAXI MSG.Init2.OK
jsr PrintCStrAX
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
sta SETALTZP
lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
>DEBUGOA
*--------------------------------------
* Kernel Stage 3
*--------------------------------------
Kernel.Init3 ldx #DEVMGR.SELECT
jsr pDevJmp
>LDYAI MSG.Init3
>SYSCALL SYS.PSTROutYA
2016-08-17 06:25:58 +00:00
ldy #S.PS.hPREFIX
lda (pPs),y
>SYSCALL SYS.GetMemPtrA
>PUSHYA
>LDYAI MSG.Prefix
2016-06-07 06:10:18 +00:00
>SYSCALL SYS.PSTROutYA
2015-03-14 21:48:35 +00:00
2016-08-17 06:25:58 +00:00
>PUSHWI STARTUP.CMDLINE
>LDYAI MSG.Startup
>SYSCALL SYS.PSTROutYA
2016-08-17 06:25:58 +00:00
>LDYAI STARTUP.CMDLINE
2016-06-07 06:10:18 +00:00
>SYSCALL SYS.CreateProcessYA
2016-08-17 06:25:58 +00:00
bcs .9
2016-06-07 06:10:18 +00:00
>LDYAI MSG.Init3.OK
>SYSCALL SYS.PSTROutYA
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
>LDYAI TskMgr.Table
>STYA pPs
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
jmp S.KernelRun
2016-08-17 06:25:58 +00:00
.9 >PUSHA
>LDYAI MSG.StartupErr
>SYSCALL SYS.PSTROutYA
bra *
2016-06-07 06:10:18 +00:00
*--------------------------------------
Kernel.Move ldy #0
.1 inc ZPQuickPtr3
2015-03-14 21:48:35 +00:00
bne .2
2016-06-07 06:10:18 +00:00
inc ZPQuickPtr3+1
beq .9
.2 lda (ZPQuickPtr1),y
sta (ZPQuickPtr2),y
iny
bne .1
2015-06-03 18:30:57 +00:00
2016-06-07 06:10:18 +00:00
inc ZPQuickPtr1+1
inc ZPQuickPtr2+1
2016-03-13 21:47:19 +00:00
bne .1
2016-06-07 06:10:18 +00:00
.9 rts
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
.INB X.PRINTF.S
.INB SYS/KERNEL.S.CPU
.INB SYS/KERNEL.S.INIT
*--------------------------------------
2016-06-07 06:10:18 +00:00
MSG.Init2 >CSTRING "A2osX[Stage2]:Init\n"
MSG.Relocate >CSTRING "Relocating KERNEL...\n"
MSG.HZ >CSTRING "Kernel SYS Timer Set For %d0 hz Machine.\n"
MSG.K.INIT >CSTRING "Kernel Setup...\n"
MSG.Init2.OK >CSTRING "A2osX[Stage2]:Complete.\n"
*--------------------------------------
2016-06-07 06:10:18 +00:00
MSG.Init3 >PSTRING "A2osX[Stage3]:Init\n"
2016-08-17 06:25:58 +00:00
MSG.Prefix >PSTRING "Prefix:%S\n"
MSG.Startup >PSTRING "Executing Kernel Startup Script...\nCmd:%S\n"
MSG.StartupErr >PSTRING "Failed : [$%h]\n"
2016-06-07 06:10:18 +00:00
MSG.Init3.OK >PSTRING "A2osX[Stage3]:Complete.\n"
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-08-17 06:25:58 +00:00
STARTUP.CMDLINE >PSTRING "${A2OSX}SBIN/SHELL ${A2OSX}A2osX.STARTUP"
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
* Global Page
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
A2osX.BE00 .EQ *
.PH $BE00
.INB SYS/KERNEL.S.GP
.EP
A2osX.BE00.END .EQ *
*--------------------------------------
* LC AUX $D000 BANK1
*--------------------------------------
A2osX.D001 .EQ *
.PH $D000
.INB SYS/KERNEL.S.JMP
2016-06-24 06:02:32 +00:00
.INB SYS/KERNEL.S.RUN
2015-03-14 21:48:35 +00:00
.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
2016-08-17 06:25:58 +00:00
.INB SYS/KERNEL.S.ARG
2016-06-07 06:10:18 +00:00
.INB SYS/KERNEL.S.ENV
.INB SYS/KERNEL.S.EVT
2016-06-07 06:10:18 +00:00
.EP
A2osX.D001.END .EQ *
*--------------------------------------
* LC AUX $D000 BANK2
*--------------------------------------
A2osX.D002 .EQ *
.PH $D000
.INB SYS/KERNEL.S.REL
2016-06-07 06:10:18 +00:00
.EP
A2osX.D002.END .EQ *
*--------------------------------------
* LC AUX $E000
*--------------------------------------
A2osX.E000 .EQ *
.PH $E000
.INB SYS/KERNEL.S.IRQ
.INB SYS/KERNEL.S.MEM
2015-06-03 18:30:57 +00:00
.INB SYS/KERNEL.S.BIN
.INB SYS/KERNEL.S.DRV
.INB SYS/KERNEL.S.LIB
2015-03-14 21:48:35 +00:00
.INB SYS/KERNEL.S.TSK
2016-08-17 06:25:58 +00:00
.INB SYS/KERNEL.S.PS
2016-06-07 06:10:18 +00:00
*--------------------------------------
* Make sure KERNEL.S.DEV is the last one
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
.INB SYS/KERNEL.S.DEV
2016-06-07 06:10:18 +00:00
.EP
A2osX.E000.END .EQ *
*--------------------------------------
.LIST ON
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
A2osX.BE00.SIZE .EQ A2osX.BE00.END-A2osX.BE00
A2osX.D001.SIZE .EQ A2osX.D001.END-A2osX.D001
A2osX.D002.SIZE .EQ A2osX.D002.END-A2osX.D002
A2osX.E000.SIZE .EQ A2osX.E000.END-A2osX.E000
*--------------------------------------
.LIST OFF
2015-03-14 21:48:35 +00:00
MAN
SAVE SYS/KERNEL.S
ASM