Jump to content
IGNORED

double or quad up a bit pattern?


SpiceWare

Recommended Posts

I've been working on Frantic, an updated version of Berzerk/Frenzy, for the 2600. It's using the Harmony's ARM processor for the game logic and a slick display kernel that lets me multiplex the Atari's 2 players (sprites) quite effectively to draw all the objects on screen with minimal flicker.

 

I'm now in the process of planning out the Frenzy variation, which has special rooms* every so often. To show the special objects I'm planning to use a 2x or 4x player (I've already reviewed the kernel and while I don't have time to resize of Player 0, I do have time for Player 1).

 

Due to the flicker routines, I have to use software driven collision detection as 2 colliding objects might never be drawn on the same video frame. As such, I'll need to double up a 2x player's bit pattern so that the bits 76543210 become 7766554433221100. For example, if 1 line of the sprite looks like this:

_X__X_X_

 

I need to make it look like this:

__XX____XX__XX__

 

I can do this using a loop and shifting bits, but thought somebody might know a way to do it better.

int DoubleBits(unsigned char bits)
{
   int i;
   int mask;
   int result;
   
   mask = 0x80;
   result = 0;
   for(i=0;i<8;i++)
   {
       result = (result << 2) + ((bits & mask) ? 3 : 0);
       mask >>= 1;
   }
   return result;
}

 

To make that a QuadBits function I'd just change 1 line:

       result = (result << 4) + ((bits & mask) ? 15 : 0);

* This video shows 3 of them, though it's stretched widescreen for some reason:

3:15 Big Otto

5:17 Power Plant

8:01 Central Computer

 

http://www.youtube.com/watch?v=irxvhNdbeoE

 

It's missing the Robot Factory. This video shows the ColecoVision version of Frenzy:

1:18 Big Otto

2:00 Power Plant

3:18 Central Computer

4:01 Robot Factory

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...