From b8cfbbbc7b3ecd376d1f9cab4fb0aa5e10d0f4a0 Mon Sep 17 00:00:00 2001 From: Doug Masten Date: Fri, 26 Jun 2020 23:52:00 -0500 Subject: [PATCH] Optimize handling of token's Z flag bit in 6809 LZSA2 depacker --- asm/6809/unlzsa2b.s | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/asm/6809/unlzsa2b.s b/asm/6809/unlzsa2b.s index caabd48..21d534b 100644 --- a/asm/6809/unlzsa2b.s +++ b/asm/6809/unlzsa2b.s @@ -68,10 +68,9 @@ lz2nolt ldb ,s ; get token again, don't pop it from the stack lslb ; push token's Y flag bit into carry bcs lz2offs9 ; if token's Y bit is set, 9 bits offset - lslb ; push token's Z flag bit into carry - tfr cc,a ; preserve cpu flags (to preserve carry) + sex ; push token's Z flag bit into reg A bsr lz2nibl ; get offset nibble in B - tfr a,cc ; restore cpu flags + lsla ; retrieve token's Z flag bit and push into carry rolb ; shift Z flag from carry into bit 0 of B eorb #$e1 ; set bits 5-7 of offset, reverse bit 0 @@ -105,10 +104,9 @@ lz2done rts lz2replg lslb ; push token's Y flag bit into carry bcs lz2rep16 ; if token's Y bit is set, rep or 16 bit offset - lslb ; push token's Z flag bit into carry - tfr cc,a ; preserve cpu flags (to preserve carry) + sex ; push token's Z flag bit into reg A bsr lz2nibl ; get offset nibble in B - tfr a,cc ; restore cpu flags + lsla ; retrieve token's Z flag bit and push into carry rolb ; shift Z flag from carry into bit 0 of B eorb #$e1 ; set bits 13-15 of offset, reverse bit 8