Skip to content

Commit ed356e0

Browse files
committed
size optimized libload start
1 parent ed6bb79 commit ed356e0

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/libload/libload.asm

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ disable_relocations
9090
call ti.MemClear
9191
pop bc
9292

93-
ld a, (iy + LIB_FLAGS)
94-
ld (flag_save), a
95-
ld (ix_save), ix ; save IX since older ICE programs don't
96-
9793
ld hl, $AA55AA
9894
xor a, a
9995
sbc hl, bc
@@ -117,19 +113,11 @@ disable_relocations
117113

118114
ld (error_sp), sp
119115

120-
ld (iy + LIB_FLAGS), c ; C is zero here
121-
; res is_dep, (iy + LIB_FLAGS)
122-
; res optional, (iy + LIB_FLAGS)
123-
124116
ld a, (hl)
125117
cp a, REQ_LIB_MARKER
126118
jr z, start
127-
set optional, (iy + LIB_FLAGS)
128119
cp a, OPT_LIB_MARKER
129-
jr z, start
130-
ld a, (flag_save)
131-
ld (iy + LIB_FLAGS), a ; restore flag bits
132-
ld ix, (ix_save) ; restore IX register
120+
jr z, start_optional
133121
jp (hl) ; return to execution if there are no libs
134122

135123
macro relocate? name, address*
@@ -187,7 +175,20 @@ macro rload? name
187175
dl name - $ - 3
188176
end macro
189177

178+
start_optional:
179+
; set optional, (iy + LIB_FLAGS)
180+
ld c, 1 shl optional
190181
start:
182+
ld (ix_save), ix ; save IX since older ICE programs don't
183+
184+
ld a, (iy + LIB_FLAGS)
185+
ld (flag_save), a
186+
; initialize LIB_FLAGS
187+
; REQ_LIB_MARKER --> C = 0
188+
; OPT_LIB_MARKER --> C = (1 << optional)
189+
ld (iy + LIB_FLAGS), c
190+
; res is_dep, (iy + LIB_FLAGS)
191+
191192
push hl
192193
call ti.PushOP1 ; save calling program name
193194
pop hl

0 commit comments

Comments
 (0)