From 8c3fc6d6521b808c4e42760d2b6522f8a248eddd Mon Sep 17 00:00:00 2001 From: emmanuel-marty Date: Wed, 10 Apr 2019 17:37:36 +0200 Subject: [PATCH] Simplify short offset handling in 6502 depacker --- asm/6502/decompress.asm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/asm/6502/decompress.asm b/asm/6502/decompress.asm index f531a3b..cdd278c 100755 --- a/asm/6502/decompress.asm +++ b/asm/6502/decompress.asm @@ -85,18 +85,17 @@ NO_LITERALS AND #$80 ; isolate match offset mode (O) BNE GET_LONG_OFFSET ; $80: 16 bit offset - JSR GETSRC ; get 8 bit offset from stream - TAX ; store as low 8 bits of offset + JSR GETSRC ; get 8 bit offset from stream in A ; Y (high 8 bits) is already set to 0 here JMP FIX_OFFSET ; go increase offset GET_LONG_OFFSET ; $00: 2-byte offset JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A TAY ; put high 8 bits in Y + TXA ; put low 8 bits in A FIX_OFFSET - TXA ; add 1 to offset - CLC + CLC ; add 1 to offset ADC #$01 BCC OFFSET_FIXED