Skip to content

Commit 9bb1006

Browse files
committed
inlined the rcall to enqueue_all_deps
1 parent 2c0a5ca commit 9bb1006

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

src/libload/libload.asm

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ macro relocate? name, address*
143143
end macro
144144

145145
relocate helpers, buf + 900
146+
if 0
146147
call_relative:
147148
pop ix
148149
pea ix + 3
@@ -151,6 +152,7 @@ call_relative:
151152
add ix, de
152153
pop de
153154
jp (ix)
155+
end if
154156
jump_relative:
155157
pop ix
156158
push de
@@ -421,7 +423,42 @@ need_to_load_lib:
421423

422424
resolve_entry_points:
423425
ld hl, (ramlocation)
424-
rcall enqueue_all_deps ; get all the dependency pointers that reside in the ram lib
426+
427+
; get all the dependency pointers that reside in the ram lib
428+
enqueue_all_deps: ; we don't need to store anything if we are here
429+
bit keep_in_arc, (iy + LIB_FLAGS)
430+
jr nz, .finish ; really, this is just a precautionary check -- should work fine without
431+
.loop:
432+
res optional, (iy + LIB_FLAGS)
433+
ld a, (hl)
434+
cp a, REQ_LIB_MARKER ; is there a dependency?
435+
jr nz, .check
436+
ex de, hl
437+
ld hl, (end_dep_queue)
438+
ld (hl), de ; save pointer to start of this dependency -- one at a time
439+
inc hl
440+
inc hl
441+
inc hl ; move to next pointer
442+
ld (end_dep_queue), hl ; save next pointer
443+
ex de, hl
444+
.skip:
445+
move_string_to_end
446+
inc hl ; move to start of dependency jump table
447+
ld a, JP_OPCODE
448+
.next:
449+
cp a, (hl) ; jp byte ($C3)
450+
jr nz, .loop
451+
inc hl
452+
inc hl
453+
inc hl
454+
inc hl ; jp address
455+
jr .next
456+
.check:
457+
cp a, ti.AppVarObj
458+
jr z, .skip ; keep going
459+
.finish:
460+
461+
resolve_entry_points_enqueued:
425462
ld hl, (jump_tbl_ptr) ; hl->start of function jump table
426463
ld bc, 3
427464
ld a, JP_OPCODE
@@ -521,39 +558,6 @@ load_next_dep:
521558
ld a, 1
522559
jp (hl) ; passed all the checks; let's start execution! :)
523560

524-
enqueue_all_deps: ; we don't need to store anything if we are here
525-
bit keep_in_arc, (iy + LIB_FLAGS)
526-
ret nz ; really, this is just a precautionary check -- should work fine without
527-
.loop:
528-
res optional, (iy + LIB_FLAGS)
529-
ld a, (hl)
530-
cp a, REQ_LIB_MARKER ; is there a dependency?
531-
jr nz, .check
532-
ex de, hl
533-
ld hl, (end_dep_queue)
534-
ld (hl), de ; save pointer to start of this dependency -- one at a time
535-
inc hl
536-
inc hl
537-
inc hl ; move to next pointer
538-
ld (end_dep_queue), hl ; save next pointer
539-
ex de, hl
540-
.skip:
541-
move_string_to_end
542-
inc hl ; move to start of dependency jump table
543-
ld a, JP_OPCODE
544-
.next:
545-
cp a, (hl) ; jp byte ($C3)
546-
jr nz, .loop
547-
inc hl
548-
inc hl
549-
inc hl
550-
inc hl ; jp address
551-
jr .next
552-
.check:
553-
cp a, ti.AppVarObj
554-
jr z, .skip ; keep going
555-
ret
556-
557561
error_invalid:
558562
rload str_error_invalid
559563
jr throw_error

0 commit comments

Comments
 (0)