My post on the formatting of Casio-BASIC files. Cross-posted from
Omnimaga:
The .g3m file format a very simple format, with three sections of security bytes that were slightly annoying to figure out. Here are the rules governing each of the sections. Numbers of the form 0xNNh refer to addresses offset from the starting address of the file while $NN refers to hex numbers.
0x14h - 0x13h = $48
0x1C - 0x1Dh = $1D
0x14h - 0x1Dh = $C3
0x13h - 0x1Ch = $5E
0x0Eh + 0x48h = $72
$38 - 0x48h = 0x1Dh
0x48h = (Length of the rest of the data) - $3.
There are always 13 00 bytes following 0x48h.
Algorithm for computing the security sequences:
$38 - 0x48h -> 0x1Dh
$72 - 0x48h -> 0x0Eh
0x1Dh + $C3 -> 0x14h
0x14h - $48 -> 0x13h
0x13h - $5E -> 0x1Ch
0x00h through 0x0Dh:
AA AC BD AF 90 88 9A 8D 8A FF EF FF EF FF
0x0Fh through 0x12h:
FF FF FF
0x15h through 0x1Bh:
01 00 00 00 00 00 00
0x1Eh through 0x3Bh:
FF FE 50 52 4F 47 52 41 4D 00 00 00 00 00 00 00 00 00 00 00 00 01 73 79 73 74 65 6D 00 00
0x3Ch through 0x43h:
8 byte ASCII code for file name.
0x44h through 0x47h:
01 00 00 00
0x49h through 0x55h:
00 00 00 00 00 00 00 00 00 00 00 00 00