jamiefuller Account closed
Registered: Mar 2018 Posts: 25 |
(Vertical) Scroller
Help!
I've been banging me head against the wall for sometime on this, i've read through so many forum posts but am really struggling so turning to you kind souls for advice.
I am trying to write a very simple scroller, that scrolls the screen downwards (think seuck)
The scroller will be 4 directional, (only ever one direction at a time) but needs to...
1) Scroll the full screen (1 char) every frame
2) not use double buffering (screen switching)
This scroller has to be full screen but doesn't have to worry about colour.
I have 3 of the directions working simply by using some speedcode and racing the raster, it still uses a lot of CPU but works fine for left, right and scrolling data upwards.
On the downward one I cannot race the raster as I need to copy from the bottom up.
So instead of dragging the screen data around I've been thinking about alternatives...
My best idea so far is to use an offscreen memory buffer (80*50) and simply copy from top to bottom, 40*25 chars onto the screen, this works but I am only just ahead of the raster, leaving no cpu for anything else, including adding the new chars.
my code looks like this
scroll_test2
lda #$c0
sta $d1
lda #$00
sta $d0
lda #$04
sta $d3
lda #$00
sta $d2
ldx #$19
@loop
ldy #$00
lda ($d0),y
sta ($d2),y
iny
... the above three lines are repeated 39 time
lda ($d0),y
sta ($d2),y
clc
lda $d0
adc #$50
sta $d0
bcc @lp1
inc $d1
clc
@lp1
lda $d2
adc #$28
sta $d2
bcc @lp2
inc $d3
@lp2
dex
beq @loop2
jmp @loop
@loop2
rts
I'm happy to waste 6k of ram and complete unroll this loop if need be,
Please help me speed this up or give me some advice on how I can do it better?
Thanks |