; ; (c) Copyright 2021 by Tobias Bindhammer. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; * Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; * The name of its author may not be used to endorse or promote products ; derived from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; !cpu 6510 BITS_LEFT = 0 .depacker = $01 .smc_offsetd = .depacker - (.dali_code_end - .dali_code_start) DALI_SMALL_SRC = lz_src - .smc_offsetd + 2 DALI_SMALL_DST = lz_dst - .smc_offsetd + 2 DALI_SMALL_SFX_ADDR = lz_sfx_addr - .smc_offsetd + 2 DALI_SMALL_DATA_END = lz_data_end - .smc_offsetd + 2 DALI_SMALL_DATA_SIZE_HI = lz_data_size_hi - .smc_offsetd + 2 !macro get_lz_bit { !if BITS_LEFT = 1 { asl (.data_end - .data) + 1 ;check for last page to copy dcp <.dst + 2 bne - ;ldy #$00 ;is already 0 ;------------------ ;LITERAL ;------------------ .lz_start_over lda #$01 ;we fall through this check on entry and start with literal +get_lz_bit bcs .lz_new_offset ;after each match check for another match or literal? .literal jsr .get_length tax beq .lz_l_page_ .cp_literal lz_src = * + 1 lda .data,y ;looks expensive, but is cheaper than loop sta (lz_dst),y inc