Kernel version 0.9 : IRQ Manager rewrite

This commit is contained in:
Rémy GIBERT 2017-01-25 17:18:35 +01:00
parent f951a7bcc8
commit 93215c5ff7
9 changed files with 191 additions and 89 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,6 +13,7 @@ AUTO 8
MLIOPEN00.PATH .EQ $200
MLIOPEN00.BUFF .EQ $0C00 1k Buffer for MLI open
MLIREAD00.ADDR .EQ $2000 for loading KERNEL
MLIREAD01.ADDR .EQ A2osX.HZ for loading CONFIG
*--------------------------------------
.PH $1000
*--------------------------------------
@ -72,12 +73,28 @@ A2osX.QC.Start1 sei
jsr A2osX.QC.KLoad
bcs .9
>LDAXI MSG.CLOADING
jsr A2osX.QC.PrintAX
jsr A2osX.QC.CLoad
bcc .8
>LDAXI MSG.CLOADING.KO
jsr A2osX.QC.PrintAX
ldx #15
.5 lda A2OSXCONF.DEFAULT,x
sta A2osX.HZ,x
dex
bpl .5
* >LDYAI GO.Reset
* >STYA POWERUP
* bit RROMBNK1
* jsr SETPWRC
>LDAXI MSG.INIT1OK
.8 >LDAXI MSG.INIT1OK
jsr A2osX.QC.PrintAX
>DEBUGOA
@ -87,7 +104,28 @@ A2osX.QC.Start1 sei
jsr A2osX.QC.PrintAX
bra *
*--------------------------------------
A2osX.QC.KLoad ldx A2osX.QC.Prefix
A2osX.QC.KLoad >LDYAI SYSKERNEL
jsr A2osX.QC.FOPENYA
bcs .9
>LDYAI MLIREAD00K
jsr A2osX.QC.FREADYA
.9 rts
*--------------------------------------
A2osX.QC.CLoad >LDYAI A2OSXCONF
jsr A2osX.QC.FOPENYA
bcs .9
>LDYAI MLIREAD00C
jsr A2osX.QC.FREADYA
.9 rts
*--------------------------------------
A2osX.QC.FOPENYA
>STYA TmpPtr1
ldx A2osX.QC.Prefix
.1 lda A2osX.QC.Prefix,x
sta MLIOPEN00.PATH,x
dex
@ -95,12 +133,15 @@ A2osX.QC.KLoad ldx A2osX.QC.Prefix
ldx A2osX.QC.Prefix
ldy #0
.2 lda SYSKERNEL+1,y
.2 iny
lda (TmpPtr1),y
sta MLIOPEN00.PATH+1,x
inx
iny
cpy SYSKERNEL
tya
cmp (TmpPtr1)
bne .2
stx MLIOPEN00.PATH
>LDAXI MLIOPEN00.PATH
@ -112,18 +153,27 @@ A2osX.QC.KLoad ldx A2osX.QC.Prefix
bcs .9
lda MLIOPEN00+5
sta MLIREAD00+1
sta MLIREAD00K+1
sta MLIREAD00C+1
sta MLICLOSE00+1
.9 rts
*--------------------------------------
A2osX.QC.FREADYA
>STYA .1
jsr MLI
.DA #MLIREAD
.DA MLIREAD00
bcs .9
.1 .DA $ffff
php
pha
jsr MLI
.DA #MLICLOSE
.DA MLICLOSE00
.9 rts
pla
plp
rts
*--------------------------------------
A2osX.QC.PrintAX
>STAX TmpPtr1
@ -148,21 +198,35 @@ MLIOPEN00 .DA #3
.DA MLIOPEN00.PATH
.DA MLIOPEN00.BUFF
.BS 1
MLIREAD00 .DA #4
MLIREAD00K .DA #4
.BS 1
.DA MLIREAD00.ADDR
.DA $8000
.BS 2
MLIREAD00C .DA #4
.BS 1
.DA MLIREAD01.ADDR
.DA 16
.BS 2
MLICLOSE00 .DA #1
.BS 1
*--------------------------------------
SYSKERNEL >PSTR "SYS/KERNEL"
A2OSXCONF >PSTR "A2osX.CONF"
*--------------------------------------
A2OSXCONF.DEFAULT
.DA #6 60hz
.BS 7
.DA #0 ChRoot
.BS 7 All Slots marked as "Free"
*--------------------------------------
MSG.INIT1 >PSTR "A2osX[Stage1]:Init"
MSG.SETPREFIXOK >PSTR "Set Prefix OK"
MSG.SETPREFIXKO >PSTR "Insert Vol:"
MSG.KLOADING >PSTR "Loading Kernel..."
MSG.KLOADING.KO >PSTR "Error While Loading Kernel."
MSG.CLOADING >PSTR "Reading Kernel Config File..."
MSG.CLOADING.KO >PSTR "Error While Reading Kernel Config File, Using Default."
MSG.INIT1OK >PSTR "A2osX[Stage1]:Complete."
*--------------------------------------
.BS $1300-*

View File

@ -118,19 +118,26 @@ A2osX.ASCREEN .EQ $BEE0 Active Screen
A2osX.SCRNDEVS .EQ $BEE1 -> $BEE4 (4 screen devices)
A2osX.CPUTYPE .EQ $BEE5
A2osX.CPUSPEED .EQ $BEE6 (->255.99 Mhz)
A2osX.CPUSPEED .EQ $BEE6 WORD, (->255.99 Mhz)
A2osX.Z80SLOT .EQ $BEE7
A2osX.Z80SPEED .EQ $BEE8
A2osX.Z80SLOT .EQ $BEE8
A2osX.Z80SPEED .EQ $BEE9 WORD
A2osX.TIMER16 .EQ $BEEC
A2osX.RANDOM16 .EQ $BEEE
A2osX.TIMER16 .EQ $BEEC WORD
A2osX.RANDOM16 .EQ $BEEE WORD
*--------------------------------------
* $BEF0->$BEFF : Kernel Config Block
*--------------------------------------
A2osX.HZ .EQ $BEF0
A2osX.RAMDRVDIS .EQ $BEF8 If $80, prevent ChRooting to /RAMx
A2osX.SLOTS .EQ $BEF8 $BEF9->$BEFF, 7 slots
A2osX.SLOTS.Z80 .EQ $80
A2osX.SLOTS.VSDRIVE .EQ $81
A2osX.SLOTS.ATCARD .EQ $82
A2osX.SLOTS.DII .EQ $C0
A2osX.SLOTS.BLK .EQ $C1
A2osX.SLOTS.SP .EQ $C2
A2osX.SLOTS.DISABLE .EQ $FF
*--------------------------------------
H.BIN.HEADER .EQ 0
H.BIN.HEADER.DRV65 .EQ $4CD8 6502:cld,jmp abs

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.SRC
NEW
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
@ -206,9 +206,34 @@ A2osX.SaveA .BS 1
A2osX.SaveX .BS 1
A2osX.SaveY .BS 1
*--------------------------------------
BrkHandler bra *
* Called for ProDOS IRQ Manager (LCBNK1)
* A,X,Y, $FA->$FF Already Saved
* Main RAM,ZP/LC selected
* must begin with CLD
* must exit with RTS
* - CC if IRQ cleared, CS if NOT
*--------------------------------------
IrqHandler bra *
ProDOS.INTNUM .BS 1
*--------------------------------------
IrqHandler cld
sta SETALTZP
tsx
stx A2osX.SaveSM
ldx A2osX.SaveSX
txs
jsr K.IrqHandler
tsx
stx A2osX.SaveSX
ldx A2osX.SaveSM
txs
sta CLRALTZP
rts
*--------------------------------------
BrkHandler bra *
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.GP

View File

@ -79,9 +79,7 @@ Kernel.Init2 sei
bit RROMBNK1 Make sure ROM is enabled for X.PRINT.F
cli
lda #6
sta A2osX.HZ
lda A2osX.HZ
pha push HZ
>LDAXI MSG.HZ
jsr PrintCStrAX
@ -92,6 +90,22 @@ Kernel.Init2 sei
jsr PrintCStrAX
rts Do NOT replace this JSR/RTS with a JMP
*--------------------------------------
Kernel.Move ldy #0
.1 inc ZPPtr3
bne .2
inc ZPPtr3+1
beq .9
.2 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
bne .1
inc ZPPtr1+1
inc ZPPtr2+1
bne .1
.9 rts
*--------------------------------------
MSG.Init2 >CSTR "A2osX[Stage2]:Init\nInstalling KERNEL...\n - Global Page...\n"
MSG.D000BNK1 >CSTR " - $D000 Bank1...\n"
MSG.D000BNK2 >CSTR " - $D000 Bank2...\n"
@ -184,6 +198,10 @@ CPU.Init.Z80 >LDAXI MSG.Z80
sta A2osX.Z80SLOT
pha Push Z80Slot
tax
lda #A2osX.SLOTS.Z80
sta A2osX.SLOTS,x
>LDAXI MSG.Z80.OK
jsr PrintCStrAX
rts
@ -266,8 +284,7 @@ Z80Code.Start .HS 31FFFF START: LD SP,0FFFFH Init Stack
.HS 3200E1 LD (0E100H),A Back to 6502
.HS 18F3 JR START Loop
.HS 00 FLAG: .DB 0
Z80Code.End .EQ *
Z80Code.Size .EQ Z80Code.End-Z80Code.Start
Z80Code.Size .EQ *-Z80Code.Start
*--------------------------------------
MSG.CPU >CSTR "Checking CPU..."
MSG.CPU.SPEED >CSTR "Detecting CPU Speed..."
@ -287,22 +304,6 @@ MSG.CPU.SPEEDOK >CSTR "%d.%02d Mhz.\n"
MSG.Z80 >CSTR "Detecting Z80 CPU..."
MSG.Z80.OK >CSTR "Detected In Slot %d.\n"
MSG.Z80.KO >CSTR "Not Detected.\n"
*--------------------------------------
Kernel.Move ldy #0
.1 inc ZPPtr3
bne .2
inc ZPPtr3+1
beq .9
.2 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
bne .1
inc ZPPtr1+1
inc ZPPtr2+1
bne .1
.9 rts
MAN
SAVE SYS/KERNEL.S.INIT2
LOAD SYS/KERNEL.S

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.SRC
NEW
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
@ -14,7 +14,7 @@ Kernel.Init3 jsr MemMgrInit
>LDYAI MSG.IRQ
>SYSCALL CPrintFYA
* jsr IrqMgrInit
jsr IrqMgrInit
bcs *
>LDYAI MSG.DEV
@ -140,32 +140,26 @@ DevMgr.SYS .DA DevMgr.SYS.Code
.AS "SYS" NAME
.HS 00 NAME must Be 4 bytes long
*--------------------------------------
* Setup MainLC ($3FE)
*
*
* Setup AuxLC $FFFE->Kernel IRQ Handler
* if irq not handled, jmp (S.IrqMgrOldFFFE)
*--------------------------------------
IrqMgrInit php
sei
>LDYA $FFFE
cpy #K.IrqHandlerAuxLC
bne .1
cmp /K.IrqHandlerAuxLC
beq .2
.1 >STYA K.IrqMgrOldFFFE
>STYA K.IrqMgrOldFFFE
>LDYAI K.IrqHandlerAuxLC
>STYA $FFFE
.2
* >LDYAI $BE0C
* >STYA $3F0
plp
clc
rts
>LDYAI IrqHandler
>STYA MLICALL.PARAMS+2
>MLICALL MLIALLOCIRQ
bcs .9
lda MLICALL.PARAMS+1
sta ProDOS.INTNUM
.9 rts
*--------------------------------------
DevMgrInit stz ZPPtr1
lda #$C1
@ -183,6 +177,7 @@ DevMgrInit stz ZPPtr1
bpl .2
*SmartPort!!!
jsr DevMgrInit.SP
ldy #A2osX.SLOTS.SP
bra .7
* Disk II, or Block device ?
.3 dex if x=0, only first SIG byte failed
@ -193,6 +188,7 @@ DevMgrInit stz ZPPtr1
bne .4 $0, Disk II, 16sect
jsr DevMgrInit.DII
ldy #A2osX.SLOTS.DII
bra .7
.4 inc
@ -200,11 +196,12 @@ DevMgrInit stz ZPPtr1
dec
* Block device
jsr DevMgrInit.BLK
ldy #A2osX.SLOTS.BLK
.7 lda ZPPtr1+1
and #$0f
tax
lda #$80
tya
sta A2osX.SLOTS,x
.8 inc SP.DEV+5

View File

@ -5,9 +5,6 @@ INC 1
AUTO 6
.LIST OFF
*--------------------------------------
S.BrkHandlerAuxLC
bra *
*--------------------------------------
* called directly by IRQ Vector $FFFE in AuxLC
* Must keep:
* A,X,Y
@ -24,8 +21,6 @@ K.IrqHandlerAuxLC
and #$10 BRK?
beq .10
bne *
lda K.IrqMgr.A
.82 jmp (K.IrqMgrOldFFFE)
@ -39,29 +34,9 @@ K.IrqHandlerAuxLC
pha
sta CLRREADAUX Make sure we can access DevMgr.Table
>LDYAI DevMgr.Table
>STYA $fe
jsr K.IrqHandler
.1 lda ($fe) End Of Table ?
sec
beq .8
ldy #S.DEV.F
lda ($fe),y
and #S.DEV.F.IRQ
beq .2
jsr K.IrqHandlerJMP
bcc .8 CC, IRQ cleared by device
.2 lda $fe CS,
adc #S.DEV-1
sta $fe
bcc .1
inc $ff
bra .1
.8 pla Must keep Carry
pla Must keep Carry
bpl .81
sta SETREADAUX
.81 pla
@ -73,15 +48,48 @@ K.IrqHandlerAuxLC
lda K.IrqMgr.A
bcs .82
rti
K.IrqHandlerJMP ldx #DEVMGR.READ
jmp ($fe)
*--------------------------------------
K.IrqMgrOldFFFE .BS 2
K.IrqMgr.A .BS 1
K.IrqMgr.X .BS 1
K.IrqMgr.Y .BS 1
*--------------------------------------
* Called by ProDOS IRQ Manager (GP)
*--------------------------------------
K.IrqHandler >LDYAI DevMgr.Table
>STYA $fe
ldx DevMgr.Count
.1 lda ($fe) End Of Table ?
sec
beq .8
ldy #S.DEV.F
lda ($fe),y
and #S.DEV.F.IRQ
beq .2
phx
jsr K.IrqHandlerJMP
plx
bcc .8 CC, IRQ cleared by device
.2 lda $fe CS,
adc #S.DEV-1
sta $fe
bcc .3
inc $ff
.3 dex
bne .1
sec
.8 rts
*--------------------------------------
K.IrqHandlerJMP ldx #DEVMGR.READ
jmp ($fe)
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.IRQ
LOAD SYS/KERNEL.S