Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Looking for Warpspeed source code
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marko Mäkelä  
View profile  
 More options Dec 17 2003, 4:16 am
Newsgroups: comp.sys.cbm, alt.c64
From: Marko Mäkelä <Marko.Mak...@HUT.FI>
Date: 17 Dec 2003 11:16:31 +0200
Local: Wed, Dec 17 2003 4:16 am
Subject: Re: Looking for Warpspeed source code

>>>>> "RajW" == RajW  <r...@intelc64.net> writes:

RajW> Yuck! My brain is to tired right now to "fix/normalize" the raw
RajW> cartridge dump.

It's not that hard.  Feel free to adapt the following C program I
wrote for shuffling the address and data lines of a 512kB Flash
cartridge for the VIC-20.  The program reads the shuffled image from
stdin and outputs the unshuffled one on stdout.  It probably doesn't
work on Microsoft operating systems, because they make an artificial
distinction between binary and text files, and interpret the CR and LF
characters on stdin and stdout as "text" by default.

BTW, in the 4 MB version of the cartridge, I only swapped A0 and A1,
because the chip has much nicer pinout (all address and data lines
nicely sorted in numerical order).

        Marko

#include <stdio.h>

/** Move a bit to another position
 * @param i     the number being shuffled
 * @param from  original bit position
 * @param to    translated bit position
 * @return      the bit in the translated position
 */
#define MVBIT(i,from,to) (((i) & 1 << (from)) ? 1 << (to) : 0)

/** precomputed table for shuffling the data bus */
static unsigned char databus[256];

static unsigned char image[1 << 19];

int
main (int argc, char** argv)
{
  unsigned i;
  for (i = 256; i--; )
    databus[i] =
      MVBIT (i, 0, 5) |
      MVBIT (i, 1, 6) |
      MVBIT (i, 2, 7) |
      MVBIT (i, 3, 4) |
      MVBIT (i, 4, 3) |
      MVBIT (i, 5, 2) |
      MVBIT (i, 6, 0) |
      MVBIT (i, 7, 1);

  for (i = 0; i < sizeof image; i++) {
    int c = getchar ();
    if (c == EOF)
      break;
    else
      image[MVBIT (i, 0, 17) |
            MVBIT (i, 1, 18) |
            MVBIT (i, 2, 16) |
            MVBIT (i, 3, 15) |
            MVBIT (i, 4, 12) |
            MVBIT (i, 5, 7) |
            MVBIT (i, 6, 6) |
            MVBIT (i, 7, 5) |
            MVBIT (i, 8, 4) |
            MVBIT (i, 9, 3) |
            MVBIT (i, 10, 2) |
            MVBIT (i, 11, 1) |
            MVBIT (i, 12, 0) |
            MVBIT (i, 13, 13) |
            MVBIT (i, 14, 14) |
            MVBIT (i, 15, 11) |
            MVBIT (i, 16, 8) |
            MVBIT (i, 17, 9) |
            MVBIT (i, 18, 10)] =
        databus[(unsigned char) c];
  }

  return fwrite (image, 1, sizeof image, stdout);

}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.