Register

G1M Format - MCS - Spreadsheets... all of them

Discuss issues related to Calculator Hacking/Modding.
Senior Member
User avatar
Posts: 101
Joined: Sun Mar 27, 2016 10:24 am
Location: France
Calculators: Casio Afx 1.0, Casio fx-9860GII, Casio fx-CG50

G1M Format - MCS - Spreadsheets... all of them

Postby cakeisalie5 » Thu Dec 08, 2016 6:39 pm

Hi,

so I'm able to read more and more files with my C library for parsing CASIO files. So I tried to read a complete save from my calculator, and there were some surprises.
I know how to parse normal spreadsheets using this, and it works, and I'm using the MCS file type (0xFE) to distinguish them. But while trying to parse my save, I discovered some files with unexpected 0xFE MCS type (like spreadsheets).

First of all, the @CONICS/conicsmem file is a spreadsheet with only four bytes :
Code: Select all
[libg1m info]  g1m_parse_mcs: [2] Internal name is 'CONICS'
[libg1m info]  g1m_parse_mcs: [2] 1 mcs files to browse
[libg1m info]  g1m_parse_mcs: [2,0] directory name is '@CONICS'
[libg1m info]  g1m_parse_mcs: [2,0] filename is 'conicmem'
[libg1m info]  g1m_parse_mcs: [2,0] data length is 4
[libg1m info]  g1m_parse_mcsfile_content: File type is 'spreadsheet' (0xfe)
[libg1m info]  0001 CFA0                               ....


As the first byte is 0x00, I was using this to distinguish a spreadsheet type which I first called "empty spreadsheet" (obviously). But it looks like @FINANCE/fina_mem is using the same type but is 252 bytes long... so I don't know how to distinguish them... ?

Also, there is the @E-CON2/Econ3Now file, which has a weird format and which I really don't know how to distinguish as content seems to start straight away :
Code: Select all
[libg1m info]  g1m_parse_mcs: [4] Internal name is 'Econ3Now'
[libg1m info]  g1m_parse_mcs: [4] 1 mcs files to browse
[libg1m info]  g1m_parse_mcs: [4,0] directory name is '@E-CON2'
[libg1m info]  g1m_parse_mcs: [4,0] filename is 'Econ3Now'
[libg1m info]  g1m_parse_mcs: [4,0] data length is 300
[libg1m info]  g1m_parse_mcsfile_content: File type is 'spreadsheet' (0xfe)
[libg1m info]  g1m_parse_mcs_spreadsheet: Spreadsheet type is unknown. (0x4e)
[libg1m info]  g1m_parse_mcs_spreadsheet: Raw content is:
[libg1m info]  4E6F 2054                               No T
[libg1m info]  6974 6C65 0000 0000 0000 0000 0000 0030 itle...........0
[libg1m info]  2E30 3100 0000 0000 0000 0002 0000 0014 .01.............
[libg1m info]  0000 0002 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  0000 0000 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  0000 0009 0000 0000 0101 0000 0000 0000 ................
[libg1m info]  0000 0000 3000 0000 0000 0000 0000 0000 ....0...........
[libg1m info]  3000 0000 0000 0000 0000 0000 FFFF FFFF 0...............
[libg1m info]  0000 0000 3100 0000 0000 0000 0000 0000 ....1...........
[libg1m info]  3100 0000 0000 0000 0000 0000 0000 0001 1...............
[libg1m info]  0000 0001 0000 0003 0000 00C9 0101 0101 ................
[libg1m info]  0101 0101 0000 0000 0000 0001 8802 80B0 ................
[libg1m info]  0000 0000 0000 0000 0000 7530 0000 0001 ..........u0....
[libg1m info]  0101 0101 0202 0202 0101 0101 0000 0000 ................
[libg1m info]  0000 0000 0000 2710 0000 2710 0000 2710 ......'...'...'.
[libg1m info]  0000 2710 0000 2710 0000 2710 0000 2710 ..'...'...'...'.
[libg1m info]  0000 2710 0000 0000 0000 0000 0000 0000 ..'.............
[libg1m info]  0000 0000 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  0000 0000 0000 0000 0000 0000 0100 0000 ................
[libg1m info]  0001 0000 0000 0000                     ........


So as it looks like there must be something else to distinguish them, I looked for something else with the help of Protocol 7. In fxReverse, there is the "Group name" which I don't know what it is, and it looks like there is no equivalent in the G1M Format. Is there one, and could it help me ?

Thanks in advance! :)
Part of the Planète Casio community (FR) - main author of Cahute

Senior Member
User avatar
Posts: 101
Joined: Sun Mar 27, 2016 10:24 am
Location: France
Calculators: Casio Afx 1.0, Casio fx-9860GII, Casio fx-CG50

Re: G1M Format - MCS - Spreadsheets... all of them

Postby cakeisalie5 » Sat Dec 10, 2016 8:23 pm

By the way, I have found another weird type of spreadsheet : @RUNMAT/REPLAY, along with weirdly formatted captures :
Code: Select all
[libg1m info]  g1m_parse_mcs: [53] Internal name is 'SYSTEM'
[libg1m info]  g1m_parse_mcs: [53] 4 mcs files to browse
[libg1m info]  g1m_parse_mcs: [53,0] directory name is '@REV2'
[libg1m info]  g1m_parse_mcs: [53,0] filename is 'CLIP'
[libg1m info]  g1m_parse_mcs: [53,0] data length is 8
[libg1m info]  g1m_parse_mcsfile_content: File type is 'capture' (0x0a)
[libg1m info]  4389 310E 4300 F703                     C.1.C...
[libg1m info]  g1m_parse_mcs: [53,1] directory name is '@REV2'
[libg1m info]  g1m_parse_mcs: [53,1] filename is 'NAT_CLIP'
[libg1m info]  g1m_parse_mcs: [53,1] data length is 8
[libg1m info]  g1m_parse_mcsfile_content: File type is 'capture' (0x0a)
[libg1m info]  4389 310E 4300 F703                     C.1.C...
[libg1m info]  g1m_parse_mcs: [53,2] directory name is '@RUNMAT'
[libg1m info]  g1m_parse_mcs: [53,2] filename is 'REPLAY'
[libg1m info]  g1m_parse_mcs: [53,2] data length is 16
[libg1m info]  g1m_parse_mcsfile_content: File type is 'spreadsheet' (0xfe)
[libg1m info]  mcs_parse_spreadsheet: Spreadsheet type is unknown. (0x33)
[libg1m info]  mcs_parse_spreadsheet: Raw content is:
[libg1m info]  3331 8932                               31.2
[libg1m info]  3989 3331 8933 3089 3133 0000           9.31.30.13..
[libg1m info]  g1m_parse_mcs: [53,3] directory name is '@RUNMAT'
[libg1m info]  g1m_parse_mcs: [53,3] filename is 'RUN2D1'
[libg1m info]  g1m_parse_mcs: [53,3] data length is 772
[libg1m info]  g1m_parse_mcsfile_content: File type is 'spreadsheet' (0xfe)
[libg1m info]  mcs_parse_spreadsheet: Spreadsheet type is unknown. (0x00)
[libg1m info]  mcs_parse_spreadsheet: Raw content is:
[libg1m info]  0000 0017                               ....
[libg1m info]  0300 0064 0400 0078 0300 00A4 0400 00B0 ...d...x........
[libg1m info]  0300 00DC 0400 00E8 0300 0114 0400 0128 ...............(
[libg1m info]  0300 0154 0400 0164 0300 0190 0400 01A0 ...T...d........
[libg1m info]  0300 01CC 0400 01DC 0300 0208 0400 0218 ................
[libg1m info]  0300 0244 0400 0254 0300 0280 0400 0290 ...D...T........
[libg1m info]  0300 02BC 0400 02CC 0300 02F8 0000 0000 ................
[libg1m info]  0036 0008 0000 0000 3132 3237 9931 3032 .6......1227.102
[libg1m info]  3300 00D7 1022 0400 0000 0000 0000 0000 3...."..........
[libg1m info]  0000 0008 8005 FF24 0000 006B 0012 0008 .......$...k....
[libg1m info]  0000 0100 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  0012 0008 0000 0000 390E 4100 1009 0000 ........9.A.....
[libg1m info]  0000 0000 0000 0000 0000 0008 8005 FF24 ...............$
[libg1m info]  0000 006B 0006 0008 0000 0100 0000 0000 ...k............
[libg1m info]  0000 0000 0000 0000 0012 0008 0000 0000 ................
[libg1m info]  340E 4200 1004 0000 0000 0000 0000 0000 4.B.............
[libg1m info]  0000 0008 8005 FF24 0000 006B 0006 0008 .......$...k....
[libg1m info]  0000 0100 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  004E 0008 0000 0000 4199 A628 41B9 4229 .N......A..(A.B)
[libg1m info]  A942 0084 1001 0000 0000 0000 0000 0000 .B..............
[libg1m info]  0000 0008 8005 FF24 0000 006B 0006 0008 .......$...k....
[libg1m info]  0000 0100 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  0036 0008 0000 0000 A628 35B9 3229 0001 .6.......(5.2)..
[libg1m info]  1002 0000 0000 0000 0000 0000 0000 0008 ................
[libg1m info]  8005 FFB4 0000 006B 0006 0008 0000 0100 .......k........
[libg1m info]  0000 0000 0000 0000 0000 0000 0030 0008 .............0..
[libg1m info]  0000 0000 7F3A 352C 3229 0001 1001 0000 .....:5,2)......
[libg1m info]  0000 0000 0000 0000 0000 0008 8005 FFB4 ................
[libg1m info]  0000 006B 0006 0008 0000 0100 0000 0000 ...k............
[libg1m info]  0000 0000 0000 0000 0030 0008 0000 0000 .........0......
[libg1m info]  327F BC32 0000 0148 1001 0000 0000 0000 2..2...H........
[libg1m info]  0000 0000 0000 0008 8005 FFB4 0000 006B ...............k
[libg1m info]  0006 0008 0000 0100 0000 0000 0000 0000 ................
[libg1m info]  0000 0000 0030 0008 0000 0000 357F BC32 .....0......5..2
[libg1m info]  0000 0001 1002 0000 0000 0000 0000 0000 ................
[libg1m info]  0000 0008 8005 FFB4 0000 006B 0006 0008 ...........k....
[libg1m info]  0000 0100 0000 0000 0000 0000 0000 0000 ................
[libg1m info]  0030 0008 0000 0000 357F BD32 0000 0001 .0......5..2....
[libg1m info]  1001 0000 0000 0000 0000 0000 0000 0008 ................
[libg1m info]  8005 FFB4 0000 006B 0006 0008 0000 0100 .......k........
[libg1m info]  0000 0000 0000 0000 0000 0000 0036 0008 .............6..
[libg1m info]  0000 0000 8735 7FBD 3200 0001 1001 0000 .....5..2.......
[libg1m info]  0000 0000 0000 0000 0000 0008 8005 FFB4 ................
[libg1m info]  0000 006B 0006 0008 0000 0100 0000 0000 ...k............
[libg1m info]  0000 0000 0000 0000 0036 0008 0000 0000 .........6......
[libg1m info]  8735 7FBC 3200 0001 6002 0000 0000 0000 .5..2...`.......
[libg1m info]  0000 0000 0000 0008 8005 FFB4 0000 006B ...............k
[libg1m info]  000C 0008 0000 0100 0000 0000 0000 0000 ................
[libg1m info]  0000 0000 0006 0008 0000 0000 0000 0000 ................


Any info about these could be nice, thanks :D
Part of the Planète Casio community (FR) - main author of Cahute

Senior Member
User avatar
Posts: 101
Joined: Sun Mar 27, 2016 10:24 am
Location: France
Calculators: Casio Afx 1.0, Casio fx-9860GII, Casio fx-CG50

Re: G1M Format - MCS - Spreadsheets... all of them

Postby cakeisalie5 » Fri Dec 16, 2016 6:09 pm

So I modified the way files are identified by implementing this tab:
Code: Select all
#define TTERM {0, NULL, 0, NULL, NULL, 0}
static struct group_corresp mcs_groups[] = {
   /* Main Memory */
   {"SETUP", noarg, (struct type_corresp[]){
      {0x14, NULL, 0, "$GLOBAL",
         "setup", g1m_mcstype_setup},
      {0x00, NULL, 0, "$GLOBAL",
         "alpha memory", g1m_mcstype_alphamem},
      TTERM
   }},
   {"ALPHA MEM", noarg, (struct type_corresp[]){
      {0x00, NULL, 0, "$GLOBAL",
         "alpha memory", g1m_mcstype_alphamem},
      TTERM
   }},
   {"CAPT ", arg | arg_is_num, (struct type_corresp[]){
      {0x0A, "CAPT", arg | arg_is_num, "@REV2",
         "capture", g1m_mcstype_capt},
      TTERM
   }},
   {"PICTURE ", arg | arg_is_num, (struct type_corresp[]){
      {0x07, "PICT", arg | arg_is_num, "main",
         "picture", g1m_mcstype_pict},
      TTERM
   }},
   {"STRING ", arg | arg_is_num, (struct type_corresp[]){
      {0x04, "STR", arg | arg_is_num, "main",
         "string", g1m_mcstype_string},
      TTERM
   }},
   {"LIST ", arg | arg_is_num, (struct type_corresp[]){
      {0x05, "1LIST", arg | arg_is_num, "main",
         "list", g1m_mcstype_list},
      TTERM
   }},
   {"LISTFILE ", arg | arg_is_num | weight_by_gid, (struct type_corresp[]){
      {0x05, "1LIST", arg | arg_is_num | weight_by_gid, "main",
         "list", g1m_mcstype_list},
      TTERM
   }},
   {"MAT ", arg | arg_is_let, (struct type_corresp[]){
      {0x06, "MAT_", arg | arg_is_let, "main",
         "matrix", g1m_mcstype_mat},
      TTERM
   }},
   {"VCT ", arg | arg_is_let, (struct type_corresp[]){
      {0x06, "VCT_", arg | arg_is_let, "main",
         "vector", g1m_mcstype_vct},
      TTERM
   }},
   {"PROGRAM", noarg, (struct type_corresp[]){
      {0x01, NULL, 0, "system",
         "program", g1m_mcstype_program},
      TTERM
   }},
   {"Y=DATA", noarg, (struct type_corresp[]){
      {0x02, NULL, 0, "main",
         "unknown", 0x00},
      {0x05, NULL, 0, "main",
         "unknown", 0x00},
      TTERM
   }},
   {"V-WIN ", arg | arg_is_num, (struct type_corresp[]){
      {0x05, "VMEM", arg | arg_is_num, "main",
         "unknown", 0x00},
      TTERM
   }},

   /* application-specific data */
   {"SYSTEM", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@RUNMAT",
         "replay", 0x00},
      {0x0A, NULL, 0, "@REV2",
         "clip", 0x00},
      TTERM
   }},
   {"S-SHEET", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@SSHEET",
         "spreadsheet", g1m_mcstype_spreadsheet},
      TTERM
   }},
   {"CONICS", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@CONICS",
         "conics data", 0x00},
      TTERM
   }},
   {"DYNA MEM", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@DYNA",
         "dyna data", 0x00},
      TTERM
   }},
   {"Econ3Now", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@E-CON2",
         "econ3 data", 0x00},
      TTERM
   }},
   {"FINANCIAL", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@FINANCE",
         "financial data", 0x00},
      TTERM
   }},
   {"RECURSION", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@RECUR",
         "recursion data", 0x00},
      TTERM
   }},
   {"STAT", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@STAT",
         "stat data", 0x00},
      {0x05, "STATV", arg | arg_is_num, "main",
         "stat data 2?", 0x00},
      TTERM
   }},
   {"TABLE", noarg, (struct type_corresp[]){
      {0xFE, NULL, 0, "@TABLE",
         "range data?", 0x00},
      TTERM
   }},

   /* terminating entry */
   {NULL, 0, NULL}
};

(full code is on my git forge)

Which means I now use the group and the raw type to identify file types... and it works, I manage to parse the G1M file successfully. Now, I don't know the formats (or even what the files serve for), but I should be on the right way to discover them. :D
Part of the Planète Casio community (FR) - main author of Cahute

Return to Calculator Hacking/Modding Discussions

Who is online

Users browsing this forum: No registered users and 29 guests