From 7a8613c6d6eee7c4ec8d9c9693d2d5a2911ca783 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Sat, 2 Apr 2016 08:49:47 +1100 Subject: [PATCH] Double buffered scroll --- 025.scroll_text/Makefile | 2 +- 025.scroll_text/blit.s | 14 ++++++++------ 025.scroll_text/scroll_text.s | 34 ++++++++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/025.scroll_text/Makefile b/025.scroll_text/Makefile index 3f9875a..5a1362c 100644 --- a/025.scroll_text/Makefile +++ b/025.scroll_text/Makefile @@ -6,7 +6,7 @@ USERSTACK_ADDRESS=7fffc BASE_ADDRESS=4000 # note: this must be high enough not to conflict with MFMbufE -NUM_COLORS=16 +NUM_COLORS=2 BOOTBLOCK_ASM=alpine_bootblock.s OBJS=out/init.o out/utils.o out/image.o out/blitchar.o out/cpu.o out/blit.o diff --git a/025.scroll_text/blit.s b/025.scroll_text/blit.s index 890c61c..0e56851 100644 --- a/025.scroll_text/blit.s +++ b/025.scroll_text/blit.s @@ -55,15 +55,17 @@ BlitFillColor: BlitScroll: - ;; kills a0,d1,d2 - ;; a0 - bitplane + ;; kills a0,a1,d1,d2 + ;; a0 - dest + ;; a1 - source ;; d1 - height ;; d2 - ypos - ;; movem.l d2-d5/a0,-(sp) + movem.l d1-d2/a0-a1,-(sp) add.l d1,d2 ;point to end of data for descending mode mulu.w #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH,d2 add.l d2,a0 + add.l d2,a1 WaitBlitter @@ -73,8 +75,8 @@ BlitScroll: move.w #0,BLTBMOD(a6) move.w #0,BLTCMOD(a6) move.w #0,BLTDMOD(a6) - move.l a0,BLTBPTH(a6) - move.l a0,BLTCPTH(a6) + move.l a1,BLTBPTH(a6) + move.l a1,BLTCPTH(a6) move.l a0,BLTDPTH(a6) move.w #$0000,BLTAFWM(a6) move.w #$ffff,BLTALWM(a6) @@ -84,6 +86,6 @@ BlitScroll: ori.w #BITPLANE_WIDTH_WORDS,d1 move.w d1,BLTSIZE(a6) - ;; movem.l (sp)+,d2-d5/a0 + movem.l (sp)+,d1-d2/a0-a1 rts \ No newline at end of file diff --git a/025.scroll_text/scroll_text.s b/025.scroll_text/scroll_text.s index 97b1ffd..72adb02 100644 --- a/025.scroll_text/scroll_text.s +++ b/025.scroll_text/scroll_text.s @@ -5,7 +5,7 @@ xdef offscreen xdef copperListBplPtr -Y_POS equ 100 +Y_POS equ 8 byteMap: dc.l Entry @@ -33,6 +33,12 @@ Entry: move.w #SCREEN_HEIGHT,d1 move.w #0,d2 ; ypos jsr BlitFillColor + + move.l offscreen,a0 + move.l #BACKGROUND_COLOR,d0 + move.w #SCREEN_HEIGHT,d1 + move.w #0,d2 ; ypos + jsr BlitFillColor WaitBlitter jsr Init ; enable the playfield @@ -40,7 +46,8 @@ Entry: lea text,a3 MainLoop: jsr WaitVerticalBlank - + + jsr InstallPalette cmp.l #8,shiftcounter bne .shift @@ -55,16 +62,35 @@ MainLoop: move.l #BITPLANE_WIDTH-16,d0 ; xpos move.l #Y_POS,d1 ; ypos move.l onscreen,a0 + + move.l #Y_POS,d1 ; ypos + move.l #27-1,d3 +.loopBlitChar8: jsr BlitChar8 + add.l #FONT_HEIGHT+1,d1 + dbra d3,.loopBlitChar8 + move.l #0,shiftcounter .shift: - move.l onscreen,a0 + move.l offscreen,a0 ; dest + move.l onscreen,a1 ; src move.l #FONT_HEIGHT,d1 + move.l #Y_POS,d2 + move.l #27-1,d0 +.blitScrollLoop: jsr BlitScroll + add.l #FONT_HEIGHT+1,d2 + dbra d0,.blitScrollLoop + + add.l #1,shiftcounter - ;; jsr GreyPalette + ;; jsr GreyPalette + + move.w #$500,COLOR00(a6) + + jsr SwitchBuffers bra MainLoop