Björn Stenberg | 1499c39 | 2002-03-28 10:06:51 +0000 | [diff] [blame] | 1 | #define _PAGE_ Tools |
| 2 | #include "head.t" |
| 3 | |
| 4 | <h2>Descrambler / Scrambler</h2> |
| 5 | |
Björn Stenberg | 68ee35c | 2002-03-28 14:28:17 +0000 | [diff] [blame] | 6 | <p>The archos.mod file is scrambled, but luckily not using encryption. |
| 7 | |
| 8 | <p>Each data byte is inverted and ROLed 1 bit. |
| 9 | The data is then spread over four memory segments. The two least significant bits of the address is used as segment number and the rest as offset in the segment. So, basically: |
| 10 | |
| 11 | <ul> |
| 12 | <li>segment number = address % 4 |
| 13 | <li>segment offset = address / 4 |
| 14 | <li>segment length = imgsize / 4 |
| 15 | </ul> |
| 16 | |
| 17 | <p>A 6-byte header is added to the beginning of the scrambled image: |
| 18 | <ul> |
| 19 | <li>32 bit length (big-endian) |
| 20 | <li>16 bit checksum |
| 21 | </ul> |
| 22 | |
Björn Stenberg | 1499c39 | 2002-03-28 10:06:51 +0000 | [diff] [blame] | 23 | <p>I've written a small utility to descramble the firmware files: |
| 24 | <ul> |
Björn Stenberg | ac7d866 | 2002-03-28 14:45:42 +0000 | [diff] [blame] | 25 | <li><a href="tools/descramble.c">descramble.c</a> - 1835 bytes - The source code (pure ANSI C, should work everywhere). GPL licensed. |
| 26 | <li><a href="tools/descramble">descramble</a> - 4280 bytes - Dynamically linked i386 linux executable |
| 27 | <li><a href="tools/descramble.static.bz2">descramble.static.bz2</a> - 176015 bytes - bzip2 compressed statically linked i386 linux executable |
| 28 | <li><a href="tools/descramble.exe">descramble.exe</a> - 45056 bytes - win32 executable |
Björn Stenberg | 1499c39 | 2002-03-28 10:06:51 +0000 | [diff] [blame] | 29 | </ul> |
| 30 | |
| 31 | <p>...and one to scramble files: |
| 32 | <ul> |
Björn Stenberg | ac7d866 | 2002-03-28 14:45:42 +0000 | [diff] [blame] | 33 | <li><a href="tools/scramble.c">scramble.c</a> - 2242 bytes - The source code (pure ANSI C, should work everywhere). GPL licensed. |
| 34 | <li><a href="tools/scramble">scramble</a> - 4376 bytes - Dynamically linked i386 linux executable |
| 35 | <li><a href="tools/scramble.static.bz2">scramble.static.bz2</a> - 176117 bytes - bzip2 compressed statically linked i386 linux executable |
| 36 | <li><a href="tools/scramble.exe">scramble.exe</a> - 93385 bytes - win32 executable |
Björn Stenberg | 1499c39 | 2002-03-28 10:06:51 +0000 | [diff] [blame] | 37 | </ul> |
| 38 | |
| 39 | <h2>Disassembler</h2> |
| 40 | |
| 41 | <p>I found a nice public domain SH-1/SH-2 disassembler written by Bart Trzynadlowski, called <a href="http://saturndev.emuvibes.com/Files/sh2d020.zip">sh2d</a>: |
| 42 | <p><b>Update:</b> I've added address lookup and register name translation to the disassembler (2001-12-09) |
| 43 | <ul> |
Björn Stenberg | ac7d866 | 2002-03-28 14:45:42 +0000 | [diff] [blame] | 44 | <li><a href="tools/sh2d.c">sh2d.c</a> - 28 kB - Source code |
| 45 | <li><a href="tools/sh2d">sh2d</a> - 15 kB - Dynamically linked i386 linux executable |
| 46 | <li><a href="tools/sh2d.static.bz2">sh2d.static.bz2</a> - 170 kB - bzip2 compressed statically linked i386 linux executable |
| 47 | <li><a href="tools/sh2d.exe">sh2d.exe</a> - 40 kB - win32 executable (original version; no lookup) |
Björn Stenberg | 1499c39 | 2002-03-28 10:06:51 +0000 | [diff] [blame] | 48 | </ul> |
| 49 | |
| 50 | <h2>Compiler</h2> |
| 51 | |
| 52 | <p>GCC supports the SH processor. Just |
| 53 | <a href="cross-gcc.html">cook yourself a cross-compiler</a> |
| 54 | (sh-elf-gcc) and voila, instant SH-1 code. |
| 55 | |
| 56 | <p>There are also |
| 57 | <a href="http://www.sh-linux.org/rpm/RPMS/i386/RedHat7.1/"> |
| 58 | pre-cooked RH7.1 RPMs</a> available from sh-linux.org |
| 59 | |
Björn Stenberg | 5c983fc | 2002-03-28 13:54:38 +0000 | [diff] [blame] | 60 | <p>Felix Arends has written a page about |
| 61 | <a href="sh-win/">setting up an SH-1 compiler for Windows</a>. |
| 62 | |
Björn Stenberg | 1499c39 | 2002-03-28 10:06:51 +0000 | [diff] [blame] | 63 | #include "foot.t" |