Difference between revisions of "G3A File Format"

From WikiPrizm
Jump to navigationJump to search
(Converted broken Omnimaga post links using ourl.ca)
(Fix references)
Line 1: Line 1:
This page was copied from [http://prizmwiki.omnimaga.org/wiki/.g3a_files the .g3a files page on PrizmWiki] before PrizmWiki was closed. Because this wiki doesn't use the Cite extension, the reference formatting on this page currently doesn't work.
+
.g3a files contain add-ins for the Casio Prizm. Files of this format contain a 0x7000-byte header (28 KiB),<sup class="reference plainlinks nourlexpansion">[[#f_1|[1]]]</sup> and a code/data section that can be up to 1 MB large in OS 1.01 and 1.02.<sup class="reference plainlinks nourlexpansion">[[#f_2|[2]]]</sup> The maximum size of the code/data section in newer OSes is unknown, but it seems to be larger. Checksums are used to check if add-ins are valid. Running an add-in is the only method of running native code on the Prizm right now. If a part of the header isn't documented here, it's most likely supposed to be filled with 00.
 
 
.g3a files contain add-ins for the Casio Prizm. Files of this format contain a 0x7000-byte header (28 KiB),<ref>http://ourl.ca/8401/157437</ref> and a code/data section that can be up to 1 MB large in OS 1.01 and 1.02.<ref>http://ourl.ca/8207/217712</ref> The maximum size of the code/data section in newer OSes is unknown, but it seems to be larger. Checksums are used to check if add-ins are valid. Running an add-in is the only method of running native code on the Prizm right now. If a part of the header isn't documented here, it's most likely supposed to be filled with 00.
 
  
 
==File format==
 
==File format==
Line 10: Line 8:
  
 
====0x0000====
 
====0x0000====
AA AC BD AF 90 88 9A 8D D3 FF FE FF FE FF. These bytes are found in almost every [[:Category:File formats|Prizm file]], with the exception of the ninth byte (D3), which is the file type byte.<ref name="miniSDK">Mini-SDK v1.06 by Simon Lothar</ref><ref>http://ourl.ca/8207/158454</ref> If the header is inverted (xor with FF), the first eight bytes read "USBPower".
+
AA AC BD AF 90 88 9A 8D D3 FF FE FF FE FF. These bytes are found in almost every [[:Category:File formats|Prizm file]], with the exception of the ninth byte (D3), which is the file type byte.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_4|[4]]]</sup> If the header is inverted (xor with FF), the first eight bytes read "USBPower".
  
 
====0x000E====
 
====0x000E====
The low byte of the inverse file size (at memory location 0x0013) minus 0x41.<ref name="miniSDK"/><ref name="fxsdk g1awrapper">http://fxsdk.svn.sourceforge.net/viewvc/fxsdk/g1awrapper/trunk/g1awrapper.cpp?revision=24&view=markup</ref> The actual Prizm OS doesn't care about this byte, but other programs (for example the Manager PLUS) and possibly future versions of the OS do care, so it's important to set this byte correctly even though the add-in can be run if it's incorrect.
+
The low byte of the inverse file size (at memory location 0x0013) minus 0x41.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_5|[5]]]</sup> The actual Prizm OS doesn't care about this byte, but other programs (for example the Manager PLUS) and possibly future versions of the OS do care, so it's important to set this byte correctly even though the add-in can be run if it's incorrect.
  
 
====0x000F====
 
====0x000F====
This byte is always 0xFE.<ref name="miniSDK"/><ref name="fxsdk g1awrapper"/>
+
This byte is always 0xFE.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_5|[5]]]</sup>
  
 
====0x0010====
 
====0x0010====
'''Inverse filesize''' (four bytes). For example, if a file size is 00 0B 8A A8 you would xor it with FF FF FF FF, thus setting all 1's to 0's and 0's to 1's, and get FF F4 75 57.<ref name="miniSDK"/><ref name="fxsdk g1awrapper"/><ref>http://ourl.ca/8207/158808</ref><ref>http://ourl.ca/8207/158819</ref>
+
'''Inverse filesize''' (four bytes). For example, if a file size is 00 0B 8A A8 you would xor it with FF FF FF FF, thus setting all 1's to 0's and 0's to 1's, and get FF F4 75 57.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_5|[5]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_6|[6]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_7|[7]]]</sup>
  
 
====0x0014====
 
====0x0014====
The low byte of the inverse file size (at memory location 0x0013) minus 0xB8.<ref name="miniSDK"/><ref name="fxsdk g1awrapper"/> The actual Prizm OS doesn't care about this byte, but other programs (for example the Manager PLUS) do care, so it's important to set this byte correctly even though the add-in can be run if it's incorrect.
+
The low byte of the inverse file size (at memory location 0x0013) minus 0xB8.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_5|[5]]]</sup> The actual Prizm OS doesn't care about this byte, but other programs (for example the Manager PLUS) do care, so it's important to set this byte correctly even though the add-in can be run if it's incorrect.
  
 
====0x0016====
 
====0x0016====
The word sum of 8 words (16 bytes) starting at 0x7100, inverted.<ref>http://www.cemetech.net/forum/viewtopic.php?p=215630#215630</ref>
+
The word sum of 8 words (16 bytes) starting at 0x7100, inverted.<sup class="reference plainlinks nourlexpansion">[[#f_8|[8]]]</sup>
  
 
====0x0020====
 
====0x0020====
A simple '''checksum''' (4 bytes long) is stored here. The checksum is calculated based on the entire file, except for this checksum and the copy of this checksum at the end of the file.<ref name="miniSDK"/><ref name="Prizm add in header format edit.txt">[http://www.omnimaga.org/index.php?action=dlattach;topic=5610.0;attach=5350 Prizm add in header format edit.txt] by z80man</ref>
+
A simple '''checksum''' (4 bytes long) is stored here. The checksum is calculated based on the entire file, except for this checksum and the copy of this checksum at the end of the file.<sup class="reference plainlinks nourlexpansion">[[#f_5|[5]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_9|[9]]]</sup>
  
 
====0x0024====
 
====0x0024====
These two bytes are always 01 01.<ref name="miniSDK"/>
+
These two bytes are always 01 01.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup>
  
 
====0x002E====
 
====0x002E====
'''Size of executable code section''' (32-bit), minus the header size. This means that if this is equal to 000001F8, the [[#0x????|copy of the 0x0020 checksum]] is at 0x000071F8.<ref name="miniSDK"/><ref name="Prizm add in header format edit.txt"/>
+
'''Size of executable code section''' (32-bit), minus the header size. This means that if this is equal to 000001F8, the [[#0x????|copy of the 0x0020 checksum]] is at 0x000071F8.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_9|[9]]]</sup>
  
 
====0x0040====
 
====0x0040====
Line 40: Line 38:
  
 
====0x005C====
 
====0x005C====
'''Size of entire file''' (32-bit).<ref name="miniSDK"/><ref name="Prizm add in header format edit.txt"/>
+
'''Size of entire file''' (32-bit).<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_9|[9]]]</sup>
  
 
====0x0060====
 
====0x0060====
Line 76: Line 74:
  
 
====0x012B====
 
====0x012B====
Set to 0x01 for add-ins with eActivity strips, otherwise set to 0x00.<ref>http://www.cemetech.net/forum/viewtopic.php?p=198680#198680</ref>
+
Set to 0x01 for add-ins with eActivity strips, otherwise set to 0x00.<sup class="reference plainlinks nourlexpansion">[[#f_10|[10]]]</sup>
  
 
====0x0130====
 
====0x0130====
Line 88: Line 86:
 
----
 
----
  
This area of the add-in header describes what the add-in will look like when viewed from an eActivity. If the add-in doesn't support eActivites, these parts of the header should all be set to 00.<ref name=eactivity>http://ourl.ca/8207/207039</ref>
+
This area of the add-in header describes what the add-in will look like when viewed from an eActivity. If the add-in doesn't support eActivites, these parts of the header should all be set to 00.
  
 
====0x0170====
 
====0x0170====
Line 115: Line 113:
  
 
====0x0290====
 
====0x0290====
'''eActivity strip icon'''. The icon is 64x24 pixels large, with each pixel represented by one nibble. This means that the icon is 0x0300 bytes long (ends at '''0x058F'''). Values from 0 to 7 can be used to produce the 8 supported colors. If a value between 8 and F is used, the pixel is displayed as black. (0 should be used if black is desired, though.)<ref name=eactivity/><ref>http://ourl.ca/8207/175936</ref><ref>http://ourl.ca/8207/175953</ref>
+
'''eActivity strip icon'''. The icon is 64x24 pixels large, with each pixel represented by one nibble. This means that the icon is 0x0300 bytes long (ends at '''0x058F'''). Values from 0 to 7 can be used to produce the 8 supported colors. If a value between 8 and F is used, the pixel is displayed as black. (0 should be used if black is desired, though.)<sup class="reference plainlinks nourlexpansion">[[#f_11|[11]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_12|[12]]]</sup><sup class="reference plainlinks nourlexpansion">[[#f_13|[13]]]</sup>
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 156: Line 154:
  
 
====0x1000====
 
====0x1000====
'''Icon''' that is displayed when the add-in is '''unselected'''.<ref name="miniSDK"/> The icon is 92x64 pixels large, and each pixel has 16 bits of color information (5 red bits, 6 green bits, and 5 blue bits). This means that the icon is 0x2E00 bytes long (ends at '''0x3DFF''').
+
'''Icon''' that is displayed when the add-in is '''unselected'''.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup> The icon is 92x64 pixels large, and each pixel has 16 bits of color information (5 red bits, 6 green bits, and 5 blue bits). This means that the icon is 0x2E00 bytes long (ends at '''0x3DFF''').
  
 
====0x4000====
 
====0x4000====
'''Icon''' that is displayed when the add-in is '''selected'''.<ref name="miniSDK"/> The icon is 92x64 pixels large, and each pixel has 16 bits of color information (5 red bits, 6 green bits, and 5 blue bits). This means that the icon is 0x2E00 bytes long (ends at '''0x6DFF''').
+
'''Icon''' that is displayed when the add-in is '''selected'''.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup> The icon is 92x64 pixels large, and each pixel has 16 bits of color information (5 red bits, 6 green bits, and 5 blue bits). This means that the icon is 0x2E00 bytes long (ends at '''0x6DFF''').
  
 
====0x7000====
 
====0x7000====
'''Executable code section'''. This section will be mapped to virtual memory at 0x00300000 and executed when the user launches the add-in.<ref name="miniSDK"/>
+
'''Executable code section'''. This section will be mapped to virtual memory at 0x00300000 and executed when the user launches the add-in.<sup class="reference plainlinks nourlexpansion">[[#f_3|[3]]]</sup>
  
 
====0x????====
 
====0x????====
'''Copy of the [[#0x0020|0x0020]] checksum'''. These are the last four bytes of the file. The location of these four bytes can be found by adding 0x7000 to the value at [[#0x002E|0x002E]].<ref name="Prizm add in header format edit.txt"/>
+
'''Copy of the [[#0x0020|0x0020]] checksum'''. These are the last four bytes of the file. The location of these four bytes can be found by adding 0x7000 to the value at [[#0x002E|0x002E]].<sup class="reference plainlinks nourlexpansion">[[#f_9|[9]]]</sup>
  
 
==References==
 
==References==
<references/>
+
# <span id="f_1">http://ourl.ca/8401/157437</span>
 +
# <span id="f_1">http://ourl.ca/8207/217712</span>
 +
# <span id="f_3">Mini-SDK v1.06 by Simon Lothar</span>
 +
# <span id="f_4">http://ourl.ca/8207/158454</span>
 +
# <span id="f_5">http://fxsdk.svn.sourceforge.net/viewvc/fxsdk/g1awrapper/trunk/g1awrapper.cpp?revision=24&view=markup</span>
 +
# <span id="f_6">http://ourl.ca/8207/158808</span>
 +
# <span id="f_7">http://ourl.ca/8207/158819</span>
 +
# <span id="f_8">http://www.cemetech.net/forum/viewtopic.php?p=215630#215630</span>
 +
# <span id="f_9">[http://www.omnimaga.org/index.php?action=dlattach;topic=5610.0;attach=5350 Prizm add in header format edit.txt] by z80man</span>
 +
# <span id="f_10">http://www.cemetech.net/forum/viewtopic.php?p=198680#198680</span>
 +
# <span id="f_11">http://ourl.ca/8207/207039</span>
 +
# <span id="f_12">http://ourl.ca/8207/175936</span>
 +
# <span id="f_13">http://ourl.ca/8207/175953</span>
 +
 
 +
<hr>
 +
This page was copied from [http://prizmwiki.omnimaga.org/wiki/.g3a_files the .g3a files page on PrizmWiki] before PrizmWiki was closed.

Revision as of 09:33, 11 February 2015

.g3a files contain add-ins for the Casio Prizm. Files of this format contain a 0x7000-byte header (28 KiB),[1] and a code/data section that can be up to 1 MB large in OS 1.01 and 1.02.[2] The maximum size of the code/data section in newer OSes is unknown, but it seems to be larger. Checksums are used to check if add-ins are valid. Running an add-in is the only method of running native code on the Prizm right now. If a part of the header isn't documented here, it's most likely supposed to be filled with 00.

File format

Identification/security bytes, checksums, name


0x0000

AA AC BD AF 90 88 9A 8D D3 FF FE FF FE FF. These bytes are found in almost every Prizm file, with the exception of the ninth byte (D3), which is the file type byte.[3][4] If the header is inverted (xor with FF), the first eight bytes read "USBPower".

0x000E

The low byte of the inverse file size (at memory location 0x0013) minus 0x41.[3][5] The actual Prizm OS doesn't care about this byte, but other programs (for example the Manager PLUS) and possibly future versions of the OS do care, so it's important to set this byte correctly even though the add-in can be run if it's incorrect.

0x000F

This byte is always 0xFE.[3][5]

0x0010

Inverse filesize (four bytes). For example, if a file size is 00 0B 8A A8 you would xor it with FF FF FF FF, thus setting all 1's to 0's and 0's to 1's, and get FF F4 75 57.[3][5][6][7]

0x0014

The low byte of the inverse file size (at memory location 0x0013) minus 0xB8.[3][5] The actual Prizm OS doesn't care about this byte, but other programs (for example the Manager PLUS) do care, so it's important to set this byte correctly even though the add-in can be run if it's incorrect.

0x0016

The word sum of 8 words (16 bytes) starting at 0x7100, inverted.[8]

0x0020

A simple checksum (4 bytes long) is stored here. The checksum is calculated based on the entire file, except for this checksum and the copy of this checksum at the end of the file.[5][9]

0x0024

These two bytes are always 01 01.[3]

0x002E

Size of executable code section (32-bit), minus the header size. This means that if this is equal to 000001F8, the copy of the 0x0020 checksum is at 0x000071F8.[3][9]

0x0040

Name of add-in. This is in English, but it's not always the same as the name at 0x006B (Picture Plot is named PictPlot at 0x0040). Probably a shorter version of the name.

0x005C

Size of entire file (32-bit).[3][9]

0x0060

Internal name. Only the uppercase letters A-Z and the @ character seem to be used. @ is always written before the name. There's probably a character limit of eight characters (including the @). Examples: @CONV (Conversion), @GEOM (Geometry), @PICTPLT (Picture Plot)

Localized names, version information


0x006B

Name of add-in (English).

0x0083

Name of add-in (Spanish).

0x009B

Name of add-in (German).

0x00B3

Name of add-in (French).

0x00CB

Name of add-in (Portuguese).

0x00E3

Name of add-in (Chinese).

The font used for Chinese displays Latin letters differently than the other languages. When making an add-in, it's a good idea to check that the name shows up correctly when using Chinese. Long names may take up more space than the icon does, making the names of add-ins overlap.

0x00FB

Name of add-in, probably reserved for future languages. Set to the same value as English by default.

0x0113

Name of add-in, probably reserved for future languages. Set to the same value as English by default.

0x012B

Set to 0x01 for add-ins with eActivity strips, otherwise set to 0x00.[10]

0x0130

Version number string. Format: XX.XX.XXXX

0x013C

Date/time created string. Format: YYYY.MMDD.HHMM

eActivity


This area of the add-in header describes what the add-in will look like when viewed from an eActivity. If the add-in doesn't support eActivites, these parts of the header should all be set to 00.

0x0170

eActivity name of add-in (English).

0x0194

eActivity name of add-in (Spanish).

0x01B8

eActivity name of add-in (German).

0x01DC

eActivity name of add-in (French).

0x0200

eActivity name of add-in (Portuguese).

0x0224

eActivity name of add-in (Chinese).

0x0248

eActivity name of add-in, probably reserved for future languages. Set to the same value as English by default.

0x026C

eActivity name of add-in, probably reserved for future languages. Set to the same value as English by default.

0x0290

eActivity strip icon. The icon is 64x24 pixels large, with each pixel represented by one nibble. This means that the icon is 0x0300 bytes long (ends at 0x058F). Values from 0 to 7 can be used to produce the 8 supported colors. If a value between 8 and F is used, the pixel is displayed as black. (0 should be used if black is desired, though.)[11][12][13]

Colors
Value Color
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Yellow
7 White

File name, icons, executable code, checksum


0x0EBC

File name (including the .g3a extension).

0x1000

Icon that is displayed when the add-in is unselected.[3] The icon is 92x64 pixels large, and each pixel has 16 bits of color information (5 red bits, 6 green bits, and 5 blue bits). This means that the icon is 0x2E00 bytes long (ends at 0x3DFF).

0x4000

Icon that is displayed when the add-in is selected.[3] The icon is 92x64 pixels large, and each pixel has 16 bits of color information (5 red bits, 6 green bits, and 5 blue bits). This means that the icon is 0x2E00 bytes long (ends at 0x6DFF).

0x7000

Executable code section. This section will be mapped to virtual memory at 0x00300000 and executed when the user launches the add-in.[3]

0x????

Copy of the 0x0020 checksum. These are the last four bytes of the file. The location of these four bytes can be found by adding 0x7000 to the value at 0x002E.[9]

References

  1. http://ourl.ca/8401/157437
  2. http://ourl.ca/8207/217712
  3. Mini-SDK v1.06 by Simon Lothar
  4. http://ourl.ca/8207/158454
  5. http://fxsdk.svn.sourceforge.net/viewvc/fxsdk/g1awrapper/trunk/g1awrapper.cpp?revision=24&view=markup
  6. http://ourl.ca/8207/158808
  7. http://ourl.ca/8207/158819
  8. http://www.cemetech.net/forum/viewtopic.php?p=215630#215630
  9. Prizm add in header format edit.txt by z80man
  10. http://www.cemetech.net/forum/viewtopic.php?p=198680#198680
  11. http://ourl.ca/8207/207039
  12. http://ourl.ca/8207/175936
  13. http://ourl.ca/8207/175953

This page was copied from the .g3a files page on PrizmWiki before PrizmWiki was closed.