This is a files format for storing programs and resources in a GRP. It is used mainly for an OS that can manage files.
How it works is each file is stored in 8 pixels, each pixel can have the colors 0-255, which is 1 byte or 8 bits. This file format use 8 pixels for each file or 8 bytes, it is separated into parts, each part uses a certain number of bits. The format is expressed in binary to show all the parts. The bits are organized like this:
First 3 bits:File type
000=NUL - Unknown
001=PRG - Program
010=MEM - Memory
011=GRP - Graphics
100=CHR - Character
101=SCR - Screen
110=COL - Color
111=FLD - Folder
Next 1 bit:Marked
0=FALSE - The file is not marked
1=TRUE - The file is marked
This is used for selecting files, for example, on a computer you select files by clicking on them, you can then proceed to move it, delete it, rename it, etc.
Next 6 bits:ID
000000 - Used for organizing files, 0 is reserved as the "desktop" folder, files in separate folders can share the same ID
Next 6 bits:Folder ID
000000 - The ID of the folder that the file is stored in, 0 is outside of any folder "desktop"
Last 48 bits:File Name
000000_000000_000000_000000_000000_000000_000000_000000 - Each character is stored as 6 bits, this is possible because in PTC, file names are required to consist only of alphanumerical characters and/or underscore "_".
000000=""
000001-001010="0"-"9"
001011-100101="A"-"Z"
100110-111110="a"-"z" - PTC does not actually support lowercase characters, however we can use them for aesthetic purposes, the program will have to treat them as uppercase when loading, saving, deleting, etc.
111111="_"
And that's it, it may be a little confusing if you never used binary before, but this format for storing data is very compact, if you are using a GRP for storing the data, you could have up to 6144 files:
256px/Line / 8px/File * 192Lines = 6144 Files.
I used a GRP because they provide a large amount of data compared to a MEM, and using GRPs for data has become common practice, however this file format would be the same concept if you wanted to use a MEM with one difference, instead of using GPSET and GSPOIT to write and read data, you would use ASC and CHR$, to use binary numbers in petit computer, you prefix it with &B, however it may be more efficient to convert the numbers to decimal to save space.
Skip to content