mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 19:29:37 +00:00
Merge pull request #322 from greg-king5/inflatemem
Make inflatemem()'s source file use its enhanced instructions for 65SC02 CPUs, too.
This commit is contained in:
commit
06bb95d197
@ -9,6 +9,8 @@
|
|||||||
.import incsp2
|
.import incsp2
|
||||||
.importzp sp, sreg, ptr1, ptr2, ptr3, ptr4, tmp1
|
.importzp sp, sreg, ptr1, ptr2, ptr3, ptr4, tmp1
|
||||||
|
|
||||||
|
.macpack cpu
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Constants
|
; Constants
|
||||||
@ -75,7 +77,7 @@ _inflatemem:
|
|||||||
sta inputPointer
|
sta inputPointer
|
||||||
stx inputPointer+1
|
stx inputPointer+1
|
||||||
; outputPointer = dest
|
; outputPointer = dest
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
lda (sp)
|
lda (sp)
|
||||||
ldy #1
|
ldy #1
|
||||||
.else
|
.else
|
||||||
@ -106,7 +108,7 @@ inflatemem_1:
|
|||||||
|
|
||||||
; return outputPointer - dest;
|
; return outputPointer - dest;
|
||||||
lda outputPointer
|
lda outputPointer
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
sbc (sp) ; C flag is set
|
sbc (sp) ; C flag is set
|
||||||
ldy #1
|
ldy #1
|
||||||
.else
|
.else
|
||||||
@ -156,14 +158,14 @@ inflateCopyBlock:
|
|||||||
moveBlock:
|
moveBlock:
|
||||||
ldy moveBlock_len
|
ldy moveBlock_len
|
||||||
beq moveBlock_1
|
beq moveBlock_1
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
.else
|
.else
|
||||||
ldy #0
|
ldy #0
|
||||||
.endif
|
.endif
|
||||||
inc moveBlock_len+1
|
inc moveBlock_len+1
|
||||||
moveBlock_1:
|
moveBlock_1:
|
||||||
lda (0,x)
|
lda (0,x)
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
sta (outputPointer)
|
sta (outputPointer)
|
||||||
.else
|
.else
|
||||||
sta (outputPointer),y
|
sta (outputPointer),y
|
||||||
@ -176,7 +178,7 @@ moveBlock_2:
|
|||||||
bne moveBlock_3
|
bne moveBlock_3
|
||||||
inc outputPointer+1
|
inc outputPointer+1
|
||||||
moveBlock_3:
|
moveBlock_3:
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
dey
|
dey
|
||||||
.else
|
.else
|
||||||
dec moveBlock_len
|
dec moveBlock_len
|
||||||
@ -312,7 +314,7 @@ inflateCodes_1:
|
|||||||
jsr fetchPrimaryCode
|
jsr fetchPrimaryCode
|
||||||
bcs inflateCodes_2
|
bcs inflateCodes_2
|
||||||
; Literal code
|
; Literal code
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
sta (outputPointer)
|
sta (outputPointer)
|
||||||
.else
|
.else
|
||||||
ldy #0
|
ldy #0
|
||||||
@ -512,7 +514,7 @@ getValue:
|
|||||||
getBits:
|
getBits:
|
||||||
cpx #0
|
cpx #0
|
||||||
beq getBits_ret
|
beq getBits_ret
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
stz getBits_tmp
|
stz getBits_tmp
|
||||||
dec getBits_tmp
|
dec getBits_tmp
|
||||||
.else
|
.else
|
||||||
@ -542,7 +544,7 @@ getBit:
|
|||||||
lsr getBit_hold
|
lsr getBit_hold
|
||||||
bne getBit_ret
|
bne getBit_ret
|
||||||
pha
|
pha
|
||||||
.ifpc02
|
.if (.cpu & CPU_ISET_65SC02)
|
||||||
lda (inputPointer)
|
lda (inputPointer)
|
||||||
.else
|
.else
|
||||||
sty getBit_hold
|
sty getBit_hold
|
||||||
@ -554,7 +556,7 @@ getBit:
|
|||||||
bne getBit_1
|
bne getBit_1
|
||||||
inc inputPointer+1
|
inc inputPointer+1
|
||||||
getBit_1:
|
getBit_1:
|
||||||
ror a ; C flag is set
|
ror a ; (C flag was set)
|
||||||
sta getBit_hold
|
sta getBit_hold
|
||||||
pla
|
pla
|
||||||
getBit_ret:
|
getBit_ret:
|
||||||
@ -668,6 +670,3 @@ bitsPointer_h:
|
|||||||
; Sorted codes.
|
; Sorted codes.
|
||||||
sortedCodes:
|
sortedCodes:
|
||||||
.res 256+1+29+30+2
|
.res 256+1+29+30+2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user