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 > Sine sprites in the sideborder. VSP garbage and more
2018-01-22 11:35
Golara
Account closed

Registered: Jan 2018
Posts: 212
Sine sprites in the sideborder. VSP garbage and more

Hello everyone. I'm working on my first C64 demo / intro. I managed to open the sideborder at the top and obviously I immediately put some X-sinus sprites there (I'm still trying to figure out how a DYSP works, right know i have opened lines with 0 and 8 sprites). I noticed that the positioning of the sprites on the X axis is a bit weird. Position 0 is slighty on the left border, but if you want to go all the way to the left you have to use X 500 or there about. My question is, is there some sinus maker or converter that would take care of this ? (so it goes from 0 to ~500 looking like smooth movement to the left). Another question, what is the good way of handling the 9th bit of X position ? What I do is generate a 256 words sinus with values 0 to 500 and use c++ program to split that into 2 256 bytes tables like

sin_1:
1,2,3,4,5,6,7,55,33,....
sin_2:
1,0,0,0,0,1,0,0,1.... where 1 means to set the bit and 0 to not do that.
My sprite 0 is bugging out in the right most border while other sprites display just fine. Why is that ? I've read somewhere that sprite 0 is evil, but could not find any details on why.

I also do VSP by turning on the screen at the right moment together with XSCROLL for smooth scrolling. I see few pixel lines of garbage just above the image, I cover that with the illegal screen mode, disable it at line 56. Is that a good idea ? Another thing about VSP is that it seems to move the whole screen down by one char on the scrolled side (makes sence I guess, as the part of the chars that are outside of the image are displayed on the next text line). So should I copy the 25 lines of graphics in each column when scrolling for seamless scroll or do people not do that ?

Here's a picture of what it looks right know. A big mess !
(PETSCII picture by Archmage as a placeholder. I can't find any pics in binary and that was the easiest to take out of a compiled prg) Hope you have the patience to help a lamer out.
https://i.imgur.com/byWFRsH.jpg[/url]

HughJass from Poland
 
... 55 posts hidden. Click here to view all posts....
 
2018-01-23 12:38
Mixer

Registered: Apr 2008
Posts: 452
Answer to all of your current and future VIC questions :) VIC Article [english]
2018-01-23 15:41
TWW

Registered: Jul 2009
Posts: 545
I used this to generate the horizontal sine-values:


    .var sinus = 0

SinusXLo:
    .for (var i = 0 ; i < 256 ; i++) {
        .eval sinus = RadiusX - 7 + RadiusX*sin(toRadians(i*360/256))
        .if (sinus < 0) .eval sinus = sinus - 9
        .byte sinus
    }

SinusXHi:
    .for (var i = 0 ; i < 256 ; i++) {
        .eval sinus = RadiusX - 7 + RadiusX*sin(toRadians(i*360/256))
        .if (sinus < 0) .eval sinus = 256
        .byte >sinus
    }


2018-01-23 16:04
JackAsser

Registered: Jun 2002
Posts: 2014
This is all there is to it. When you really understand this chart it will explain almost everything: https://www.linusakesson.net/programming/vic-timing/victiming.p..
2018-01-23 20:13
Oswald

Registered: Apr 2002
Posts: 5094
sprite stretching is very easy, just turn on/off y stretch bit on each line. horizontal timing is doesnt matter except the 1 cycle where it results in another trick called sprite crunch.
2018-01-24 10:32
Golara
Account closed

Registered: Jan 2018
Posts: 212
Aha, that's really great. I must have missunderstand the article on sprite stretching, I thought it was cycle accurate and sprite crunching is the same trick but in a different cycle. I made a simple loop of various lenghts like this:

	ldx .xPosCounter
	lda sprite_stretch, x
	adc #10
	tay
	lda #$ff
l1:	
	inc $d021
	sta $d017
	eor #$ff
	sta $d017
	dec $d021
	dey
	bne l1


And it seems like I do a sprite crunch at some frames, can you confirt that it is in fact sprite crunch ? My sprites appear twice.



I also decided to do a logo instead of DYSP for now, it's made out of 6 sprites. I swing it from 0 to 255 and set the 9th bit at the correct position, or so I think... It blinks sometimes, do you see anything I do wrong ?

	lda #$00
	sta $d020
	sta $d021
	sta $d010 ; 9th X bit
	
	ldx .xPosCounter
	lda sprite_border_sin_1, x
	cmp #230
	bcc skip5
	tay
	lda #%01111100
	sta $d010
	tya
skip5:
	cmp #230-24
	bcc skip4
	tay
	lda #%00111100
	sta $d010
	tya
	jmp skip1
skip4:
	cmp #230-24-24
	bcc skip3
	tay
	lda #%00011100
	sta $d010
	tya
	jmp skip1
skip3:
	cmp #230-24-24-24
	bcc skip2
	tay
	lda #%00001100
	sta $d010
	tya
	jmp skip1
skip2:
	cmp #230-24-24-24
	bcc skip1
	tay
	lda #%00000100
	sta $d010
	tya
skip1:
	clc
	sta $d00e
	adc #24
	sta $d00c
	adc #24
	sta $d00a
	adc #24
	sta $d008
	adc #24
	sta $d006
	adc #24
	sta $d004


I'll try to make it the last question.
2018-01-24 14:20
Oswald

Registered: Apr 2002
Posts: 5094
just keep asking :)

1. for proper sprite stretch u have to make sure on/off exactly per line, thats why it doesnt always stretch

2. might be not proper d010 setting and sprite teleporting under border or writing X in a magical cycle when sprite is being displayed iirc then sprite disappears. you should handle 9th bit per sprite and ora into d010, something is probably bugged in there
2018-01-24 15:14
Golara
Account closed

Registered: Jan 2018
Posts: 212
I'm setting the X and $d01d registers at line 251 and set sprites Y at 255, so there's no way I'm writing X register while displaying the sprite. I've made this ff->d017 00->d017 loop just to see if the stretching works, I assumed it would just randomly spaz out (which it did) but I also get sprites drawn twice which is the effect of sprite crunching from what I've read. (because the internal byte counter gets incremented by 1 instead of 3 once and so the counter doesn't reach 63 and the sprite gets drawn again).

Btw, does sprite stretching steal more cycles ? That is, on each line where a sprite is drawn, even when using the stretching bug, it still takes away the cycles ? Does that mean I have to trigger the stretching bug before the sprite DMA or after ? or it doesn't matter ?
2018-01-24 16:26
Oswald

Registered: Apr 2002
Posts: 5094
ah, yes you are right. then I guess it must be buggy d010 usage.


yep, if you do stretching sprites steals same amount of cycles as if displayed normally.
2018-01-25 14:35
Golara
Account closed

Registered: Jan 2018
Posts: 212
Damn, I didn't realise you can change the X register while displaying a sprite, I thought it was locked like Y. Makes it very easy to do a sprite TECH-TECH, dude nice.

6 sprites on the line, I change the first 4 sprites's X on one line and the other two on the other while opening the borders. It was rather easy, but I can't figure out how to make it go all the way to the right border, damn, this 9th bit makes it tricky and the fact that 0 position is not the top most left position makes it even harder.
2018-01-25 16:13
Golara
Account closed

Registered: Jan 2018
Posts: 212
Stretching side border tech tech, am I pro or what ? :v


That reminds me a bit of the super stretching in the DEMODE, is it the same thing, just, you know, much better ? (d017 stretches and changing X for tech-tech)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 - Next
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
csabanw
JackAsser/Booze Design
Twoflower/ΤRIΛD
Jangler/Artline Desi..
Chrx/Design/Chaos
Guests online: 116
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 Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Sabbi  (9.5)
4 Morpheus  (9.4)
5 CreaMD  (9.1)

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