A2osX/SYS/KERNEL.S.LIB.txt

95 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-06-03 18:30:57 +00:00
PR#3
PREFIX /A2OSX.BUILD
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
*--------------------------------------
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
stx .9+1
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
stx .8+1
>STYA LIB.Jump+1
2015-06-03 18:30:57 +00:00
txa Pass hLib to LibLoad
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...
.8 lda #$ff hLib
2015-06-03 18:30:57 +00:00
clc
rts
2016-06-07 06:10:18 +00:00
.97 pha
lda .8+1
2016-09-21 15:20:37 +00:00
jsr K.FreeMemA
2016-06-07 06:10:18 +00:00
pla
2016-06-07 06:10:18 +00:00
.98 pha
.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
*--------------------------------------
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 /A2OSX.SRC/SYS/KERNEL.S.LIB
LOAD /A2OSX.SRC/SYS/KERNEL.S
2015-06-03 18:30:57 +00:00
ASM