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
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>LDYAI ENV.LIB push ENVNAME=LIB
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetEnvYA get value for ENV=LIB
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .99
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA Push $LIB value
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
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
|
|
|
|
|
2016-09-30 06:24:52 +00:00
|
|
|
|
jsr K.LoadExeYA Y,A=filename full path
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .98
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
stx K.LoadLib.hMem
|
2017-03-27 15:32:30 +00:00
|
|
|
|
>STYA LIB.Jump+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
ldx #LIBMGR.LOAD
|
2017-03-27 15:32:30 +00:00
|
|
|
|
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...
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
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
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
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
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
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
|
2017-03-27 15:32:30 +00:00
|
|
|
|
sta LIB.Jump+1
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2017-03-27 15:32:30 +00:00
|
|
|
|
sta LIB.Jump+2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
ldx #LIBMGR.UNLOAD
|
2017-03-27 15:32:30 +00:00
|
|
|
|
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
|
2017-03-27 15:32:30 +00:00
|
|
|
|
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
|