1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-13 08:25:28 +00:00

Used more mundane addressing in some of the instructions in "zlib/inflatemem.s".

That avoids conflicts with ca65's future .setdp feature.
This commit is contained in:
Greg King
2016-07-19 10:42:49 -04:00
parent fb53bfc25d
commit e7e65044e6

View File

@@ -1,5 +1,6 @@
; ;
; Piotr Fusik, 21.09.2003 ; 2003-09-21, Piotr Fusik
; 2016-07-19, Greg King
; ;
; unsigned __fastcall__ inflatemem (char* dest, const char* source); ; unsigned __fastcall__ inflatemem (char* dest, const char* source);
; ;
@@ -40,30 +41,30 @@ TREES_SIZE = 2*MAX_BITS
; ;
; Pointer to the compressed data. ; Pointer to the compressed data.
inputPointer = ptr1 ; 2 bytes inputPointer := ptr1 ; 2 bytes
; Pointer to the uncompressed data. ; Pointer to the uncompressed data.
outputPointer = ptr2 ; 2 bytes outputPointer := ptr2 ; 2 bytes
; Local variables. ; Local variables.
; As far as there is no conflict, same memory locations are used ; As far as there is no conflict, same memory locations are used
; for different variables. ; for different variables.
inflateDynamicBlock_cnt = ptr3 ; 1 byte inflateDynamicBlock_cnt := ptr3 ; 1 byte
inflateCodes_src = ptr3 ; 2 bytes inflateCodes_src := ptr3 ; 2 bytes
buildHuffmanTree_src = ptr3 ; 2 bytes buildHuffmanTree_src := ptr3 ; 2 bytes
getNextLength_last = ptr3 ; 1 byte getNextLength_last := ptr3 ; 1 byte
getNextLength_index = ptr3+1 ; 1 byte getNextLength_index := ptr3+1 ; 1 byte
buildHuffmanTree_ptr = ptr4 ; 2 bytes buildHuffmanTree_ptr := ptr4 ; 2 bytes
fetchCode_ptr = ptr4 ; 2 bytes fetchCode_ptr := ptr4 ; 2 bytes
getBits_tmp = ptr4 ; 1 byte getBits_tmp := ptr4 ; 1 byte
moveBlock_len = sreg ; 2 bytes moveBlock_len := sreg ; 2 bytes
inflateDynamicBlock_np = sreg ; 1 byte inflateDynamicBlock_np := sreg ; 1 byte
inflateDynamicBlock_nd = sreg+1 ; 1 byte inflateDynamicBlock_nd := sreg+1 ; 1 byte
getBit_hold = tmp1 ; 1 byte getBit_hold := tmp1 ; 1 byte
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
@@ -138,8 +139,8 @@ inflateCopyBlock:
ldy #1 ldy #1
sty getBit_hold sty getBit_hold
; Get 16-bit length ; Get 16-bit length
ldx #inputPointer ldx #0
lda (0,x) lda (inputPointer,x)
sta moveBlock_len sta moveBlock_len
lda (inputPointer),y lda (inputPointer),y
sta moveBlock_len+1 sta moveBlock_len+1
@@ -164,15 +165,15 @@ moveBlock:
.endif .endif
inc moveBlock_len+1 inc moveBlock_len+1
moveBlock_1: moveBlock_1:
lda (0,x) lda (inputPointer,x)
.if (.cpu & CPU_ISET_65SC02) .if (.cpu & CPU_ISET_65SC02)
sta (outputPointer) sta (outputPointer)
.else .else
sta (outputPointer),y sta (outputPointer),y
.endif .endif
inc 0,x inc inputPointer
bne moveBlock_2 bne moveBlock_2
inc 1,x inc inputPointer+1
moveBlock_2: moveBlock_2:
inc outputPointer inc outputPointer
bne moveBlock_3 bne moveBlock_3