2015-06-03 18:30:57 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.LoadLibYA
|
|
|
|
|
* in :
|
|
|
|
|
* Y,A = PTR To Lib Name
|
|
|
|
|
* out :
|
|
|
|
|
* A = hMem To loaded LIB
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.LoadLibYA jsr S.NewPStrYA
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
sta S.LoadLibYA.hLibName save LibName hMem for discard
|
|
|
|
|
jsr S.LoadLibA
|
|
|
|
|
|
|
|
|
|
php save error status
|
|
|
|
|
pha save error code/hMem
|
|
|
|
|
lda S.LoadLibYA.hLibName
|
|
|
|
|
jsr S.FreeMemA discard STR hMem
|
|
|
|
|
pla get back error code/hMem
|
|
|
|
|
plp ..and error status
|
|
|
|
|
.99 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.LoadLibYA.hLibName .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.LoadLibA
|
|
|
|
|
* in :
|
|
|
|
|
* A = hMem To Lib Name
|
|
|
|
|
* out :
|
|
|
|
|
* A = hMem of Loaded Lib
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.LoadLibA sta S.LoadLibA.hName push libname for S.FileSearch
|
|
|
|
|
>LDYAI ENV.LIB push ENVNAME=LIB
|
|
|
|
|
jsr S.GetEnvVarYA get value for ENV=LIB
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .99
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
sta S.LoadLibA.hSrch save hMem to LIB VALUE
|
|
|
|
|
|
|
|
|
|
>PUSHB S.LoadLibA.hName
|
|
|
|
|
>PUSHB S.LoadLibA.hSrch
|
|
|
|
|
jsr S.FileSearch find libname in $LIB
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .98
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
sta S.LoadLibA.hPath
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.LoadBinA A = hMem of filename full path
|
|
|
|
|
bcs .97
|
2015-11-22 22:30:06 +00:00
|
|
|
|
stx S.LoadLibA.hMem
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>STYA pLib
|
|
|
|
|
|
|
|
|
|
ldx #LIBMGR.LOAD
|
|
|
|
|
jsr pLibJmp Call LIB.LOAD function
|
|
|
|
|
|
|
|
|
|
bcs .97
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
jsr .97
|
|
|
|
|
|
|
|
|
|
lda S.LoadLibA.hMem
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.97 lda S.LoadLibA.hPath discard LIB PATH
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
|
|
|
|
.98 lda S.LoadLibA.hSrch discard LIB VALUE
|
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.LoadLibA.hName .BS 1
|
|
|
|
|
S.LoadLibA.hSrch .BS 1
|
|
|
|
|
S.LoadLibA.hPath .BS 1
|
|
|
|
|
S.LoadLibA.hMem .BS 1
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* S.UnloadLibA
|
|
|
|
|
* in :
|
|
|
|
|
* A = hMem To Lib
|
|
|
|
|
* out :
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.UnloadLibA pha
|
|
|
|
|
jsr S.GetMemByIDA
|
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
ldy #S.MEM.REFCNT
|
|
|
|
|
lda (ZPQuickPtr1),y Get count of those referencing this lib
|
|
|
|
|
dec only one left ?
|
|
|
|
|
beq .1
|
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
pla
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.MEM.PTR
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
ply
|
|
|
|
|
>STYA pLib
|
|
|
|
|
|
|
|
|
|
ldx #LIBMGR.UNLOAD
|
|
|
|
|
jsr pLibJmp Call LIB.UNLOAD function
|
|
|
|
|
pla
|
|
|
|
|
jmp S.FreeMemA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.LIB
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|