mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel version 0.8 : Fixed a bug in DRV relocation
This commit is contained in:
parent
6fe1beb1ae
commit
728278c196
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -36,9 +36,7 @@ CS.START cld
|
||||
L.MSG.DETECT .DA MSG.DETECT
|
||||
.DA 0 End Of Reloc Table
|
||||
*--------------------------------------
|
||||
Dev.Detect >DEBUG
|
||||
|
||||
>LDYA L.MSG.DETECT
|
||||
Dev.Detect >LDYA L.MSG.DETECT
|
||||
>SYSCALL SYS.PStrOutYA
|
||||
|
||||
clc
|
||||
|
@ -134,7 +134,7 @@ H.BIN.CODE.LEN .EQ 8
|
||||
H.BIN.EXE.DS.SIZE .EQ 10
|
||||
H.BIN.EXE.REL.TABLE .EQ 16
|
||||
*
|
||||
H.BIN.DRV.DEVCTRLBLK.O .EQ 10
|
||||
H.BIN.DRV.HEADER.O .EQ 10
|
||||
H.BIN.DRV.CODE.O .EQ 12
|
||||
H.BIN.DRV.CODE.LEN .EQ 14
|
||||
H.BIN.DRV.REL.TABLE .EQ 0
|
||||
@ -266,7 +266,7 @@ TSKMGR.ERRNSP .EQ $DD No Such Process Error
|
||||
*--------------------------------------
|
||||
SYSMGR.ERRSYN .EQ $CF Syntax Error
|
||||
SYSMGR.ERRENVF .EQ $CE Env is Full
|
||||
|
||||
SYSMGR.ERRIBIN .EQ $CD Invalid BIN format
|
||||
SYSMGR.ERRFTB .EQ $CC File Too Big Error
|
||||
SYSMGR.ERRFNF .EQ $CB File Not Found Error
|
||||
*--------------------------------------
|
||||
|
@ -71,6 +71,7 @@ K.LoadEXEYA.1 >PUSHWI KrnBuf256
|
||||
jsr BIN.SetupCodeEndPtr2
|
||||
|
||||
jsr BIN.RelocateEXE
|
||||
bcs .98
|
||||
|
||||
>LDYA K.LoadEXEYA.Filename get back bin path
|
||||
>SYSCALL SYS.NewPStrYA make a copy of this string
|
||||
@ -106,13 +107,28 @@ K.LoadEXEYA.Filename .BS 2
|
||||
K.LoadEXEYA.hMem .BS 1
|
||||
*--------------------------------------
|
||||
* BIN.InstallDRV
|
||||
* pDrv = .DRV File Loaded Address
|
||||
* In:
|
||||
* pDrv = .DRV File Loaded Address
|
||||
* Note:
|
||||
* K.LoadEXEYA called from K.LoadDrvYA
|
||||
* Already setup correctly pDrv,
|
||||
* BIN.Relocate.Start,End
|
||||
*--------------------------------------
|
||||
BIN.InstallDRV ldy #H.BIN.DRV.CODE.O
|
||||
BIN.InstallDRV lda DevMgr.Free Offset = Target DRV address-AUXTYPE
|
||||
sec
|
||||
sbc BIN.Relocate.Start
|
||||
sta BIN.Relocate.Offset
|
||||
|
||||
lda DevMgr.Free+1
|
||||
sbc BIN.Relocate.Start+1
|
||||
sta BIN.Relocate.Offset+1
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc BIN.Relocate.Start Advance start From Bin code to DRV code
|
||||
sta BIN.Relocate.Start
|
||||
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc BIN.Relocate.Start+1
|
||||
@ -133,127 +149,71 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.O
|
||||
sta BIN.InstallDRV.DRVEnd
|
||||
tay Save DRVEnd LO
|
||||
lda DevMgr.Free+1
|
||||
sta ZPQuickPtr3+1 save it for DrvMove
|
||||
adc BIN.InstallDRV.DRVLen+1 A = DRVEnd HI
|
||||
sta BIN.InstallDRV.DRVEnd+1
|
||||
|
||||
bcs .98 we crossed $FFFF, out of mem
|
||||
bcs .9 we crossed $FFFF, out of mem
|
||||
|
||||
cpy #DevMgr.HiMem
|
||||
sbc /DevMgr.HiMem
|
||||
bcs .98 No More Room to load Driver....
|
||||
bcs .9 No More Room to load Driver....
|
||||
|
||||
lda DevMgr.LastDevID
|
||||
inc
|
||||
cmp #K.DEV.MAX
|
||||
beq .99 No Device Handle Left
|
||||
bne .10 No Device Handle Left
|
||||
|
||||
sta DevMgr.LastDevID
|
||||
|
||||
ldy #H.BIN.DRV.DEVCTRLBLK.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #S.DEV.JMP
|
||||
|
||||
lda DevMgr.Free
|
||||
lda #DEVMGR.ERROOH
|
||||
sec
|
||||
sbc (ZPQuickPtr1),y
|
||||
sta BIN.Relocate.Offset
|
||||
lda DevMgr.Free+1
|
||||
iny
|
||||
sbc (ZPQuickPtr1),y
|
||||
sta BIN.Relocate.Offset+1
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #H.BIN.DRV.CODE.LEN
|
||||
jsr BIN.SetupCodeEndPtr2
|
||||
|
||||
jsr BIN.RelocateDRV
|
||||
|
||||
jsr BIN.MoveDRV
|
||||
|
||||
>LDYA BIN.InstallDRV.DrvEnd
|
||||
>STYA DevMgr.Free
|
||||
clc
|
||||
rts
|
||||
|
||||
.98 lda #DEVMGR.ERROOM
|
||||
rts
|
||||
|
||||
.9 lda #DEVMGR.ERROOM
|
||||
sec
|
||||
rts
|
||||
|
||||
.99 lda #DEVMGR.ERROOH
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
BIN.MoveDRV ldy #H.BIN.DRV.DEVCTRLBLK.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #S.DEV.JMP Relocate Main JMP
|
||||
lda (ZPQuickPtr1),y
|
||||
clc
|
||||
adc BIN.Relocate.Offset
|
||||
sta (ZPQuickPtr1),y
|
||||
iny
|
||||
lda (ZPQuickPtr1),y
|
||||
adc BIN.Relocate.Offset+1
|
||||
sta (ZPQuickPtr1),y
|
||||
.10 sta DevMgr.LastDevID
|
||||
|
||||
lda DevMgr.LastDevID
|
||||
jsr K.GetDevByIDA
|
||||
>STYA pDev
|
||||
>STYA ZPQuickPtr2 setup Ptr2 to dest HEADER
|
||||
|
||||
ldy #S.DEV Make sure DevMgr.Table Ends with 0
|
||||
lda #0
|
||||
sta (pDev),y
|
||||
ldy #H.BIN.DRV.HEADER.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1 set Ptr1 to Src HEADER
|
||||
|
||||
ldy #S.DEV-1
|
||||
|
||||
dey
|
||||
|
||||
.1 lda (ZPQuickPtr1),y Copy DRV.Header
|
||||
sta (pDev),y
|
||||
.1 lda (ZPQuickPtr1),y copy header to DevMgr.Table
|
||||
sta (ZPQuickPtr2),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
ldy #S.DEV.JMP Setup Main JMP
|
||||
lda DevMgr.Free
|
||||
sta (ZPQuickPtr2),y
|
||||
tax
|
||||
iny
|
||||
lda DevMgr.Free+1
|
||||
sta (ZPQuickPtr2),y
|
||||
|
||||
lda DevMgr.LastDevID Save Dev.ID in the driver for SELECT
|
||||
ldy #S.DEV.ID
|
||||
sta (pDev),y
|
||||
stx ZPQuickPtr2 set Ptr2 to Dest CODE
|
||||
sta ZPQuickPtr2+1
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1 Make ZPQuickPtr1=DRV.CODE
|
||||
|
||||
>LDYA DevMgr.Free
|
||||
>STYA ZPQuickPtr2 Make ZPQuickPtr1=Dest location in LC
|
||||
|
||||
sta ZPQuickPtr1+1 set Ptr1 to Src CODE
|
||||
|
||||
lda BIN.InstallDRV.DrvLen+1
|
||||
eor #$ff
|
||||
pha
|
||||
@ -263,11 +223,11 @@ BIN.MoveDRV ldy #H.BIN.DRV.DEVCTRLBLK.O
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 inx
|
||||
.2 inx Move CODE in LC
|
||||
bne .3
|
||||
pla
|
||||
dec
|
||||
beq .8
|
||||
inc
|
||||
beq .4
|
||||
pha
|
||||
|
||||
.3 lda (ZPQuickPtr1),y
|
||||
@ -276,9 +236,27 @@ BIN.MoveDRV ldy #H.BIN.DRV.DEVCTRLBLK.O
|
||||
bne .2
|
||||
inc ZPQuickPtr1+1
|
||||
inc ZPQuickPtr2+1
|
||||
bra .2
|
||||
bra .2
|
||||
|
||||
.4 ldy #H.BIN.DRV.CODE.LEN
|
||||
lda DevMgr.Free Make Ptr1 = code start
|
||||
sta ZPQuickPtr1
|
||||
clc
|
||||
adc (pDrv),y
|
||||
sta ZPQuickPtr2
|
||||
|
||||
.8 rts
|
||||
iny
|
||||
lda DevMgr.Free+1
|
||||
sta ZPQuickPtr1+1
|
||||
adc (pDrv),y
|
||||
sta ZPQuickPtr2+1 Make ZPQuickPtr2 = ZPQuickPtr1 + CodeLen
|
||||
|
||||
jsr BIN.RelocateDRV
|
||||
|
||||
>LDYA BIN.InstallDRV.DrvEnd
|
||||
>STYA DevMgr.Free
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
BIN.InstallDRV.DrvLen .BS 2
|
||||
BIN.InstallDRV.DrvEnd .BS 2
|
||||
@ -306,9 +284,15 @@ BIN.Relocate.Offset .BS 2
|
||||
BIN.RelocateEXE ldy #H.BIN.HEADER+1
|
||||
lda (ZPQuickPtr1),y
|
||||
cmp /H.BIN.HEADER.BIN65
|
||||
bne *
|
||||
beq .1
|
||||
cmp /H.BIN.HEADER.DRV65
|
||||
beq .1
|
||||
|
||||
ldy #H.BIN.JMP relocate Main JMP
|
||||
lda #SYSMGR.ERRIBIN
|
||||
sec
|
||||
rts
|
||||
|
||||
.1 ldy #H.BIN.JMP relocate Main JMP
|
||||
lda (ZPQuickPtr1),y
|
||||
clc
|
||||
adc BIN.Relocate.Offset
|
||||
|
14
SYS/KERNEL.S.DAT.txt
Normal file
14
SYS/KERNEL.S.DAT.txt
Normal file
@ -0,0 +1,14 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
ENV.DRV >PSTRING "DRV"
|
||||
ENV.LIB >PSTRING "LIB"
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.DAT
|
||||
LOAD SYS/KERNEL.S
|
||||
ASM
|
@ -42,10 +42,11 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray
|
||||
inc ZPQuickPtr1+1
|
||||
|
||||
.1 >LDYA ZPQuickPtr1
|
||||
|
||||
jsr pDrvJmp call Dev.Detect
|
||||
|
||||
bcs .97
|
||||
|
||||
|
||||
jsr BIN.InstallDRV
|
||||
|
||||
bcs .97
|
||||
@ -73,7 +74,6 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
ENV.DRV >PSTRING "DRV"
|
||||
K.LoadDrv.CmdArray .BS 2
|
||||
K.LoadDrv.hFullName .BS 1
|
||||
K.LoadDrv.hMem .BS 1
|
||||
|
@ -13,8 +13,7 @@ AUTO 6
|
||||
* Y,A = PSTR to FilePath (PSTRING)
|
||||
* X = hMem to FilePath
|
||||
*--------------------------------------
|
||||
K.FileSearch >DEBUG
|
||||
>PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
|
||||
K.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
|
||||
>PULLYA Get Search list
|
||||
>SYSCALL SYS.ExpandPStrYA Expand it (SYSCALL to BNK1)
|
||||
bcs .99
|
||||
@ -66,13 +65,13 @@ K.FileSearch >DEBUG
|
||||
jsr K.FreeMemA
|
||||
>LDYAI KrnBuf256
|
||||
>SYSCALL SYS.NewPStrYA
|
||||
rts
|
||||
.99 rts
|
||||
|
||||
.98 lda K.FileSearch.hSrch Discard Expanded hSrch list
|
||||
jsr K.FreeMemA
|
||||
lda #SYSMGR.ERRFNF
|
||||
sec
|
||||
.99 rts
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.FileSearch.hSrch .BS 1
|
||||
K.FileSearch.Index .BS 1
|
||||
|
@ -16,6 +16,9 @@ Kernel.Init3 jsr K.DevMgrInit
|
||||
|
||||
ldx #DEVMGR.SELECT
|
||||
jsr pDevJmp
|
||||
|
||||
lda #2
|
||||
sta A2osX.ASCREEN
|
||||
|
||||
>LDYAI MSG.Init3
|
||||
>SYSCALL SYS.PStrOutYA
|
||||
|
@ -89,7 +89,6 @@ K.UnloadLibA pha
|
||||
pla
|
||||
jmp K.FreeMemA
|
||||
*--------------------------------------
|
||||
ENV.LIB >PSTRING "LIB"
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.LIB
|
||||
LOAD SYS/KERNEL.S
|
||||
|
@ -94,6 +94,7 @@ A2osX.D002.END .EQ *
|
||||
A2osX.E000 .EQ *
|
||||
.PH $E000
|
||||
.INB SYS/KERNEL.S.JMP
|
||||
.INB SYS/KERNEL.S.DAT
|
||||
.INB SYS/KERNEL.S.IRQ
|
||||
.INB SYS/KERNEL.S.MEM
|
||||
*--------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user