Skip to content

Commit c00ccad

Browse files
committed
inlined ti.CpHLDE and ti.SetHLUTo0
1 parent 047098a commit c00ccad

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/libload/libload.asm

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ 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?
219+
or a, a
220+
sbc hl, de ; have we reached the end of the table?
221+
220222
push af
221-
ex de, hl
222-
ld de, 15 ; size of search entry (9=name, 3=ram ptr, 3=arc vec ptr)
223+
ld hl, 15 ; size of search entry (9=name, 3=ram ptr, 3=arc vec ptr)
223224
add hl, de
224225
ex de, hl ; end of the extraction table?
225226
pop af
@@ -377,7 +378,8 @@ good_version:
377378
add hl, de ; hl->start of library relocation table
378379
ld (reloc_tbl_ptr), hl ; store this
379380
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
381+
or a, a
382+
sbc hl, de ; check and see if they match -- if so, this library is going to remain in the archive
381383
jr nz, need_to_load_lib
382384
ld hl, (arclocation)
383385
ld (ramlocation), hl ; okay, not a ram location, but it's use is still the same
@@ -458,25 +460,27 @@ relocate_absolutes:
458460
ld hl, (reloc_tbl_ptr) ; restore this
459461
.loop:
460462
ld de, (end_reloc_tbl)
461-
call ti.CpHLDE ; have we reached the end of the relocation table
463+
or a, a
464+
sbc hl, de ; have we reached the end of the relocation table
462465
jr z, .done
463-
push hl ; save pointer to relocation table current
464-
ld a, (hl)
466+
add hl, de ; restore hl
467+
ld e, (hl)
465468
inc hl
466-
ld h, (hl)
467-
ld l, a ; hl->offset in ram library to relocate
468-
call ti.SetHLUTo0
469+
push hl ; save pointer to relocation table current
470+
ld d, (hl)
471+
ex.s de, hl ; hl->offset in ram library to relocate
472+
; UHL = 0
473+
469474
ld de, (ramlocation)
470475
add hl, de ; hl->location in library to relocate
471476
push hl
472477
ld hl, (hl) ; hl=offset we are relocating
473-
ld de, (ramlocation)
478+
; ld de, (ramlocation)
474479
add hl, de ; hl=new address
475480
ex de, hl ; de=new address
476481
pop hl
477482
ld (hl), de ; resolved absolute address
478483
pop hl
479-
inc hl
480484
inc hl ; move to next relocation vector
481485
jr .loop
482486
.done: ; have we found the start of the program?
@@ -502,7 +506,9 @@ check_has_deps: ; the first time we hit this, we have all the dependencies p
502506
load_next_dep:
503507
ld hl, (end_dep_queue)
504508
ld de, dep_queue_ptr
505-
call ti.CpHLDE ; make sure we are done parsing the dependency queue
509+
or a, a
510+
sbc hl, de ; make sure we are done parsing the dependency queue
511+
add hl, de
506512
; now we need to parse the libraries like they are programs. this will be fun.
507513
jr z, .exit
508514
dec hl

0 commit comments

Comments
 (0)