Fixed push/pull framework. Works on page1

This commit is contained in:
Rob McMullen 2017-07-03 07:54:40 -07:00
parent 89db8f6406
commit 22d12dc34f
3 changed files with 14 additions and 13 deletions

View File

@ -412,11 +412,15 @@ class Sprite(Listing):
return cycleCount, optimizationCount
def rowStartCalculatorCode(self, row, baselabel):
if self.double_buffer:
first = self.height - 1
else:
first = 0
self.out()
self.comment_line("row %d" % row)
if self.double_buffer:
if row == self.height - 1:
label = "%s_pageloop" % (baselabel)
if row == first:
label = "%s_PAGELOOP" % (baselabel)
self.asm("ldx PARAM1")
self.asm("ldy #%d" % self.height)
self.label(label)
@ -425,11 +429,10 @@ class Sprite(Listing):
self.asm("inx")
self.asm("dey")
self.asm("bne %s" % label)
self.asm("dex")
self.asm("ldx PARAM1")
self.asm("pla")
cycles = 3
else:
self.asm("dex")
self.asm("pla")
cycles = 4
else:
@ -443,7 +446,7 @@ class Sprite(Listing):
self.asm("sta SCRATCH1")
self.asm("lda HGRROWS_L+%d,x" % row)
self.asm("sta SCRATCH0")
if row == 0:
if row == first:
self.asm("ldy PARAM0")
self.asm("lda DIV%d_%d,y" % (self.screen.numShifts, self.screen.bitsPerPixel))
self.asm("sta PARAM2") # save the mod lookup; it doesn't change

Binary file not shown.

View File

@ -22,8 +22,7 @@ SCRATCH1 = $1a
SPRITEPTR_L = $1b
SPRITEPTR_H = $1c
RENDERCOUNT = $ce
FRAMECOUNT = $cf ; used to determine page currently displayed: even -> page1, odd -> page2
VISIBLEPAGE = $d7
DRAWPAGE = $d7 ; pos = page1, neg = page2
BGSTORE = $fa
TEMPADDR = $fc
@ -63,7 +62,7 @@ fasttoggle
initonce
lda #0
sta FRAMECOUNT
sta DRAWPAGE
rts
@ -72,11 +71,10 @@ initsprites
rts
pageflip
inc FRAMECOUNT
lda FRAMECOUNT
and #1
sta VISIBLEPAGE
beq pageflip1
lda DRAWPAGE
eor #$80
sta DRAWPAGE
bpl pageflip1
bit TXTPAGE2
rts
pageflip1