2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* S.LoadBinYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* in :
|
|
|
|
|
* A = hMem of FilePath (PSTRING)
|
|
|
|
|
* out :
|
|
|
|
|
* Y,A = MEMPTR
|
|
|
|
|
* X = hMem of Code Segment
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
S.LoadBinYA >STYA S.LoadBin.Filename
|
|
|
|
|
jsr S.PStrUprYA
|
|
|
|
|
|
|
|
|
|
>LDYA S.LoadBin.Filename
|
2016-06-07 06:10:18 +00:00
|
|
|
|
jsr S.GetMemByNameYA
|
2015-09-13 20:35:07 +00:00
|
|
|
|
bcs .3 not already loaded
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>STYA ZPQuickPtr1 Save base address
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.REFCNT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (ZPQuickPtr1),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
inc
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.PTR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (ZPQuickPtr1),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pha Y,A = MEM PTR...
|
|
|
|
|
iny
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (ZPQuickPtr1),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ply X=hMem from S.GetMemByNameA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.3 >LDYA S.LoadBin.Filename
|
2016-06-07 06:10:18 +00:00
|
|
|
|
jsr S.LoadFileYA
|
2016-08-19 14:52:18 +00:00
|
|
|
|
bcs .99 Error Loading file
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-19 14:52:18 +00:00
|
|
|
|
>STYA S.LoadBin.SegLen
|
2016-08-17 06:25:58 +00:00
|
|
|
|
stx S.LoadBin.hMem save hMem
|
2015-03-14 21:48:35 +00:00
|
|
|
|
txa
|
|
|
|
|
jsr S.GetMemPtrA
|
2016-08-19 14:52:18 +00:00
|
|
|
|
>STYA S.LoadBin.NewBase
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>LDYA S.LoadBin.Filename
|
2016-06-07 06:10:18 +00:00
|
|
|
|
jsr S.MLIGetFileInfoYA Get File Info for AUXTYPE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .98
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-19 14:52:18 +00:00
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #2 get AUXTYPE
|
2016-08-19 14:52:18 +00:00
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
sta S.LoadBin.OldBase
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2016-08-19 14:52:18 +00:00
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
sta S.LoadBin.OldBase+1
|
|
|
|
|
|
2016-06-23 15:56:13 +00:00
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
|
2016-08-19 14:52:18 +00:00
|
|
|
|
jsr S.InsBin
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-06-23 15:56:13 +00:00
|
|
|
|
bit RRAMWRAMBNK1
|
|
|
|
|
bit RRAMWRAMBNK1
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .98 relocation error, dicard Code segment
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>LDYA S.LoadBin.Filename get back bin path
|
|
|
|
|
jsr S.NewPStrYA make a copy of this string
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .98
|
2016-08-17 06:25:58 +00:00
|
|
|
|
phx save copy
|
2015-09-13 20:35:07 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda S.LoadBin.hMem
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.GetMemByIDA
|
|
|
|
|
>STYA ZPQuickPtr1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (ZPQuickPtr1)
|
|
|
|
|
ora #S.MEM.F.CODE This is a code segment
|
|
|
|
|
sta (ZPQuickPtr1)
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
|
|
|
|
pla
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.BIN
|
|
|
|
|
sta (ZPQuickPtr1),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda S.LoadBin.hMem
|
2015-06-03 18:30:57 +00:00
|
|
|
|
tax return hMEM to Caller...
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
clc ...and Y,A=PTR to CS
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.98 pha
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda S.LoadBin.hMem
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.FreeMemA Discard Loaded Code
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pla
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
2016-08-19 14:52:18 +00:00
|
|
|
|
.99 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
S.LoadBin.Filename .BS 2
|
|
|
|
|
S.LoadBin.hMem .BS 1
|
2016-08-19 14:52:18 +00:00
|
|
|
|
S.LoadBin.OldBase .BS 2
|
|
|
|
|
S.LoadBin.NewBase .BS 2
|
|
|
|
|
S.LoadBin.SegLen .BS 2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.BIN
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|