A2osX/SYS/KERNEL.S.LIB.txt

96 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-06-03 18:30:57 +00:00
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
2016-09-21 15:20:37 +00:00
* K.LoadLibYA
2015-06-03 18:30:57 +00:00
* in :
* Y,A = PTR To Lib Name
* out :
* A = hMem To loaded LIB
*--------------------------------------
2016-09-21 15:20:37 +00:00
K.LoadLibYA >STYA K.LoadLib.Name save libname for K.FileSearch
>LDYAI ENV.LIB push ENVNAME=LIB
>SYSCALL SYS.GetEnvYA get value for ENV=LIB
2015-06-03 18:30:57 +00:00
bcs .99
2016-08-17 06:25:58 +00:00
>PUSHYA Push $LIB value
2016-09-21 15:20:37 +00:00
>PUSHW K.LoadLib.Name
2016-08-17 06:25:58 +00:00
2016-09-21 15:20:37 +00:00
jsr K.FileSearch find libname in $LIB
2016-08-17 06:25:58 +00:00
bcs .99
2016-09-21 15:20:37 +00:00
stx K.LoadLib.hFullName
2016-08-17 06:25:58 +00:00
jsr K.LoadExeYA Y,A=filename full path
2015-06-03 18:30:57 +00:00
bcs .98
2016-09-21 15:20:37 +00:00
stx K.LoadLib.hMem
2015-06-03 18:30:57 +00:00
>STYA pLib
ldx #LIBMGR.LOAD
jsr pLibJmp Call LIB.LOAD function
bcs .97
2016-08-17 06:25:58 +00:00
jsr .98 Cleanup...
2016-09-21 15:20:37 +00:00
lda K.LoadLib.hMem
2015-06-03 18:30:57 +00:00
clc
rts
2016-06-07 06:10:18 +00:00
.97 pha
2016-09-21 15:20:37 +00:00
lda K.LoadLib.hMem
jsr K.FreeMemA
2016-06-07 06:10:18 +00:00
pla
2016-06-07 06:10:18 +00:00
.98 pha
2016-09-21 15:20:37 +00:00
lda K.LoadLib.hFullName
jsr K.FreeMemA
2016-06-07 06:10:18 +00:00
pla
2016-08-17 06:25:58 +00:00
2015-06-03 18:30:57 +00:00
sec
.99 rts
*--------------------------------------
2016-09-21 15:20:37 +00:00
K.LoadLib.Name .BS 2
K.LoadLib.hFullName .BS 1
K.LoadLib.hMem .BS 1
*--------------------------------------
2016-09-21 15:20:37 +00:00
* K.UnloadLibA
2015-06-03 18:30:57 +00:00
* in :
* A = hMem To Lib
* out :
*--------------------------------------
2016-09-21 15:20:37 +00:00
K.UnloadLibA pha
jsr K.GetMemByIDA
2015-06-03 18:30:57 +00:00
>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
sta pLib
2015-06-03 18:30:57 +00:00
iny
lda (ZPQuickPtr1),y
sta pLib+1
2015-06-03 18:30:57 +00:00
ldx #LIBMGR.UNLOAD
jsr pLibJmp Call LIB.UNLOAD function
pla
2016-09-21 15:20:37 +00:00
jmp K.FreeMemA
2015-06-03 18:30:57 +00:00
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.LIB
LOAD SYS/KERNEL.S
ASM