Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Fast way to rotate a char?
2017-01-04 08:32
Rudi
Account closed

Registered: May 2010
Posts: 125
Fast way to rotate a char?

Im not talking about rol or ror, but swap bits so that they are rotated 90 degrees:

Example:

a char (and the bits can be random):
10110010 byte 1..
11010110 byte 2.. etc..
00111001
01010110
11011010
10110101
00110011
10110100
after "rotation" (rows and columns are swapped):
11001101
01011000
10100111
11111111
00101000
01010101
11011010
00100110
is it possible to use lookup tables for this or would that lookup table be too big?
or other lookuptable for getting and setting bits?

-Rudi
 
... 105 posts hidden. Click here to view all posts....
 
2017-01-04 14:35
Axis/Oxyron

Registered: Apr 2007
Posts: 91
When he is through, its time to go Amigaaaah!!!
2017-01-04 14:45
JackAsser

Registered: Jun 2002
Posts: 1987
Quote: When he is through, its time to go Amigaaaah!!!

Haha, I got semi tired of it after setting up that HAM8-mode. :) But it was a fun excercies and fun to figure out the bitpatterns myself, then you told me, and I was actually correct (for once).
2017-01-04 14:50
Perplex

Registered: Feb 2009
Posts: 254
Quoting Rudi
current techniques just seem too slow for many chars. wished someone could do some magic tricks :)


Magic sometimes happens when you ditch working on a generic solution and instead concentrate on one that fits your particular data set or use case.

Not implying that a generic solution is less interesting, mind.
2017-01-04 15:03
Rudi
Account closed

Registered: May 2010
Posts: 125
Some notes to self. altho, i dont know if it will do any miracles. maybe one can reduce it to Axiss solution, but I have no idea:

Basically what happens from a layman perspective (like me), bits are copied like this:
where each number are the bit-indices. consider the second number (after the arrow) to be the destination (of zero memory), and source (infront of arrow):

copy from (bit-index) -> to:
0->7
1->15
2->23
3->31
4->39
.
.(and so on..)
.
63->56
looking at those destination values in binary produce a pattern like this:
07: 00000|111|
15: 00001|111|
23: 00010|111|
31: 00011|111|
39: 00100|111|
47: 00101|111|
55: 00110|111|
63: 00111|111|
and
06: 00000|110|
14: 00001|110|
22: 00010|110|
30: 00011|110|
38: 00100|110|
46: 00101|110|
54: 00110|110|
62: 00111|110|
and so on...

notice last column (trits) are same, but decrease, and msbs are increasing. wether or not one can derive something out of this i dont know. of course these are just index-values and dont have any sensible meaning for copying from and to memory. cycles would be massive using this technique, but my thought was to get something sensible out of this (which i did not yet)...
2017-01-04 15:40
Slammer

Registered: Feb 2004
Posts: 416
I think its a shame that your cyclecounts for this problem is so low allready. I would like to see the spritecollision solution. Something like storing the 8 bytes on row 7 of succeding chars. Stretch the line and use the LFT trick to calculate the solution. But that would take 8 lines.
2017-01-04 15:58
tlr

Registered: Sep 2003
Posts: 1703
Quote: I think its a shame that your cyclecounts for this problem is so low allready. I would like to see the spritecollision solution. Something like storing the 8 bytes on row 7 of succeding chars. Stretch the line and use the LFT trick to calculate the solution. But that would take 8 lines.

Interesting idea! It would not necessarily take 8 lines. IIRC collisions can be retriggered during the line. You will be limited by the amount of pixels a sprite covers though.
2017-01-04 16:02
Rudi
Account closed

Registered: May 2010
Posts: 125
I dont see how sprites will solve the C2P-problem (with as few cycles as possible)? but then again, Im not too experienced with sprites on the C64. A goal would be to calculate as many chars (per frame) as possible for C2P.
2017-01-04 16:04
chatGPZ

Registered: Dec 2001
Posts: 11100
tlr: wasnt there some VIC that only clears (or retriggers?) the collisions once?
2017-01-04 19:07
tlr

Registered: Sep 2003
Posts: 1703
Quote: tlr: wasnt there some VIC that only clears (or retriggers?) the collisions once?

That was lightpen triggering. It's working very differently on 6569R1.
2017-01-04 19:22
Skate

Registered: Jul 2003
Posts: 490
I just made a rough calculation. Using 16k of precalc data (which is already terrible), each char takes 500-600 cycles to rotate. So, c2p routine looks like the best solution in every aspect. I'm still thinking an alternative approach though.
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 - 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
Flex/Artline Designs
The Syndrom/TIA/Pret..
Viti/Hokuto Force
Arcane/Glance
A3/AFL
Oswald/Resource
Guests online: 138
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 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (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 Original Suppliers
1 Derbyshire Ram  (9.5)
2 Black Beard  (9.4)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

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