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 return cycleCount, optimizationCount
def rowStartCalculatorCode(self, row, baselabel): def rowStartCalculatorCode(self, row, baselabel):
if self.double_buffer:
first = self.height - 1
else:
first = 0
self.out() self.out()
self.comment_line("row %d" % row) self.comment_line("row %d" % row)
if self.double_buffer: if self.double_buffer:
if row == self.height - 1: if row == first:
label = "%s_pageloop" % (baselabel) label = "%s_PAGELOOP" % (baselabel)
self.asm("ldx PARAM1") self.asm("ldx PARAM1")
self.asm("ldy #%d" % self.height) self.asm("ldy #%d" % self.height)
self.label(label) self.label(label)
@ -425,11 +429,10 @@ class Sprite(Listing):
self.asm("inx") self.asm("inx")
self.asm("dey") self.asm("dey")
self.asm("bne %s" % label) self.asm("bne %s" % label)
self.asm("dex") self.asm("ldx PARAM1")
self.asm("pla") self.asm("pla")
cycles = 3 cycles = 3
else: else:
self.asm("dex")
self.asm("pla") self.asm("pla")
cycles = 4 cycles = 4
else: else:
@ -443,7 +446,7 @@ class Sprite(Listing):
self.asm("sta SCRATCH1") self.asm("sta SCRATCH1")
self.asm("lda HGRROWS_L+%d,x" % row) self.asm("lda HGRROWS_L+%d,x" % row)
self.asm("sta SCRATCH0") self.asm("sta SCRATCH0")
if row == 0: if row == first:
self.asm("ldy PARAM0") self.asm("ldy PARAM0")
self.asm("lda DIV%d_%d,y" % (self.screen.numShifts, self.screen.bitsPerPixel)) 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 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_L = $1b
SPRITEPTR_H = $1c SPRITEPTR_H = $1c
RENDERCOUNT = $ce RENDERCOUNT = $ce
FRAMECOUNT = $cf ; used to determine page currently displayed: even -> page1, odd -> page2 DRAWPAGE = $d7 ; pos = page1, neg = page2
VISIBLEPAGE = $d7
BGSTORE = $fa BGSTORE = $fa
TEMPADDR = $fc TEMPADDR = $fc
@ -63,7 +62,7 @@ fasttoggle
initonce initonce
lda #0 lda #0
sta FRAMECOUNT sta DRAWPAGE
rts rts
@ -72,11 +71,10 @@ initsprites
rts rts
pageflip pageflip
inc FRAMECOUNT lda DRAWPAGE
lda FRAMECOUNT eor #$80
and #1 sta DRAWPAGE
sta VISIBLEPAGE bpl pageflip1
beq pageflip1
bit TXTPAGE2 bit TXTPAGE2
rts rts
pageflip1 pageflip1