Fixed clear, now does proper sky and ground.

This commit is contained in:
Martin Haye 2013-08-29 18:25:24 -07:00
parent 357f49cb6e
commit 133c493c1c

View File

@ -23,11 +23,13 @@ DOUBLE_BUFFER = 0 ; whether to double-buffer
DEBUG = 1 ; turn on verbose logging DEBUG = 1 ; turn on verbose logging
; Constants ; Constants
TOP_LINE = $2180 ; 24 lines down from top TOP_LINE = $2180 ; 24 lines down from top
NLINES = 128 NLINES = 128
SKY_COLOR = $11 ; blue SKY_COLOR_E = 1 ; blue
GROUND_COLOR = $2 ; orange / black SKY_COLOR_O = 1 ; blue
TEX_SIZE = $555 ; 32x32 + 16x16 + 8x8 + 4x4 + 2x2 + 1x1 GROUND_COLOR_E = 4 ; orange
GROUND_COLOR_O = 0 ; black
TEX_SIZE = $555 ; 32x32 + 16x16 + 8x8 + 4x4 + 2x2 + 1x1
; My zero page ; My zero page
lineCt = $3 ; len 1 lineCt = $3 ; len 1
@ -70,10 +72,9 @@ decodeTo23 = $900
decodeTo45 = $A00 decodeTo45 = $A00
decodeTo56 = $B00 decodeTo56 = $B00
decodeTo57 = $C00 decodeTo57 = $C00
blitIndexLo = $D00 ; size $80 clrBlitRollE = $D00 ; size 3*(128/2) = $C0, plus 2 for tya and rts
blitIndexHi = $D80 ; size $80 clrBlitRollO = $DC2 ; size 3*(128/2) = $C0, plus 2 for tya and rts
clrBlitRoll = $E00 ; size 3*(128/2) = $C0, plus 2 for tya & rts XF00 = $E00 ; unused
XF00 = $F00 ; unused
prodosBuf = $AC00 ; temporary, before building the tables prodosBuf = $AC00 ; temporary, before building the tables
screen = $2000 screen = $2000
@ -865,8 +866,6 @@ makeBlit:
sta (pDst),y sta (pDst),y
dey dey
bpl @copy bpl @copy
; Record the address for the line
jsr @storeIndex
; Set the line pointers ; Set the line pointers
ldy #14 ldy #14
jsr @storeLine jsr @storeLine
@ -878,20 +877,12 @@ makeBlit:
lda lineCt lda lineCt
cmp #NLINES cmp #NLINES
bne @lineLup bne @lineLup
jsr @storeIndex ; Last addr to index
jmp storeRTS ; Finish with RTS for cleanliness jmp storeRTS ; Finish with RTS for cleanliness
@storeLine: ; Subroutine to store pLine to pDst @storeLine: ; Subroutine to store pLine to pDst
lda lineCt lda lineCt
asl asl
sta (pDst),y sta (pDst),y
rts rts
@storeIndex: ; Subroutine to store tbl ptr to index
ldy lineCt
lda pDst
sta blitIndexLo,y
lda pDst+1
sta blitIndexHi,y
rts
@advance: ; Subroutine to go to next unroll @advance: ; Subroutine to go to next unroll
lda #29 lda #29
jsr advPDst jsr advPDst
@ -917,31 +908,50 @@ storeRTS:
; Create code to clear the blit ; Create code to clear the blit
makeClrBlit: makeClrBlit:
lda #<blitRoll
sta pDst
lda #>blitRoll
sta pDst+1
ldx #0 ldx #0
ldy #0 ldy #0
@lup: @lup:
lda @st lda @st
sta clrBlitRoll,x sta clrBlitRollE,x
sta clrBlitRollO,x
inx inx
lda blitIndexLo,y lda pDst
sta clrBlitRoll,x sta clrBlitRollE,x
clc
adc #29
sta clrBlitRollO,x
inx inx
lda blitIndexHi,y lda pDst+1
@st: @st:
sta clrBlitRoll,x sta clrBlitRollE,x
adc #0
sta clrBlitRollO,x
inx inx
lda pDst
clc
adc #29*2
sta pDst
lda pDst+1
adc #0
sta pDst+1
iny iny
iny iny
cpy #64 cpy #64
bne @noSwitch bne @noSwitch
lda @tya ; switch from sky color to ground color lda @tya ; switch from sky color to ground color
sta clrBlitRoll,x sta clrBlitRollE,x
sta clrBlitRollO,x
inx inx
@noSwitch: @noSwitch:
cpy #NLINES cpy #NLINES
bne @lup bne @lup
lda @rts lda @rts
sta clrBlitRoll,x sta clrBlitRollE,x
sta clrBlitRollO,x
@rts: @rts:
rts rts
@tya: @tya:
@ -949,29 +959,26 @@ makeClrBlit:
; Clear the blit ; Clear the blit
clearBlit: clearBlit:
ldy #GROUND_COLOR
clearBlit2:
ldx blitOffsets+0 ldx blitOffsets+0
lda #SKY_COLOR jsr @clear2
jsr clrBlitRoll
ldx blitOffsets+1 ldx blitOffsets+1
lda #SKY_COLOR jsr @clear2
jsr clrBlitRoll
ldx blitOffsets+2 ldx blitOffsets+2
lda #SKY_COLOR jsr @clear2
jsr clrBlitRoll
ldx blitOffsets+3 ldx blitOffsets+3
lda #SKY_COLOR jsr @clear2
jsr clrBlitRoll
ldx blitOffsets+4 ldx blitOffsets+4
lda #SKY_COLOR jsr @clear2
jsr clrBlitRoll
ldx blitOffsets+5 ldx blitOffsets+5
lda #SKY_COLOR jsr @clear2
jsr clrBlitRoll
ldx blitOffsets+6 ldx blitOffsets+6
lda #SKY_COLOR @clear2:
jmp clrBlitRoll ldy #GROUND_COLOR_E
lda #SKY_COLOR_E
jsr clrBlitRollE
ldy #GROUND_COLOR_O
lda #SKY_COLOR_O
jmp clrBlitRollO
; Construct the pixel decoding tables ; Construct the pixel decoding tables
makeDecodeTbls: makeDecodeTbls:
@ -1350,8 +1357,8 @@ test:
stx frontBuf stx frontBuf
lda page1,x lda page1,x
.endif .endif
@pauseLup:
DEBUG_STR "Done rendering, waiting for key." DEBUG_STR "Done rendering, waiting for key."
@pauseLup:
lda kbd lda kbd
bpl @pauseLup bpl @pauseLup
@done: @done: