VNCviewGS/rawdec.macros

126 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

macro
loopBody320 &iters
lcla &n
.top320
ldx |2*&n,Y
lda >BCT320,X
ldx destOfst
sta >destBuf+&n,X
&n seta &n+1
aif &n<&iters,.top320
mend
macro
loopBody640 &iters
lcla &n
.top640
ldx |4*&n,Y
lda >BCT640A,X
ldx |4*&n+2,Y
ora >BCT640B,X
ldx destOfst
sta >destBuf+&n,X
&n seta &n+1
aif &n<&iters,.top640
mend
macro
rawDec &mode,&unroll
lclc &loopBdy
lcla &bytePix
&loopBdy setc 'loopBody'+&mode
&bytePix seta &mode/160
tdc
tax
lda |dpPtr
tcd set new direct page
stx oldDP save direct page on entry
phb
phb
pla
sta oldDB save data bank on entry
lda 10,S
pha leaves extra byte: clean up later
plb initialize data bank=bank of lineDataPtr
lda 8+1,S initialize y = lineDataPtr (low 16 bits)
tay
pla move return address to proper position
sta 8-1,S
pla
sta 10-3,S
plx
stx destOfst initialize x = destOfst = startOffset
pla
sta endOfst initialize endOfst = endOffset
sec
sbc #&unroll-1
bcs doLoop1 if endOffset-7 did not underflow...
jmp test2
doLoop1 sta loop1End initialize loop1End = endOffset - 7
txa a = startOffset
jmp test1
loop1 anop
sep #$20
longa off
&loopBdy &unroll
rep #$20
longa on
tya
adc #&unroll*&bytePix carry must be clear
tay
bcs incDB1
cont1 txa
adc #&unroll carry must be clear
sta destOfst
test1 cmp loop1End
bge check2
jmp loop1
check2 cmp endOfst
bge end
loop2 anop
&loopBdy 1
inx
stx destOfst
tya
adc #&bytePix carry must be clear
tay
bcs incDB2
test2 cpx endOfst
blt loop2
end phb
plx x = old DB (high byte of lineDataPtr)
pei (oldDB)
plb restore data bank
plb
lda oldDP
tcd restore direct page
tya a = lineDataPtr (low 16 bits)
rtl
incDB1 pea cont1-1
bra incDB
incDB2 pea test2-1
incDB phb
pla
inc A
pha
plb
clc
rts
mend