2015-06-03 18:30:57 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.LoadDrvA
|
|
|
|
|
* in :
|
|
|
|
|
* A = hMem To Full Cmd Line
|
|
|
|
|
* out :
|
|
|
|
|
* none
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.LoadDrvA >PUSHA push Cmd Line for S.PStrGetTkn
|
|
|
|
|
>PUSHBI $20 Push SEP=' '
|
|
|
|
|
>PUSHBI 0 Push 0 for getting CMD And ARGS
|
|
|
|
|
jsr S.PStrGetTkn
|
|
|
|
|
bcc .1
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 sta LoadDrv.Cmd
|
|
|
|
|
stx LoadDrv.Args
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI ENV.DRV push ENVNAME=DRV
|
|
|
|
|
jsr S.GetEnvVarYA get value for ENV=$DRV
|
|
|
|
|
bcs .98
|
|
|
|
|
sta LoadDrv.Path
|
|
|
|
|
|
|
|
|
|
>PUSHB LoadDrv.Cmd push CMD for S.FileSearch
|
|
|
|
|
>PUSHB LoadDrv.Path
|
|
|
|
|
jsr S.FileSearch find File in $DRV
|
|
|
|
|
bcs .97 not Found
|
|
|
|
|
|
|
|
|
|
sta LoadDrv.FullName
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.LoadBinA
|
|
|
|
|
bcs .96
|
|
|
|
|
|
|
|
|
|
>STYA pCode
|
|
|
|
|
stx LoadDrv.hMem
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda LoadDrv.Args
|
|
|
|
|
jsr pCodeJmp call Dev.Detect
|
|
|
|
|
|
|
|
|
|
bcs .95
|
|
|
|
|
|
|
|
|
|
jsr S.InsDrv
|
|
|
|
|
bcs .95
|
|
|
|
|
|
|
|
|
|
jsr .95
|
|
|
|
|
|
|
|
|
|
ldy #S.DEV.F
|
|
|
|
|
lda (pDev),y
|
|
|
|
|
ora #S.DEV.F.INUSE
|
|
|
|
|
sta (pDev),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.95 pha
|
|
|
|
|
lda LoadDrv.hMem
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.96 pha
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda LoadDrv.FullName
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.97 pha
|
|
|
|
|
lda LoadDrv.Path
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.98 pha
|
|
|
|
|
lda LoadDrv.Args
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
lda LoadDrv.Cmd
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
LoadDrv.Cmd .BS 1
|
|
|
|
|
LoadDrv.Args .BS 1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
LoadDrv.Path .BS 1
|
|
|
|
|
LoadDrv.FullName .BS 1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
LoadDrv.hMem .BS 1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* pCode = .DRV File Loaded Address
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.InsDrv ldy #H.BIN.DRV.CODE.LEN
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
sta R.AL
|
|
|
|
|
iny
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
sta R.AH
|
|
|
|
|
|
|
|
|
|
ldy #H.BIN.DRV.CODE.O
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
clc
|
|
|
|
|
adc S.LoadBinA.AuxType
|
|
|
|
|
sta R.BL
|
|
|
|
|
iny
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
adc S.LoadBinA.AuxType+1
|
|
|
|
|
sta R.BH set BX=End Of Code
|
|
|
|
|
|
|
|
|
|
lda S.LoadBinA.AuxType
|
|
|
|
|
clc
|
|
|
|
|
adc S.LoadBinA.FileLen
|
|
|
|
|
sta R.CL
|
|
|
|
|
lda S.LoadBinA.AuxType+1
|
|
|
|
|
adc S.LoadBinA.FileLen+1
|
|
|
|
|
sta R.CH set CX=End Of Range
|
|
|
|
|
|
|
|
|
|
ldy #H.BIN.DRV.CODE.O
|
|
|
|
|
lda S.LoadBinA.FileLen
|
|
|
|
|
sec
|
|
|
|
|
sbc (pCode),y
|
|
|
|
|
sta S.InsDrv.DRVLen
|
|
|
|
|
iny
|
|
|
|
|
lda S.LoadBinA.FileLen+1
|
|
|
|
|
sbc (pCode),y
|
|
|
|
|
sta S.InsDrv.DRVLen+1 Compute DRV Len
|
|
|
|
|
|
|
|
|
|
lda DevMgr.Free
|
|
|
|
|
clc
|
|
|
|
|
adc S.InsDrv.DRVLen
|
|
|
|
|
sta S.InsDrv.DRVEnd
|
|
|
|
|
lda DevMgr.Free+1
|
|
|
|
|
adc S.InsDrv.DRVLen+1
|
|
|
|
|
sta S.InsDrv.DRVEnd+1
|
|
|
|
|
|
|
|
|
|
bcs .98 we crossed $FFFF, out of mem
|
|
|
|
|
|
|
|
|
|
lda S.InsDrv.DRVEnd
|
|
|
|
|
sec
|
|
|
|
|
sbc #DevMgr.HiMem
|
|
|
|
|
lda S.InsDrv.DRVEnd+1
|
|
|
|
|
sbc /DevMgr.HiMem
|
|
|
|
|
bcs .98 No More Room to load Driver....
|
|
|
|
|
|
|
|
|
|
lda DevMgr.LastDevID
|
|
|
|
|
inc
|
|
|
|
|
cmp #K.DEV.MAX
|
|
|
|
|
beq .99 No Device Handle Left
|
|
|
|
|
|
|
|
|
|
sta DevMgr.LastDevID
|
|
|
|
|
|
|
|
|
|
ldy #H.BIN.DEV.HEADER.O
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
clc
|
|
|
|
|
adc pCode
|
|
|
|
|
sta ZPQuickPtr1
|
|
|
|
|
iny
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
adc pCode+1
|
|
|
|
|
sta ZPQuickPtr1+1
|
|
|
|
|
|
|
|
|
|
ldy #S.DEV.JMP
|
|
|
|
|
|
|
|
|
|
lda DevMgr.Free
|
|
|
|
|
sec
|
|
|
|
|
sbc (ZPQuickPtr1),y
|
|
|
|
|
sta R.DL
|
|
|
|
|
lda DevMgr.Free+1
|
|
|
|
|
iny
|
|
|
|
|
sbc (ZPQuickPtr1),y
|
|
|
|
|
sta R.DH set DX=Offset
|
|
|
|
|
|
|
|
|
|
ldy #H.BIN.DRV.CODE.O
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
clc
|
|
|
|
|
adc pCode
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
adc pCode+1
|
|
|
|
|
ply
|
|
|
|
|
|
|
|
|
|
jsr S.DrvRelocateYA
|
|
|
|
|
|
|
|
|
|
jsr S.InsDrv.Move
|
|
|
|
|
|
|
|
|
|
>LDYA S.InsDrv.DrvEnd
|
|
|
|
|
>STYA DevMgr.Free
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.98 lda #DEVMGR.ERROOM
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 lda #DEVMGR.ERROOH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.InsDrv.Move ldy #H.BIN.DEV.HEADER.O
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
clc
|
|
|
|
|
adc pCode
|
|
|
|
|
sta ZPQuickPtr1
|
|
|
|
|
iny
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
adc pCode+1
|
|
|
|
|
sta ZPQuickPtr1+1
|
|
|
|
|
|
|
|
|
|
ldy #S.DEV.JMP Relocate Main JMP
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
clc
|
|
|
|
|
adc R.DL
|
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
adc R.DH
|
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
|
|
|
|
|
lda DevMgr.LastDevID
|
|
|
|
|
jsr S.GetDevByIDA
|
|
|
|
|
>STYA pDev
|
|
|
|
|
|
2015-12-10 18:53:30 +00:00
|
|
|
|
ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pDev),y
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPQuickPtr1),y Copy DRV.Header
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pDev),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldy #H.BIN.DRV.CODE.O
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
clc
|
|
|
|
|
adc pCode
|
|
|
|
|
sta ZPQuickPtr1
|
|
|
|
|
iny
|
|
|
|
|
lda (pCode),y
|
|
|
|
|
adc pCode+1
|
|
|
|
|
sta ZPQuickPtr1+1 Make ZPQuickPtr1=DRV.CODE
|
|
|
|
|
|
|
|
|
|
lda DevMgr.Free
|
|
|
|
|
sta ZPQuickPtr2
|
|
|
|
|
lda DevMgr.Free+1
|
|
|
|
|
sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location
|
|
|
|
|
|
|
|
|
|
ldy S.InsDrv.DrvLen
|
|
|
|
|
ldx S.InsDrv.DrvLen+1
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPQuickPtr1)
|
|
|
|
|
sta (ZPQuickPtr2)
|
|
|
|
|
|
|
|
|
|
inc ZPQuickPtr1
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPQuickPtr1+1
|
|
|
|
|
|
|
|
|
|
.3 inc ZPQuickPtr2
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPQuickPtr2+1
|
|
|
|
|
|
|
|
|
|
.4 tya
|
|
|
|
|
bne .5
|
|
|
|
|
txa
|
|
|
|
|
beq .8
|
|
|
|
|
dex
|
|
|
|
|
|
|
|
|
|
.5 dey
|
|
|
|
|
bra .2
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.InsDrv.DrvLen .BS 2
|
|
|
|
|
S.InsDrv.DrvEnd .BS 2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.DRV
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|