2015-06-03 18:30:57 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-04-10 06:07:14 +00:00
|
|
|
|
LOMEM $A00
|
2015-06-03 18:30:57 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-04-10 06:07:14 +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
|
|
|
|
|
|
2017-04-13 20:59:25 +00:00
|
|
|
|
stx .9+1
|
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
|
|
|
|
|
2017-04-13 20:59:25 +00:00
|
|
|
|
stx .8+1
|
2017-03-27 15:32:30 +00:00
|
|
|
|
>STYA LIB.Jump+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-04-10 06:07:14 +00:00
|
|
|
|
txa Pass hLib to LibLoad
|
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
|
|
|
|
|
2017-04-13 20:59:25 +00:00
|
|
|
|
.8 lda #$ff hLib
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.97 pha
|
2017-04-13 20:59:25 +00:00
|
|
|
|
lda .8+1
|
2016-09-21 15:20:37 +00:00
|
|
|
|
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
|
2017-04-13 20:59:25 +00:00
|
|
|
|
.9 lda #$ff
|
2016-09-21 15:20:37 +00:00
|
|
|
|
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
|
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
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.LIB
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ASM
|