Differences

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

formats:fxd [2010/02/06 23:29]
88.217.61.153
formats:fxd [2010/06/16 11:09] (current)
thesa old revision restored
Line 1: Line 1:
 +Fxd is the format used by Fx-Interface Pro to save backups. Fxd files are ended by .fxd
 +On this format, data are saved in raw format, on records. There are also a lot of other data (more than an half of the file) for Fx-Interface Pro...
 +
 +====== Program records ======
 +
 +Program records can be read with the following regular expression (here in python with the re module):
 +
 +<code python>
 +import re
 +
 +data_pattern = re.compile('''
 +(PG)            # type of data
 +.{4}            # 4 characters
 +([^\xff]{1,8})  # data name
 +\xff{16,23}     # between 16 and 23 (16+8-len(data name)) 0xFF
 +(NL|BN)              # Option1 (NL=normal, BN=base)
 +\xff{13}        # 13 0xFF
 +.{8}            # 8 characters
 +([^\xff]+\xff)  # any non 0xFF characters ended by one 0xFF : raw data
 +''', re.VERBOSE)
 +
 +fxd_file = open(fxd_filename, 'rb')
 +out_ctn = data_pattern.findall(fxd_file.read())
 +fxd_file.close()
 +
 +# out_ctn is the list of records
 +# each record is like:
 +# ("DATA TYPE", "FILE NAME", "OPTION", "RAW DATA")
 +# DATA TYPE is always "PG" (programs)
 +# FILE NAME is the name of the program
 +# OPTION is "NL" for normal program, "BN" for program with base operation
 +# RAW DATA is the content of the program, in the raw format
 +
 +# You can get those data with this code:
 +
 +for record in out_ctn:
 +    data_type, file_name, option, raw_data = record
 +    # you can now use data_type, file_name, option and raw_data
 +</code>
 +
 +====== Picture records ======
 +
 +Picture records can be read with the following regular expression (here in python with the re module):
 +
 +<code python>
 +import re
 +
 +pictures_pattern = re.compile('''
 +    (Picture[1-6])      # data name
 +    \xee\x03\x00\x00    # Some data (?)
 +    \(\x00\x00\x00\x01\x00\x00\x00
 +    \x80\x00\x00\x00\x40\x00\x00\x00
 +    \x01\x00\x00\x00\x04\x00\x00\x00
 +    \x04\x00\x00\x00\x55\x00\x00\x00
 +    F\x00\x00\x00W\x00\x00\x00\x00
 +    \x10\x00\x00
 +    (.{1024})           # First sheet
 +    (.{1024})           # Second sheet
 +    (.{1024})           # Third sheet
 +    (.{1024})           # Last sheet
 +    \xee\x03\xef\xfe
 +    \xae\x0f\xef\xfe\x03\x00\xef\xfe
 +''', re.VERBOSE | re.DOTALL)
 +
 +fxd_file = open(fxd_filename, 'rb')
 +out_ctn = pictures_pattern.findall(fxd_file.read())
 +fxd_file.close()
 +
 +# out_ctn is the list of records
 +# each record is like:
 +# ("PICTURE NAME", "SHEET1", "SHEET2", "SHEET3", "SHEET4")
 +# PICTURE NAME is the name of the picture
 +# SHEET1, SHEET2, SHEET3 and SHEET4 are the four sheet of the picture
 +
 +# You can get those data with this code:
 +
 +for record in out_ctn:
 +    file_name, sheet1, sheet2, sheet3, sheet4 = record
 +    # You can now build the picture using sheet1 to sheet4
 +    # The picture is more or less in the casio picture format:
 +    # The four sheets are like sheets in the casio picture format,
 +    # but without the colour byte. Just add a colour byte \x01 to \x04
 +    # at the beginning of each sheet, join the result, and you'll get a
 +    # picture in the casio picture format, with the colour byte at 0,
 +    # and the pallet: [orange, blue, green, white]
 +    # Example:
 +    casio_picture = '\x01' + sheet1 + \
 +                    '\x02' + sheet2 + \
 +                    '\x03' + sheet3 + \
 +                    '\x04' + sheet4
 +</code>
 +
 +====== Screen capture records ======
 +
 +===== Mono screen captures =====
 +
 +Mono screen capture records can be read with the following regular expression (here in python with the re module):
 +
 +<code python>
 +import re
 +
 +mono_sc_pattern = re.compile('''
 +    \x00([^\x00]+)      # data name
 +    \xee\x03\x00\x00    # some data (?)
 +    \(\x00\x00\x00\x02\x00\x00\x00
 +    \x80\x00\x00\x00\x40\x00\x00\x00
 +    \x01\x00\x00\x00\x01\x00\x00\x00
 +    \x02\x00\x00\x00\x44\x00\x00\x00
 +    F\x00\x00\x00W\x00\x00\x00\x00
 +    \x04\x00\x00
 +    (.{1024})           # First sheet
 +    \xee\x03\xef\xfe
 +    \xb1\x0f\xef\xfe\x03\x00\xef\xfe
 +''', re.VERBOSE | re.DOTALL)
 +
 +fxd_file = open(fxd_filename, 'rb')
 +out_ctn = mono_sc_pattern.findall(fxd_file.read())
 +fxd_file.close()
 +
 +# out_ctn is the list of records
 +# each record is like:
 +# ("FILE NAME", "SHEET1")
 +# FILE NAME is the name of the screen capture
 +# SHEET1 is the sheet of the mono screen capture
 +
 +# You can get those data with this code:
 +
 +for record in out_ctn:
 +    file_name, sheet1 = record
 +    # sheet1 is the black sheet of a casio picture, but without colour
 +    # byte, and with pixel reversed from the bottom to the top.
 +</code>
 +
 +===== Colour screen captures =====
 +
 +Colour screen capture records can be read with the following regular expression (here in python with the re module):
 +
 +<code python>
 +import re
 +
 +color_sc_pattern = re.compile('''
 +    \x00([^\x00]+)      # data name
 +    \xee\x03\x00\x00    # some data (?)
 +    \(\x00\x00\x00\x02\x00\x00\x00
 +    \x80\x00\x00\x00\x40\x00\x00\x00
 +    \x01\x00\x00\x00\x03\x00\x00\x00
 +    \x04\x00\x00\x00\x55\x00\x00\x00
 +    F\x00\x00\x00W\x00\x00\x00\x00
 +    [\x0c]\x00\x00
 +    (.{1024})           # First sheet
 +    (.{1024})           # Second sheet
 +    (.{1024})           # Third sheet
 +    \xee\x03\xef\xfe
 +    \xb1\x0f\xef\xfe\x03\x00\xef\xfe
 +''', re.VERBOSE | re.DOTALL)
 +
 +fxd_file = open(fxd_filename, 'rb')
 +out_ctn = color_sc_pattern.findall(fxd_file.read())
 +fxd_file.close()
 +
 +# out_ctn is the list of records
 +# each record is like:
 +# ("FILE NAME", "SHEET1", "SHEET2", "SHEET3")
 +# FILE NAME is the name of the screen capture
 +# SHEET1, SHEET2 and SHEET3 are the sheets of the colour screen capture
 +
 +# You can get those data with this code:
 +
 +for record in out_ctn:
 +    file_name, sheet1, sheet2, sheet3 = record
 +    # You can now build the picture using sheet1 to sheet3
 +    # The picture is more or less in the casio picture format:
 +    # The four sheets are like sheets in the casio picture format,
 +    # but without the colour byte. Just add a colour byte \x01 to \x03
 +    # at the beginning of each sheet, join the result (and add a white sheet)
 +    # and you'll get a picture in the casio picture format, with the colour
 +    # byte at 0, and the pallet: [blue, green, white, orange]
 +    # Example:
 +    casio_picture = '\x01' + sheet1 + \
 +                    '\x02' + sheet2 + \
 +                    '\x03' + '\x00' * (128 * 64 / 8) + \
 +                    '\x04' + sheet3
 +</code>
 

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.