@@ -300,9 +300,9 @@ optional_lib_clear:
300300 ld (hl) , e ; mark optional library as not found
301301 pop hl
302302 inc hl ; skip version byte
303+ ld a , JP_OPCODE
303304. loop :
304- ld a , (hl)
305- cp a , JP_OPCODE ; jp byte ($C3)
305+ cp a , (hl) ; jp byte ($C3)
306306 jr nz , .done
307307 inc hl
308308 ld (hl) , de ; make the vector zero
@@ -425,15 +425,15 @@ resolve_entry_points:
425425 ld hl , (ramlocation)
426426 rcall enqueue_all_deps ; get all the dependency pointers that reside in the ram lib
427427 ld hl , (jump_tbl_ptr) ; hl->start of function jump table
428+ ld bc , 3
429+ ld a , JP_OPCODE
428430. loop :
429- ld a , (hl)
430- cp a , JP_OPCODE ; jp byte ($C3)
431+ cp a , (hl) ; jp byte ($C3)
431432 jr nz , .done
432433 inc hl ; bypass jp byte ($C3)
433434 push hl
434435 ld hl , (hl) ; offset in vector table (0, 3, 6, etc.)
435- ld bc , 3
436- call ti._idivs ; originally the offset was just added because vectors were stored in three bytes, now it is just 2 to save space
436+ call ti._idivu ; originally the offset was just added because vectors were stored in three bytes, now it is just 2 to save space
437437 add hl , hl ; (offset/3) * 2
438438 ld de , (vector_tbl_ptr) ; hl->start of vector table
439439 add hl , de ; hl->correct vector entry
@@ -443,9 +443,7 @@ resolve_entry_points:
443443 ex de , hl ; de->function in ram
444444 pop hl ; restore jump offset
445445 ld (hl) , de ; de=resolved address
446- inc hl
447- inc hl
448- inc hl ; move to next jump
446+ add hl , bc ; move to next jump
449447 jr . loop
450448.done: ; finished resolving entry points
451449 ; now relocate absolutes in library
@@ -544,9 +542,9 @@ enqueue_all_deps: ; we don't need to store anything if we are here
544542.skip:
545543 move_string_to_end
546544 inc hl ; move to start of dependency jump table
545+ ld a , JP_OPCODE
547546.next:
548- ld a , (hl)
549- cp a , JP_OPCODE
547+ cp a , (hl) ; jp byte ($C3)
550548 jr nz , . loop
551549 inc hl
552550 inc hl
0 commit comments