Skip to content

Commit b0592ce

Browse files
ZERICO2005mateoconlechuga
authored andcommitted
inlined ti.CpHLDE and ti.SetHLUTo0
1 parent cbb89d4 commit b0592ce

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

src/libload/libload.asm

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,12 @@ check_already_loaded:
235235
.no_match:
236236
pop de
237237
ld hl, (end_arc_lib_locs)
238-
call ti.CpHLDE ; have we reached the end of the table?
239-
push af
240-
ex de, hl
241-
ld de, 15 ; size of search entry (9=name, 3=ram ptr, 3=arc vec ptr)
238+
or a, a
239+
sbc hl, de ; have we reached the end of the table?
240+
241+
ld hl, 15 ; size of search entry (9=name, 3=ram ptr, 3=arc vec ptr)
242242
add hl, de
243243
ex de, hl ; end of the extraction table?
244-
pop af
245244
pop hl
246245
jr nz, .loop
247246

@@ -381,7 +380,8 @@ good_version:
381380
add hl, de ; hl->start of library relocation table
382381
ld (reloc_tbl_ptr), hl ; store this
383382
ld de, (end_reloc_tbl)
384-
call ti.CpHLDE ; check and see if they match -- if so, this library is going to remain in the archive
383+
or a, a
384+
sbc hl, de ; check and see if they match -- if so, this library is going to remain in the archive
385385
jr nz, need_to_load_lib
386386
ld hl, (arclocation)
387387
ld (ramlocation), hl ; okay, not a ram location, but it's use is still the same
@@ -498,25 +498,26 @@ relocate_absolutes:
498498
ld hl, (reloc_tbl_ptr) ; restore this
499499
.loop:
500500
ld de, (end_reloc_tbl)
501-
call ti.CpHLDE ; have we reached the end of the relocation table
501+
or a, a
502+
sbc hl, de ; have we reached the end of the relocation table
502503
jr z, .done
503-
push hl ; save pointer to relocation table current
504-
ld a, (hl)
504+
add hl, de ; restore hl
505+
ld e, (hl)
505506
inc hl
506-
ld h, (hl)
507-
ld l, a ; hl->offset in ram library to relocate
508-
call ti.SetHLUTo0
507+
push hl ; save pointer to relocation table current
508+
ld d, (hl)
509+
ex.s de, hl ; hl->offset in ram library to relocate
510+
; UHL = 0
511+
509512
ld de, (ramlocation)
510513
add hl, de ; hl->location in library to relocate
511514
push hl
512515
ld hl, (hl) ; hl=offset we are relocating
513-
ld de, (ramlocation)
514516
add hl, de ; hl=new address
515517
ex de, hl ; de=new address
516518
pop hl
517519
ld (hl), de ; resolved absolute address
518520
pop hl
519-
inc hl
520521
inc hl ; move to next relocation vector
521522
jr .loop
522523

@@ -544,7 +545,9 @@ check_has_deps: ; the first time we hit this, we have all the dependencies p
544545
load_next_dep:
545546
ld hl, (end_dep_queue)
546547
ld de, dep_queue_ptr
547-
call ti.CpHLDE ; make sure we are done parsing the dependency queue
548+
or a, a
549+
sbc hl, de ; make sure we are done parsing the dependency queue
550+
add hl, de
548551
; now we need to parse the libraries like they are programs. this will be fun.
549552
jr z, .exit
550553
dec hl

0 commit comments

Comments
 (0)