The raw format is not a real file format, but informations about how data is stored in the calculator. Many file format save data as in the calculator, so understand this format is very useful.
Programs are encoded as a text. Alphanumerical characters and some special characters are coded in ASCII on 8 bits (characters “A” to “Z”, “a” to “z”, “0” to “9”, spaces, single quote, double quote , ”,”, ”:”, ”(”, ”)”, ”.”, ”{”, ”}”, ”[”, ”]”, ”=”, ”~”, “*”, ”/”, ”#”.
End of line are coded by a character CR (13 - 0x0D), the end of a program by a character 255 - 0xFF.
Special characters of the calculator (square root, Pi, sin, etc) are represented on 8 bits, on non used space, without 0xF7 and 0x7F (see below).
Commands (almost all word which cant be modified, inserted from the menu - by example If, Locate, List) are coded on two byte, (16 bits), the first 8 bits are 247 - 0xF7 or 127 - 0x7F, and the second 8 bits are between 0x00 and 0xFE.
Program names are composed of one to eight numbers/letters characters (and some other accepted characters ”+”,”-”, etc…). If the length of the program name is inferior to eight, remaining space is filled by 0xff characters. After the name of the program, you have 5 random characters (most of the time 0x00 characters). After these 5 characters, you have 2 characters, which represent the address of the beginning of the program. In fact, they are reversed. For example, if you have 0xfe and 0xf7, the real adress of the beginning of the program is 0xf7fe.
The program data is located between the first byte (offset you get after the program name) and the next 0xff byte you encounter (end of the program). Be careful, program data is reversed !
The four sheets (blue,green,orange ; see below for more information) of each picture saved is stored in the backup (unless the white is useless : how to waste memory space !)and the four color bytes are not stored in raw backups. However it is still possible to 'detect' a picture inside a raw backup using the white sheet which consists in 1024 '\x00' bytes
This is the format in which Casio calculators store pictures, and screen captures and in a lot of file formats. Here is the general specification of the format, specific variants are described in pictures and screen captures parts, and in file format documents.
A Casio picture is a picture of 128×64 pixels, up to four colours: orange, green, blue, white (the background). Black and white pictures are in fact 4-colours pictures with the blue colour used as black, and green and orange colours unused. The picture is split in four sheets, on by each colour. Each sheet is 128*64 = 8192 bits long, or 1024 bytes long.
Each sheet join pixels by group of eight horizontal (from the left to the right) pixels, to make a byte. A pixel in the colour of the sheet is coded by a bit 1, and a pixel in another colour by a bit 0. So a sheet is divided into 16 columns of 64 rows of 8 horizontal pixels. Bytes are stored in a sheet by columns, from the bottom to the top, and columns are stored from the right to the left. You can see the organisation of a sheet in the following picture:
The white sheet is always unused, each byte is 0x00.
Sheets have a “colour byte”, ie a byte with 1, 2, 3 or 4 as value, each value corresponds to a colour (the equivalence may differ, and will be specified for each format, it's the pallet). In some case, a sheet may begin by a sheet header, which don't add any information about the picture. Because of that, the length of the header will always be specified. In the majority of case, there is no header, so the length is 0.
To make the raw picture, sheets are join, in the order of colour bytes, without any separator. In some case, some sheet may be absent, and so the sheet is considered as a empty sheet (all bit are 0).
A Casio picture is a picture following the Casio image format. The colour byte is the first of each sheet (header length is 0), and the pallet is: [orange, blue, green, white].
A Casio mono screen capture does not follow exactly the Casio image format. It's like a sheet (without any colour byte or header), but columns are saved from the top to bottom (instead of from the bottom to the top).
You can convert into a Casio picture by splitting it into columns, inverting columns, join it into a sheet, adding a colour byte and three empty sheets.
A Casio colour screen capture is a picture following the Casio image format, but there is no sheet 3. The colour byte is the first of each sheet (header length is 0), and the pallet is [blue, green, white (absent), orange].
I gathered together theses three types of variables because they are sent in a very similar way by the calculator. What I call simple variables are variables like A,B,C,…Z (I think the calculator cannot send variable Ans), matrices are the rectangular arrays (with 2 dimensions) you can find in the matrix menu of your calculator and lists are … lists you can use with statistics, they are in fact arrays with one dimension.
Casio calculators are able to store values from -9.999999999×10^99 to 9.999999999×10^99. Up to 9 figures can be used to store the significand/mantissa, wich is a real number (9.999999999) and up to 2 figures can be used to store the exponent, wich is an integer (power of ten, so 99).
When you receive a number from the calculator, you will get 14 bytes. The four first bytes are not useful (in case of a simple variable), then you have 6 bytes used to store the significand
. Finally, you have two bytes (0x00), and then you have a “special code” (1 byte) and the exponent is stored in 1 byte. A small digram, to explain this (all numbers are in hex format and each block [x x] is a byte) :
[0 0] [0 1] [0 0] [0 1] [0 1st-figure] [2nd-figure 3rd-figure] [4th-figure 5th-figure] [6th-figure 7th-figure] [8th-figure 9th-figure] [10th-figure 0] [0 0] [0 0] [special code] [exponent].
What I call the “special code” is a number used by the calculator to store sign of the number (negative or positive) and the sign of the exponent.
Special code | Sign of the number | Sign of the exponent |
---|---|---|
0x01 | positive | positive |
0x00 | positive | negative |
0x51 | negative | positive |
0x50 | negative | negative |
View-window variable are variables used to describe a wien-window : Xmin, Xmax, Xscl, Ymin, Ymax, Yscl, T\thetamin,T\thetamax, T\thetaptch. Values are stored like in a normal variable. Theses variable are sent when you ask the calculator to send a view window settings file or when you ask the calculator to send Y=Data (in this case, it sends the current view-window settings).
When you receive a complete View-window settings file, each variable contained in this file (listed above) is transferred separately (a new header is sent for each value, and it contains the number of the view-window file the variable belongs to).
A matrix is an array with 2 dimensions.
: Maybe it would be good to move that to a “transfert tool” page.
The 7th byte of the header is the first dimension and the 9th byte of the header is the second dimension (if you start the numbering at 0).
Each value of the matrix is transmitted like an independent value. 16 bytes per values are transmitted. Values are of this form (numbers are hex and each [x x] block is a byte):
[0 0] [1st coord] [0 0] [2nd coord] [0 1st-figure] [2nd-figure 3rd-figure] [4th-figure 5th-figure] [6th-figure 7th-figure] [8th-figure 9th-figure] [10th-figure 0] [0 0] [0 0] [special code] [exponent] [checksum-byte] [3a].
The only differences with simple variables are that the four first bytes are used to store coords of the value inside the matrix. The byte 3a is normally used to initiate a communication, that's why I said each value of the matrix is transmitted as an independant value. Therefore, when you received the checksum byte, you have to send the byte 0x06 to the calculator otherwise it will stop the transmission. Moreover, when receiving a matrix, you have to check the checksum after each value is transferred and the calculator does not send a checksum at the end of the transmission.
Equation Matrices are matrices used in the calculator's equation solver. There are tranferred when you select 'Equation' in the transfer menu. There are two types of equation matrices : the Simultaneous equation matrix and the Polynominal equation matrix. The only difference between theses two types of matrices and a normal matrix is the header transmitted and the name. Equation matrices have also specific dimensions : (1,3) or (1,4) for the Polynominal (2nd or 3rd degree) and (2,3)(3,4)(4,5)… for the Simultaneous according to number of unknowns.
Lists are sent in the same way as matrices, except that there is only one dimension.
When asking the caculator to send a file list, it will send all the lists contained in this header including empty lists. In this case, only the header is transmitted. Lists and sent one after the other and there is no general header for the file. The only change compared with the transfer of several lists (which do not belong to a file) is that the file the lists belong to is mentionned in the header under this form 'File X'.
This type of data contains the expression of each function which can be used to draw a graph. They are sent when you select 'Y=Data' in the transfer menu.
In the header of a graph function, you have a metadata string containning information about the state of the function (selected or not) and it's color and of cours, it's type. There are 4 types of graph functions : Y, r, Param, X(constant). Y graph function, can have a sub type or an equality type =,>,<,>=,< =.The 10th (numbering starting at 0) character of the header is the function type, the 17th is the equality type and the 9th represents the length of the data. Then, you have a strange string like this one 'GR BL SLD YBL NSGT BL NS'.
The function's content is encoded the same way as programs.
The calculator is also able to send recursion function
You can save some graph function's expression inside a graph memory (G-Mem). The calculator is also able to send these G-Mems. In the header, useful information is : the length of data (9th character of the header, numbering starting at 0) and the caculator's model this G-Mem is compatible with (For example ZX933 stands for Graph 65).
The G-Mem content consists in 20 blocks like 'FunctionTypeCode-StatusCode' (2 bytes). Function codes are :
Function Type | Code |
---|---|
Y= | \x00 |
r= | @ |
Y > | \x0c |
Y < | \r |
Y >= | \x0e |
Y < = | \x0f |
(Needs to be completed)
State codes describe the state of the function :
For Y=,r=,Param functions :
Selected | Not selected | |
---|---|---|
Blue | \xb2 | 2 |
Orange | \xb1 | 1 |
Green | \xb4 | 4 |
For X=,Y<,Y>,Y⇐,Y>= functions :
Selected | Not selected | |
---|---|---|
Blue | \x82 | \x02 |
Orange | \x81 | \x01 |
Green | \x84 | \x04 |
\x00 means the fucntion is not defined Afterwards, you have (21-number of functions defined) '\xff' characters.
The interesting part is located after : it is the real content of the G-Mem. Each function's expression is separated from the others by a \xff character. Be careful, all the data is reversed. About the special characters, function expressions are encoded the same way as programs.
The end of the content is constituted by 90 characters, it is needed to unserstand what they mean.
Some ideas about the last 90 characters : it seems that they don't change if you have one or more Y= function defined (independently of the function expression).
F-Mems allow you to save a series of commands and to make them easily accesible. You can access them in the run menu typing OPTN > F6 > F6 > F3 (FMEM).
They are stored like very small programs. The length of the data is the 9th character of header.
If you are interrested in getting some samples of raw data directly received from the caculator and sometimes commented, look at this link http://xion345.o-n.fr/casetta-work/