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 > Sprite position with open side border
2017-05-07 14:24
tob1as
Account closed

Registered: May 2017
Posts: 2
Sprite position with open side border

Hello,

Experimenting with open sideborder and sprites and have two questions.

1. I am Not able to view sprite 0 in sideborder. It this possible at all or do you have to use sprite 1-7 in side border?

2. When setting sprite1 x position to zero, there still is a 8 pixel gap in left sideborder before sprite. Is this just how it is or it is possible to push sprite all the way to the left?
(in right border sprite can be all the way to right - ie. no pixel gap).
2017-05-07 14:28
Oswald

Registered: Apr 2002
Posts: 5017
2, set 9th bit of sprite X hi in d010, then iirc next position to the left of pos 0 is $f8.
2017-05-07 16:18
chatGPZ

Registered: Dec 2001
Posts: 11112
sprite 0 shouldnt be a problem either :)
2017-05-07 17:45
JackAsser

Registered: Jun 2002
Posts: 1989
There are 63x8 = 504 x-positions on a raster line.
Sprite registers are 9-bit = 512 x-positions.

Hence there has to be a 8-pixel gap somewhere, happens to be just at the left edge of the screen.
2017-05-07 17:49
Compyx

Registered: Jan 2005
Posts: 631
Like Oswald said:

lda #$f8
sta $d000
lda #0
sta $d002
clc
adc #$18
sta $d004
adc #$18
sta $d006
adc #$18
sta $d008
adc #$18
sta $d00a
adc #$18
sta $d00c
adc #$18
sta $d00e
lda #%00000001
sta $d010


That should give all 8 sprites properly aligned. Keep in mind that sprite 0 is a bit of a bitch, you'll need a read-modify-write on $d016 to get an open border for 8 sprites, so: DEC $d016/INC $d016, ST[AXY] won't work.

People other than me can explain why more clearly than I can.
2017-05-07 18:19
tob1as
Account closed

Registered: May 2017
Posts: 2
Thanx, X-position was easy :-) I had the right theori, but just didnt hit correct value. Rookie mistake :-)

Sprite 0 is supposed to take 5 cycles, but damage my open side border timing. Just cant get it to work. Works fine with the other sprites.

But have a problem with enough cycles on bad line.

So bad line is 23 cycles. First sprite displayed takes 5 cycles and then the rest should take 2 cycles each if I am correct? I dont do DEC/INC d016, but rather sta/sty d016. Saves 4 cycles. So there should be time to at least 4 sprites (I need 4 in the border). Or do I miss something?
2017-05-07 18:31
chatGPZ

Registered: Dec 2001
Posts: 11112
have a look at the vic article (or perhaps try Victimer) - its not only about how many cycles are free - its also about _which_ cycles are free :)
2017-05-07 19:00
Compyx

Registered: Jan 2005
Posts: 631
Like groepaz said, it's not only the number of cycles that are free but also where the horizontal beam is, I suggest taking a look at the VIC article, and indeed using Victimer (set your terminal window very wide when using that).

For using sprites including badlines, it's best to use the 'upper' sprites ie sprites 4-7. On a badline you can then use
sta $d016,y
stx $d016


Using A = 0-7, X = 8-15 and Y = 0. OR the X and A values with 16 if using multicolor.
2017-05-08 08:13
Trash

Registered: Jan 2002
Posts: 122
Quote: There are 63x8 = 504 x-positions on a raster line.
Sprite registers are 9-bit = 512 x-positions.

Hence there has to be a 8-pixel gap somewhere, happens to be just at the left edge of the screen.


How do you bridge that gap when for example making a multiplexed sideborder scroll (like in Revolutions)
2017-05-08 09:13
JackAsser

Registered: Jun 2002
Posts: 1989
If x<0 then x-=8
X&=0x1ff
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
cba
Apollyon/ALD
Krill/Plush
Andy/AEG
Mr SQL
Acidchild/Padua
Knut Clausen/SHAPE/F..
nucleus/TempesT
Guests online: 116
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 Bromance  (9.6)
10 Memento Mori  (9.6)
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 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Antitrack  (9.8)
4 Mr Zero Page  (9.8)
5 OTD  (9.8)

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