Skip to content

Commit 1a9046a

Browse files
ZERICO2005mateoconlechuga
authored andcommitted
optimize memory loads in good_version/need_to_load_lib
1 parent 88ebfcd commit 1a9046a

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

src/libload/libload.asm

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,11 @@ good_version:
369369
inc hl
370370
ld (end_arc_lib_locs), hl
371371

372-
ld hl, ti.userMem ; this is where programs are loaded to
373-
ld de, (ti.asm_prgm_size)
372+
ld de, ti.userMem ; this is where programs are loaded to
373+
ld hl, (ti.asm_prgm_size)
374374
add hl, de ; hl->end of program+libaries
375-
ex de, hl ; de->location to load to
376375

377-
ld (ramlocation), de ; save this pointer
376+
ld (ramlocation), hl ; save this pointer
378377

379378
res keep_in_arc, (iy + LIB_FLAGS)
380379
ld hl, (arclocation) ; hl->start of library code in archive
@@ -389,7 +388,7 @@ good_version:
389388
set keep_in_arc, (iy + LIB_FLAGS)
390389

391390
need_to_load_lib:
392-
ld de, (ramlocation)
391+
ld de, (ramlocation) ; de->location to load to
393392
ld hl, (end_arc_lib_locs)
394393
ld (hl), de
395394
inc hl
@@ -415,14 +414,14 @@ need_to_load_lib:
415414
.enough_mem:
416415
call ti.InsertMem ; insert memory for the relocated library (de)
417416

418-
ld hl, (loaded_size) ; loaded size = dependency jumps + library code
419-
ld de, (ti.asm_prgm_size)
420-
add hl, de
417+
ld bc, (loaded_size) ; loaded size = dependency jumps + library code
418+
ld hl, (ti.asm_prgm_size)
419+
add hl, bc
421420
ld (ti.asm_prgm_size), hl ; store new size of program+libraries
422421

423422
ld hl, (arclocation) ; hl->start of library code
424423
ld de, (ramlocation) ; de->insertion place
425-
ld bc, (loaded_size) ; bc=loaded library size
424+
; bc = loaded library size
426425
ldir ; copy in the library to ram
427426

428427
resolve_entry_points:

0 commit comments

Comments
 (0)