Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Upscroller problem with sprites in vertical borders
2012-09-11 20:19
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?
2012-09-11 20:55
Stone

Registered: Oct 2006
Posts: 168
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
2012-09-11 21:00
Krill

Registered: Apr 2002
Posts: 2851
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.
2012-09-11 21:38
hukka
Account closed

Registered: Nov 2003
Posts: 9
Many thanks for the answers! Good to know it's just a bug in my code.
2012-09-12 12:13
MagerValp

Registered: Dec 2001
Posts: 1058
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


2012-09-12 12:22
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).

RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Dymo/G★P
Guests online: 94
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 MWS  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.035 sec.