Differences

This shows you the differences between two versions of the page.

formats:g1r [2010/06/16 04:46]
91.214.45.253 comment2, http://elaynecje.pochta.ru/guymplen-skachat-film.html ãóéìïëåí ñêà÷àòü ôèëüì, oofkrj, http://cluu00zuehl.pochtamt.ru/site-242.html êðåñòèê âàìïèð õåíòàé, %], http://garethsunkpa.mail333.su/doc_606.html ìèñòåð è ìèñèñ ñìèò 2, oztz, http://gwendolynrhht.nm.ru/page_195.html ïðîäþññîð àëåêñàíäð ñàìîõâàëîâ, xmusm, http://elseek3l1g.front.ru/site-281.html öâåòî÷êè ïîñëå ÿãîäîê êîðåéñêàÿ âåðñèÿ, uowugq, http://fiserrepu3s.land.ru/page-609.html ëûãóí ìîãó÷èé, :-[, http://freddiesaaz9.pochtamt.ru/doc_836.html ñêà÷àòü ãàéâåð àíèìå 2005 ãîä, wqlht, http://gleberstiea.hotmail.ru/site-640.html àíàñòàñèè çàäîðîæíîé, ouo, http://dustinwazj.hotmail.ru/kim-dzhonatan.html êèì äæîíàòàí, euakt, http://cobyh2facorley.front.ru/site-544.html êðàñîòêà 1990, 48462, http://hea7gmtrueax.fromru.su/page-337.html ñòèíãåð ñêà÷àòü, 313443, http://dorita444ahsan.mail15.su/page_238.html ãîíäðè òîêèî, >:-]]], http://davisbgcba.krovatka.su/site-568.html êðåïêèé ïîöåëóé àíèìå, mtnjga, http://grantlv99jo.newmail.ru/site-814.html ÷àñ âîëêîâà îïåðàòîð, 9697, http://ettiearrowjo9.hotbox.ru/doc_372.html çàâòðà íàñòóïèò ñåãîäíÿ ðàïèäà, kxx, http://fleta9ieskr.newmail.ru/doc_155.html åëåíà ìåòåëêèíà áèîãðàôèÿ, %-[,
formats:g1r [2010/06/16 11:06] (current)
Line 1: Line 1:
 +For the new calculator casio graph 85, [[http://world.casio.com/edu/resources/fa124/index.html|Fa-124]] use a binary format named g1r instead of the cat format. This format can save many record in one file and support all casio kind of data. G1r files are ended by .g1r
 +====== Programs ======
 +
 +In this format, programs are stored in the raw format, inside a bloc of metadata with a fix size. Those metadata contain the name of the program and if the program use bas operations or not. Programs and metadata can be extracted from a g1r file with a regular expression (here in python with the re module):
 +
 +<code python>
 +g1r_file = open(filename, 'r')
 +# Regular expression:
 +data_pattern = re.compile('''
 +    (PROGRAM)      # kind of data (only programs with this regexp)
 +    [\x00]{12}     # Separator
 +    [\x01]         # one 0x01 (separator)
 +    system         # The 'system' string
 +    [\x00]{2}      # Separator
 +    ([^\x00]{1,8}) # name of the program
 +    [\x00]{0,7}    # 0x00 to complete the name
 +    [\x01]         # mark of the end of the name
 +    [\x00]{2}      # Separator
 +    .{2}           # two characters (?)
 +    [\x00]{11}     # Separation
 +    (\x00|\x01)    # Base (0x01) or not (0x00)
 +    (.*[^\x00])    # all characters, ended by a non 0x00 characters: raw data without the 0xFF end character
 +    [\x00]{2}      # end of the record
 +''', re.VERBOSE)
 +# extract data from the file
 +data_list = data_pattern.findall(g1r_file.read())
 +g1r_file.close()
 +for record in data_list:
 +    # record = ('DATA TYPE', 'FILE NAME', 'BASE', 'RAW DATA')
 +    data_type = record[0]
 +    data_name = record[1]
 +    if record[2] == '\x01':
 +        use_base = True
 +    else:
 +        use_base = False
 +    raw_data = record[3] + '\x0d\xff' #adding the raw end character
 +</code>
 +
 +
 +====== Picture ======
 +
 +The extraction of a picture from a g1r file is done in two steps.
 +
 +===== Step 1: extract the record =====
 +
 +This may be done with a regular expression, here in python, with the re module:
 +
 +<code python>
 +# Make the regular expression
 +picture_pattern = re.compile('''
 +    (PICTURE[ ][1-6])   # data name
 +    [\x00]{10}          # Separator
 +    [\x01]              # one 0x01 character
 +    main                # The 'main' string
 +    [\x00]{4}           # Separator
 +    (PICT[1-6])         # name (#2)
 +    [\x00]{3}           # Separator
 +    [\x07][\x00]{2}
 +    [\x08][\x00]{4}
 +    (.{1024})           # Sheet1
 +    (.{1024})           # Sheet2
 +''', re.VERBOSE | re.DOTALL)
 +g1r_file = open(filename, 'r')
 +picture_list = picture_pattern.findall(g1r_file.read())
 +g1r_file.close()
 +for record in picture_list:
 +    # record = ('DATA NAME #1', 'DATA NAME #2', 'SHEET1', 'SHEET2')
 +    data_name = 'Picture' + record[0][-1]
 +    sheet1 = record[2]
 +    sheet2 = record[3]
 +</code>
 +
 +You get the picture under the form of two sheet, each one code a color.
 +
 +===== Step 2: convert the sheets into an usable picture =====
 +
 +Each sheet is 1024 byte long. 16 following byte represent a row, where each bit represents one pixel: if the value of the bit is 1, the value of the pixel is the color of the sheet. Bit are sorted in row from the left to the right ; row are sorted from the top to the bottom.
 

Powered by PHP Valid XHTML 1.0 strict Valid CSS Driven by DokuWiki

The content of this website is, without another mention, under the GNU Free Documentation License.