mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-30 08:51:06 +00:00
96 lines
1.8 KiB
Plaintext
96 lines
1.8 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* K.LoadLibYA
|
||
* in :
|
||
* Y,A = PTR To Lib Name
|
||
* out :
|
||
* A = hMem To loaded LIB
|
||
*--------------------------------------
|
||
K.LoadLibYA >STYA K.LoadLib.Name save libname for K.FileSearch
|
||
>LDYAI ENV.LIB push ENVNAME=LIB
|
||
>SYSCALL GetEnvYA get value for ENV=LIB
|
||
bcs .99
|
||
|
||
>PUSHYA Push $LIB value
|
||
|
||
>PUSHW K.LoadLib.Name
|
||
|
||
jsr K.FileSearch find libname in $LIB
|
||
bcs .99
|
||
|
||
stx K.LoadLib.hFullName
|
||
|
||
jsr K.LoadExeYA Y,A=filename full path
|
||
bcs .98
|
||
|
||
stx K.LoadLib.hMem
|
||
>STYA pLib
|
||
|
||
ldx #LIBMGR.LOAD
|
||
jsr pLibJmp Call LIB.LOAD function
|
||
|
||
bcs .97
|
||
|
||
jsr .98 Cleanup...
|
||
|
||
lda K.LoadLib.hMem
|
||
clc
|
||
rts
|
||
|
||
.97 pha
|
||
lda K.LoadLib.hMem
|
||
jsr K.FreeMemA
|
||
pla
|
||
|
||
.98 pha
|
||
lda K.LoadLib.hFullName
|
||
jsr K.FreeMemA
|
||
pla
|
||
|
||
sec
|
||
.99 rts
|
||
*--------------------------------------
|
||
K.LoadLib.Name .BS 2
|
||
K.LoadLib.hFullName .BS 1
|
||
K.LoadLib.hMem .BS 1
|
||
*--------------------------------------
|
||
* K.UnloadLibA
|
||
* in :
|
||
* A = hMem To Lib
|
||
* out :
|
||
*--------------------------------------
|
||
K.UnloadLibA pha
|
||
jsr K.GetMemByIDA
|
||
>STYA ZPPtr1
|
||
ldy #S.MEM.REFCNT
|
||
lda (ZPPtr1),y Get count of those referencing this lib
|
||
dec only one left ?
|
||
beq .1
|
||
sta (ZPPtr1),y
|
||
pla
|
||
clc
|
||
rts
|
||
|
||
.1 ldy #S.MEM.PTR
|
||
lda (ZPPtr1),y
|
||
sta pLib
|
||
|
||
iny
|
||
lda (ZPPtr1),y
|
||
sta pLib+1
|
||
|
||
ldx #LIBMGR.UNLOAD
|
||
jsr pLibJmp Call LIB.UNLOAD function
|
||
pla
|
||
jmp K.FreeMemA
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.LIB
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|