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
*--------------------------------------
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 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
>STYA LIB.Jump+1
2015-06-03 18:30:57 +00:00
ldx #LIBMGR.LOAD
jsr LIB.Jump Call LIB.LOAD function
2015-06-03 18:30:57 +00:00
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
2017-01-12 17:43:45 +00:00
>STYA ZPPtr1
2015-06-03 18:30:57 +00:00
ldy #S.MEM.REFCNT
2017-01-12 17:43:45 +00:00
lda (ZPPtr1),y Get count of those referencing this lib
2015-06-03 18:30:57 +00:00
dec only one left ?
beq .1
2017-01-12 17:43:45 +00:00
sta (ZPPtr1),y
2015-06-03 18:30:57 +00:00
pla
clc
rts
.1 ldy #S.MEM.PTR
2017-01-12 17:43:45 +00:00
lda (ZPPtr1),y
sta LIB.Jump+1
2015-06-03 18:30:57 +00:00
iny
2017-01-12 17:43:45 +00:00
lda (ZPPtr1),y
sta LIB.Jump+2
2015-06-03 18:30:57 +00:00
ldx #LIBMGR.UNLOAD
jsr LIB.Jump Call LIB.UNLOAD function
2015-06-03 18:30:57 +00:00
pla
2016-09-21 15:20:37 +00:00
jmp K.FreeMemA
LIB.Jump jmp $ffff Self Modiied
2015-06-03 18:30:57 +00:00
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.LIB
LOAD SYS/KERNEL.S
ASM