English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Blitz Basic (http://eab.abime.net/forumdisplay.php?f=126)
-   -   Sprite multiplexing & copper bars? (http://eab.abime.net/showthread.php?t=95530)

E-Penguin 20 December 2018 01:05

Sprite multiplexing & copper bars?
I like the background gradient effects the copper gives, and this is relatively easy to get with DisplayRGB, but that's incompatible with CustomSprites (one is per line, one is per display, so far so understood). I'd really like both, and I'm sure it must be possible.

I've read the post here about CustomColours but I can't see how to make that work in practice - the palette change would have to take place in between the scanlines. One sets up the "changed" palette and CustomColours effects those changes at a given vertical position - difficult to repeatedly bang the same register. If I've misunderstood please let me know!

Which leaves us with CustomStrings, which is a Copper Wait for vertical position, from what I can tell. Can I use this to trigger a Copper Interrupt at a given vpos, which I then process with an interrupt handler? (SetInt 4).

Am I overthinking it?

E-Penguin 20 December 2018 01:12

Ah, no, it can do it directly, but the question is how do I get this into the "string" format Blitz wants? I've tried #1800000 and "1800000" but no luck


dc.w $180,$0000 - Background colour to black
dc.w $180,$0f00 - Background colour to red

E-Penguin 20 December 2018 22:59

This is apparently how one uses CustomStrings

co$=Mki$($180)+Mki$($0f00) ; move f to col0
CustomString 0,0,8,co$

but only the last "CustomString" or "CustomSprite" takes effect. Ones before are overwritten, or ignored, or something. I tried playing with the COOffset parameter but I have had no luck and frankly am none the wiser.

Shatterhand 22 December 2018 01:42

I've managed to use CustomSprites in both my games Roadtrip and Santa Chaos, but it's VERY limited and it eats a lot of Copper time.

With it you can basically divide your display on 2 sections... the upper one have its own sprites ( from 0 to 7) and the lower one will get their own sprites too (from 8 to 15). If you try to draw sprites from one section on the other section you'll get lots of glitches on screen.

That's all you can do with it. You can do some interesting stuff with it with some planning, but you can't pull off a Mega Typhoon thing with a shitload of sprites all around the screen

I really would love to be able to draw sprites with the Copper on Blitz Basic, but I have no idea of how to do it. I am pretty sure it can be done without wasting so much time from the copper as CustomSprites does.

E-Penguin 22 December 2018 09:31

I see from your Santa Chaos source (thanks, by the way!) that you have managed to get both DisplayRGB and CustomSprites working together. I totally failed at that, always getting errors about not enough copper space, no matter how many "custom coppers" I allocated in InitCopper.

Why CCOffset=6? I don't really understand what that variable does.

Shatterhand 22 December 2018 13:38


Originally Posted by E-Penguin (Post 1292234)

Why CCOffset=6? I don't really understand what that variable does.

I was expecting you to ask me this, and I am glad you did it......

... because I have NO IDEA and the manual doesn't explain it either! I got it right by luck! (Well, actually after testing it for a while, I cound half understand it)

I can tell you what I did

If you look at the mess that's my code, I use a Display RGB to do the gradient on the sky.

With CCOffset = 0, the DisplayRGB there does not work, but the sprite split was done properly. As I use higher values, it's like the split is done at lower parts of the screen, as DisplayRGB works partially. With the value I inserted, I could use display RGB up until the first horizontal orange line on the image. The vertical area shows an area where if I try to draw ANY sprites there, I get glitches. So I figured out all this area is used by the copper to "reset" the sprites.


So I feel the CCOffset somehow tells the display where it should start doing the "sprite reset", and from this line up to the next few lines you won't be able to use any other copper commands.. But I am not sure about that.

On Roadtrip I usde CCOffset = 0 and on the next argument I just passed the height I wanted the sprite reset to be done, but as the space between the "upper" sprites and the "lower" sprites was rather big, I had no trouble with it. And the DisplayRGB I used there was way below on screen, so I had zero trouble using everything together.

Cobe 22 December 2018 17:07

Once I used displayscroll that has ccoffset at the end and after experimenting i figured out that its value actully has to match the value of custom copper space at the end of the initcop.

Meaning, the way I understood it, if you already use some command like displayrgb that allocates certain number of copper instructions per line, thats the number that ccoffset's gonna be.
For example in my instance I had AGA copper bars and if I had ccoffset lower than 4 copper bars appeared less colorful(ocs like).

All times are GMT +2. The time now is 10:45.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.04211 seconds with 11 queries