Skip to content

Commit 40ea17c

Browse files
fix changes to fileioc from review
Signed-off-by: mateoconlechuga <matthewwaltzis@gmail.com>
1 parent 9a1b5d9 commit 40ea17c

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/fileioc/fileioc.asm

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,16 +1368,16 @@ ti_ArchiveHasRoom:
13681368
; return:
13691369
; true if there is room, false if not
13701370
pop de
1371-
ex (sp),hl
1372-
push de
1373-
.entry:
1374-
ex.s de,hl
1375-
push de
13761371
pop bc
1377-
call ti.FindFreeArcSpot
1378-
ld a,1
1372+
push bc
1373+
push de
1374+
cp a, a ; set z flag
1375+
ld hl, $FF0000
1376+
add hl, bc
1377+
call nc, ti.FindFreeArcSpot
1378+
ld a, 1
13791379
ret nz
1380-
xor a,a
1380+
xor a, a
13811381
ret
13821382

13831383
;-------------------------------------------------------------------------------
@@ -1397,15 +1397,15 @@ ti_ArchiveHasRoomVar:
13971397
ld hl,(hl)
13981398
ld bc,-6
13991399
add hl,bc
1400-
ld c,(hl) ; get var size
1400+
ld c,(hl) ; get var name length
14011401
call util_get_data_ptr
1402-
ld hl,(hl)
1402+
ld de,(hl)
14031403
.entry_sym:
14041404
ld a,c
14051405
ex de,hl
14061406
ld hl,(hl)
14071407
ld bc,12
1408-
add hl,bc
1408+
add a,c
14091409
ld c,a
14101410
add.s hl,bc
14111411
jr c,.fail
@@ -1648,14 +1648,21 @@ util_archive: ; properly handle garbage collects
16481648
call ti.ChkFindSym
16491649
call ti.ChkInRam
16501650
ret nz
1651-
call ti_ArchiveHasRoomVar.entry_sym
1652-
jp nz,ti.Arc_Unarc
16531651
call ti.PushOP1
1652+
call ti_ArchiveHasRoomVar.entry_sym
1653+
jr z,.handle_gc
1654+
call ti.Arc_Unarc
1655+
jp ti.PopOP1
1656+
.handle_gc:
16541657
call util_pre_gc_default_handler
16551658
util_pre_gc_handler := $-3
1659+
ld iy, ti.flags
1660+
call ti.PopOP1
1661+
call ti.PushOP1
16561662
call ti.Arc_Unarc
16571663
call util_post_gc_default_handler
16581664
util_post_gc_handler := $-3
1665+
ld iy, ti.flags
16591666
jp ti.PopOP1
16601667

16611668
util_unarchive:

0 commit comments

Comments
 (0)