Skip to content

Commit a73f818

Browse files
committed
optimized ZX0 with eZ80 instructions and removed SMC
1 parent 047098a commit a73f818

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/ce/zx0.src

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ _zx0_Decompress:
1515
; -----------------------------------------------------------------------------
1616

1717
dzx0_turbo:
18-
ld bc, -1 ; preserve default offset 1
19-
ld (dzx0t_last_offset+1), bc
20-
inc bc
21-
ld a, $80
22-
jr dzx0t_literals
18+
ld iy, -1 ; preserve default offset 1
19+
lea bc, iy + 2 ; ld bc, 1
20+
scf
21+
jr dzx0t_start
22+
2323
dzx0t_new_offset:
2424
dec bc
2525
dec bc ; prepare negative offset
@@ -37,14 +37,15 @@ dzx0t_new_offset_skip:
3737
inc hl
3838
rr b ; last offset bit becomes first length bit
3939
rr c
40-
ld (dzx0t_last_offset+1), bc ; preserve new offset
40+
push bc
41+
pop iy ; preserve new offset
4142
ld bc, 1 ; obtain length
4243
call nc, dzx0t_elias
4344
inc bc
4445
dzx0t_copy:
4546
push hl ; preserve source
46-
dzx0t_last_offset:
47-
ld hl, 0 ; restore offset
47+
; dzx0t_last_offset:
48+
lea hl, iy ; restore offset
4849
add hl, de ; calculate destination - offset
4950
ldir ; copy from offset
5051
pop hl ; restore source
@@ -54,6 +55,7 @@ dzx0t_literals:
5455
inc c ; obtain length
5556
add a, a
5657
jr nz, dzx0t_literals_skip
58+
dzx0t_start:
5759
ld a, (hl) ; load another group of 8 bits
5860
inc hl
5961
rla
@@ -71,6 +73,7 @@ dzx0t_literals_skip:
7173
dzx0t_last_offset_skip:
7274
call nc, dzx0t_elias
7375
jr dzx0t_copy
76+
7477
dzx0t_elias:
7578
add a, a ; interlaced Elias gamma coding
7679
rl c

0 commit comments

Comments
 (0)