From: Marko Mäkelä (msmakela_at_gmail.com)
Date: 2008-11-22 14:23:16
On Fri, Nov 21, 2008 at 10:59:51PM -0600, Jim Brain wrote: > On the reverse engineering, the designer did a bit of obfuscation in > order to make board layout easier. The ROM is a 16kB one, with data > lines and address lines crossed. It is easy to perform this mapping in software. Just load the entire ROM in an array and adjust the bits at the output stage. See the attached program that I wrote almost 6 years ago, to map a bigger ROM. 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,to,from) (((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); } Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.