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: 5094
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: 11386
sprite 0 shouldnt be a problem either :)
2017-05-07 17:45
JackAsser

Registered: Jun 2002
Posts: 2014
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: 11386
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: 2014
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
A3/AFL
wacek/arise
oziphantom
Impetigo/Crescent
Airwolf/F4CG
wil
Guests online: 107
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 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (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 Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.1)

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