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: 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
2012-09-11 21:00
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.
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: 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


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
Didi/Laxity
Darkflight
Guests online: 96
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

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