Skip to content

Commit 08503ed

Browse files
committed
inlined ti.CpHLDE and ti.SetHLUTo0
1 parent a494909 commit 08503ed

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/libload/libload.asm

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,12 @@ check_already_loaded:
216216
.no_match:
217217
pop de
218218
ld hl, (end_arc_lib_locs)
219-
call ti.CpHLDE ; have we reached the end of the table?
220-
push af
221-
ex de, hl
222-
ld de, 15 ; size of search entry (9=name, 3=ram ptr, 3=arc vec ptr)
219+
or a, a
220+
sbc hl, de ; have we reached the end of the table?
221+
222+
ld hl, 15 ; size of search entry (9=name, 3=ram ptr, 3=arc vec ptr)
223223
add hl, de
224224
ex de, hl ; end of the extraction table?
225-
pop af
226225
pop hl
227226
jr z, .not_loaded
228227
jr .loop
@@ -377,7 +376,8 @@ good_version:
377376
add hl, de ; hl->start of library relocation table
378377
ld (reloc_tbl_ptr), hl ; store this
379378
ld de, (end_reloc_tbl)
380-
call ti.CpHLDE ; check and see if they match -- if so, this library is going to remain in the archive
379+
or a, a
380+
sbc hl, de ; check and see if they match -- if so, this library is going to remain in the archive
381381
jr nz, need_to_load_lib
382382
ld hl, (arclocation)
383383
ld (ramlocation), hl ; okay, not a ram location, but it's use is still the same
@@ -458,25 +458,27 @@ relocate_absolutes:
458458
ld hl, (reloc_tbl_ptr) ; restore this
459459
.loop:
460460
ld de, (end_reloc_tbl)
461-
call ti.CpHLDE ; have we reached the end of the relocation table
461+
or a, a
462+
sbc hl, de ; have we reached the end of the relocation table
462463
jr z, .done
463-
push hl ; save pointer to relocation table current
464-
ld a, (hl)
464+
add hl, de ; restore hl
465+
ld e, (hl)
465466
inc hl
466-
ld h, (hl)
467-
ld l, a ; hl->offset in ram library to relocate
468-
call ti.SetHLUTo0
467+
push hl ; save pointer to relocation table current
468+
ld d, (hl)
469+
ex.s de, hl ; hl->offset in ram library to relocate
470+
; UHL = 0
471+
469472
ld de, (ramlocation)
470473
add hl, de ; hl->location in library to relocate
471474
push hl
472475
ld hl, (hl) ; hl=offset we are relocating
473-
ld de, (ramlocation)
476+
; ld de, (ramlocation)
474477
add hl, de ; hl=new address
475478
ex de, hl ; de=new address
476479
pop hl
477480
ld (hl), de ; resolved absolute address
478481
pop hl
479-
inc hl
480482
inc hl ; move to next relocation vector
481483
jr .loop
482484
.done: ; have we found the start of the program?
@@ -502,7 +504,9 @@ check_has_deps: ; the first time we hit this, we have all the dependencies p
502504
load_next_dep:
503505
ld hl, (end_dep_queue)
504506
ld de, dep_queue_ptr
505-
call ti.CpHLDE ; make sure we are done parsing the dependency queue
507+
or a, a
508+
sbc hl, de ; make sure we are done parsing the dependency queue
509+
add hl, de
506510
; now we need to parse the libraries like they are programs. this will be fun.
507511
jr z, .exit
508512
dec hl

0 commit comments

Comments
 (0)