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 > how do i get the right combinations
2008-10-01 23:12
Testa
Account closed

Registered: Oct 2004
Posts: 197
how do i get the right combinations

hi,

i have 4 different bit paterns..
00
11
01
10

we can pack them in one byte.. #%00110110
how to code a neat routine that calculates al the different combinations and store them into a table...

bye
Testa


 
... 2 posts hidden. Click here to view all posts....
 
2008-10-02 04:56
JackAsser

Registered: Jun 2002
Posts: 2014
:D

ldx #$00
:
txa
sta table,x
inx
bne :-


2008-10-02 10:58
Mace

Registered: May 2002
Posts: 1799
Testa,

JackAsser presents you the shortest possible answer with the broadest possible scope.
But I think you'll find it useless :-)

It's pretty damn obvious there are 256 combinations in total, but do you also need all those combinations?
And why would you want to store all combinations?
On top of that, in what order would you want them?

As often the case, there's probably a question behind the question.

You shouldn't ask how to make a solution work, you should tell us your problem.
2008-10-02 13:27
Testa
Account closed

Registered: Oct 2004
Posts: 197
well i need this for a 4x4 routine, you know graphics spinning,rotating around in circels..
but no fli or normal graphics, the whole 4x4 effect is in sprites.. so it can be displayed over graphics or in the sideborder...

each combination represents a sprite pointer, the sprite itself is filled with a multycolour pitpatern to represent
the 4x4 dots.. so you have 4 colors.. mc1 mc2 mc3 and background... one spritepointer points to 4 4x4 dots next to each other.

and ofcourse i switch spritepointers each 4th rasterline

no i can divide the screen in colums and i have 4x4 xy position in sprites...

ofcourse after the spinning/rotation calculation you have to calculate al the right combinations but this can be precalculated.. and becoz each byte of this precalculated table represents 4 4x4 dots it is compact and fast..

one thing i didn't get right last night was that i forgot
about the double combinations..
to make things more clear:

lets say:
00 = 1
01 = 2
00 = 3
11 = 4

the first combinations..
1234
1432
1243
1342
1324
1423

now same tabel but swap 1 and 2

2134
2431
2143
2341
2314
2413

now same tabel but swap 2 and 3
and the last is the same but now swap 3 and 4

this way you get al the right combinations but no combinations like 2214 or 1344, no double ones...

i am working on it...


2008-10-02 14:18
Oswald

Registered: Apr 2002
Posts: 5094
all the possible combinations are all the possible combinations of 8 1's and 0's. all numbers from 0-255 in binary form. you dont need a table, simply make the sprite's shape equal to the sprite's pointer. tho this doesnt make much sense, 256 sprites will not leave room for even the sprite pointers alone. you could instead transform your precalculated 4 pixels stored in bytes into a bitmap or character based 4x4 screen.
2008-10-02 15:13
Testa
Account closed

Registered: Oct 2004
Posts: 197
i think 255 different sprites is not a problem at all,

256 sprites takes one complete bank, the only problem now is that i need some memory for the sprites parameters
($07F8-$07FF) i think i go for 254 sprites ...
for example. i dont use sprite pointer $ef ($7bc0) and $ff ($7fc0) so i can use $7bf8-$7bff and $7ff8-$7fff as sprite parameters... and switch $d018 right before the 4th rasterline...

this way i can not use any other graphics like a bitmap picture or something else.. so i think i go for a screen without badlines and use sprites only.. and swing
the 4x4 effect in all directions and all borders..

thanks for the help,
Testa





than
2008-10-02 23:58
Testa
Account closed

Registered: Oct 2004
Posts: 197
well after some coding and thinking it over, precalculating takes very much memory..

i think this is only usable if you need a small and fast 4x4 sprite routine.. he he...

2008-10-03 03:42
Oswald

Registered: Apr 2002
Posts: 5094
in general: sprite 4x4 is no advantage over other (4col) 4x4, except that you can put it on the border, or use the sprites as a 2nd layer over other gfx.
2008-10-03 09:13
Mace

Registered: May 2002
Posts: 1799
Quote:
or use the sprites as a 2nd layer over other gfx
But with 255 sprites in one bank, there's no room for other graphics...
You need to transfer data or reduce the amount of sprites, I'd say.
2008-10-03 09:31
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: i think 255 different sprites is not a problem at all,

256 sprites takes one complete bank, the only problem now is that i need some memory for the sprites parameters
($07F8-$07FF) i think i go for 254 sprites ...
for example. i dont use sprite pointer $ef ($7bc0) and $ff ($7fc0) so i can use $7bf8-$7bff and $7ff8-$7fff as sprite parameters... and switch $d018 right before the 4th rasterline...

this way i can not use any other graphics like a bitmap picture or something else.. so i think i go for a screen without badlines and use sprites only.. and swing
the 4x4 effect in all directions and all borders..

thanks for the help,
Testa





than


Hmms, it's an alternative of course. I don't know if it's any help but you might wanna check out my S:T Lars Meeting III - Invite. Source included. It's also a 4x4 effect done using sprites and runs in all borders. I had a completly different implementation though. I simply stretched the sprites every 2nd line to get 4x4 resolution and in between I mixed in the 4x4-math code with the raster code.
2008-10-03 10:06
Testa
Account closed

Registered: Oct 2004
Posts: 197
yeah... nice atuff jack.. this is what i,ve got in mind,
i think 4x4 in the border is a nice effect...
thanks for the info...
Previous - 1 | 2 - 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
X-Raffi/X-Rated
Sokrates
Alakran_64
iAN CooG/HVSC
The Human Co../Maste..
t0m3000/hf^boom!^ibx
fieserWolF/Abyss-Con..
kbs/Pht/Lxt
MWR/Visdom
Andy/AEG
Guests online: 101
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 Censor Design  (9.3)
5 Triad  (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.044 sec.