File Formats - Petit ComputerEdit
This is a comprehensive list of the of the information contained in each file format used by Petit computer.
Total Size: 48 Bytes
|0-3||Petit Computer header: Always contains "PX01"|
|4-11||Number of bytes after header|
|20-35||MD5 hash string. See notes|
|36-47||File type: Given in each category|
The hash string is made from the following information.
- Data after header
- File type
You can use the following C++ library to generate MD5 hash strings. it is very portable and each encryption is broken into modules. The only thing you need to include to use this is the relavant header("md5.h") and "<string>". http://create.stephan-brumme.com/hash-library/
Since writing a tutorial on MD5 hash generation would require a page of its own, and because I do not have time to break the whole algorithm down I will leave a link to how the algorithm operates if you want to make it yourself.
File Type: PETC0300RPRG
Total Size(Without Heading): 12+ Bytes
|48-56||Unused(needs to be tested)|
|57-59||The number of characters in file(Including spaces, carriage returns, etc.). See notes|
|60+||Petit computer character data: See Character Table for reference|
The absolute maximum number of characters that can be in a program is 524,228(07 FF CF), which for whatever reason is less than the maximum value that 3 bytes can store.
File Type: PETC0100RCHR
Total Size(Without Heading): 8193
|48-8240||Each byte makes up two pixels units which can have a value pointing to one of the 16(0-15) palette indexes.|
Each character block is made up of 64 pixel elements which is stored into 32 bytes. The data for the character to the right(or first position next column) after this block. The following image will help to visualize how each block is stored
File Type: PETC0100RCOL
Total Size(Without Heading): 512 Bytes
|48-560||Palette data: See below for format|
Each color consists of 2 bytes(16 bits) and the color is read in the following format.
Each color has 5 bits except for green which has 6
- Petrified lasagna: Most of the above article
- Randomouscrap98: Creation of this that contains information about the header
- Discostew: Knowing about the information in the header in the first place!