Slow double buffer

This commit is contained in:
alpine9000
2016-03-26 19:38:32 +11:00
parent 23672eef5c
commit 68f00d9fa1
2 changed files with 46 additions and 57 deletions
+6 -24
View File
@@ -1,31 +1,13 @@
include "includes.i"
xdef DisplayBitplane
xdef SwitchBuffers
LoadImage:
;; d0 - size
;; a1 - start address
;; a2 - InstallColorPalette(X) address
lea bitplanes3,a0
bsr LoadDiskData ; load data from disk
;; move.l nextbitplane,a1 ; decompress into offscreen bitplanesp(1/2)
;; a0 = Input buffer to be decompressed. Must be 16-bit aligned!
;; a1 = Output buffer. Points to the end of the data at exit
jsr Depack
jsr WaitVerticalBlank ; avoid tearing when we show the new image
jsr (a2) ; install new color palette
jsr DisplayBitplane ; display new image
rts
DisplayBitplane:
;; a0 - bitplane address
SwitchBuffers:
;; offscreen - bitplane address
movem.l d0/a0-a1,-(sp)
move.l offscreen,a0
move.l onscreen,offscreen
move.l a0,onscreen
moveq.l #0,d0
move.l a0,a1
lea copperListBplPtr,a0
+40 -33
View File
@@ -2,9 +2,8 @@
xdef PokeBitplanePointers
xdef copperList
xdef bitplanes1
xdef bitplanes2
xdef bitplanes3
xdef onscreen
xdef offscreen
xdef copperListBplPtr
byteMap:
@@ -25,52 +24,58 @@ Entry:
move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
lea bitplanes1,a0
move.l #4,d0 ;color
move.l offscreen,a0
move.l #4,d0 ; color#
jsr CpuFillColor
jsr DisplayBitplane ; select it
if 0
lea bitplanes2,a0
move.l #3,d0 ;color
jsr CpuFillColor
endif
move.l onscreen,a0
move.l #4,d0 ; color#
jsr CpuFillColor
jsr SwitchBuffers
jsr Init ; enable the playfield
.mainLoop:
jsr WaitVerticalBlank
jsr WaitVerticalBlank
jsr WaitVerticalBlank
jsr WaitVerticalBlank
jsr WaitVerticalBlank
move.l offscreen,a0
move.l #4,d0 ; color#
jsr CpuFillColor
;; blitobject64
;; d0 - xpos
;; d1 - ypos
;; a0 - display
;; a1 - object
;; a2 - mask
;; add.l #1,xpos
move.b #0,d3
move.l #0,xpos
move.l direction,d0
add.l d0,xpos
move.l xpos,d0
move.l #50,d1
lea bitplanes1,a0
move.l offscreen,a0
lea text,a1
jsr DrawText
jsr WaitVerticalBlank
jsr SwitchBuffers
cmp.l #320-(26*8),xpos
ble .notright
move.l direction,d0
muls.w #-1,d0
move.l d0,direction
bra .mainLoop
.notright:
cmp.l #0,xpos
bne .mainLoop
move.l direction,d0
muls.w #-1,d0
move.l d0,direction
bra .mainLoop
text:
dc.b "My first text on an Amiga!"
dc.b 0
align 4
xpos:
dc.l 0
direction:
dc.l 1
Level3InterruptHandler:
movem.l d0-a6,-(sp)
lea CUSTOM,a6
@@ -116,13 +121,15 @@ copperListBplPtr:
InstallPalette:
include "out/font-palette.s"
rts
onscreen:
dc.l bitplanes1
offscreen:
dc.l bitplanes2
section .bss
bitplanes1:
ds.b IMAGESIZE+(512)
bitplanes2:
ds.b IMAGESIZE+(512*2)
bitplanes3:
ds.b IMAGESIZE+(512*3)
startUserstack:
ds.b $1000 ; size of stack
userstack: