| |
hukka Account closed
Registered: Nov 2003 Posts: 9 |
Upscroller problem with sprites in vertical borders
Hello,
I'm a bit of a beginner and I was unable to figure this out for myself.
I have successfully made an upscroller using multiplexed sprites. I thought it would be neat to open the vertical borders in order to extend the scrolltext over the whole screen. However, I've run into a problem where placing a sprite in the opened bottom border will 'wrap' onto the top border. Not a problem as such, but if I try to change the sprite's data pointer inside the bottom border (to show a different line of scrolltext at the upper border) after it's started drawing, the change will not be visible in the upper border. Should that even work? Changing the sprite's color still works fine, as seen in the image.
Image: https://dl.dropbox.com/u/2018003/c64/spriteborder.png
That should explain the problem somewhat. It's sprite 0 at the bottom border, wrapping into the top border. I need different graphics data in the upper sprite, which is not happening here.
I'm guessing it's because technically the sprite's still not stopped drawing, so changes to the data pointer will not get visible. So, my question is, how can I solve this? I'm after a similar scroller as in +H2K, for example. How is it achieved there? |
|
| |
Stone
Registered: Oct 2006 Posts: 172 |
Sprite data is fetched once per sprite per scanline, so changes to the sprite pointer will take effect on the next scanline. So if you want a sprite to be displayed twice, with different graphics, you wait until the first instance has finished drawing.
This document is a good reference: http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt
|
| |
Krill
Registered: Apr 2002 Posts: 2980 |
You can change the sprite pattern for the same sprite displaying twice in the borders perfectly well by switching pointers during vertical blank.
If that doesn't work, you likely have a bug in your code. |
| |
hukka Account closed
Registered: Nov 2003 Posts: 9 |
Many thanks for the answers! Good to know it's just a bug in my code. |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
No magic, just timing:
init:
lda #$7f
sta $dc0d
ldx #127
: lda sprdata0,x
sta $3f80,x
dex
bpl :-
lda #$00
sta $3fff
;lda #0
sta $d010
lda #100
sta $d000
lda #9
sta $d001
lda #1
sta $d015
sta $d01d
loop:
lda #250
: cmp $d012
bne :-
lda #$13
sta $d011
ldx #30
: dex
bne :-
lda #$1b
sta $d011
lda #9
sta $d001
lda #$ff
sta $07f8
lda #9+21
: cmp $d012
bne :-
lda #16
sta $d001
lda #$fe
sta $07f8
jmp loop
sprdata0:
.res 64, $55
sprdata1:
.res 64, $f0
|
| |
hukka Account closed
Registered: Nov 2003 Posts: 9 |
MagerValp: thanks for the code sample! I managed to get my code to work an hour or so ago. I simply wasn't updating the sprite pointers at the right time (during the vblank).
|