Project #1
Changing the date stamp in a .mdl file so you can put models in any order you want on the 145MZ's model menu.

Overview:
Futaba puts a date/time stamp in the .mdl file right after the model name and this date/time stamp is used to determine the order in which models are displayed in the "Model Menu".  The goal of this project to edit the date of a file and thus allow you to change the order in which that .mdl file is displayed.

In order to do this you will need a hex editor which has the capability to also calculate 16 bit Checksum's on a selected amount of data.
I recommend this trial software Hex Workshop here:
http://www.bpsoft.com/

Analysis of the .mdl file:
When you open the .mdl file in Hex Workshop you will see this information at the top of the file.  This screen shows where the date and time is located and it is always located at byte offset 168.

Now you must understand that Hex Workshop displays these "words" (2 bytes) in Low Byte / High byte format.  So if we look at the first word at offset 168 you see D607. This is the year BUT the 2 bytes are reversed.  The software in the 14mz see this number as 07D6 which in decimal is 2006. 
Notes about this screen shot:
Red circle #1 shows the offset into the mdl file.  You can get the cursor to byte offset 168 by going up into the EDIT menu and selecting GOTO.  Then set the DEC (Decimal) and select "Beginning of file", then type in 168.  The cursor will be placed at the beginning of byte offset 168.  The  Red Circle #2 shows the reversed value (high byte / low byte) and shows the value as 2006.
If you were to place the curser on byte offset 170 you would now see the the lower display (red circle #2) change to the number 4.  So as you see Hex workshop will reverse the high/low for you and in fact you can edit the decimal value in this lower screen and Hex Workshop will edit the hex for you in the proper low byte / high bit order.  COOL!

OK so we have our date to change and the offsets are:
168 = Year
170 = Month
172 = week of the month (1-5 if a month has 5 weeks or 1-4 if only 4 weeks).
174 = Day of the month
176 = Hour
178 = Minutes
180 = Seconds

So if we wanted this model to be higher up in the 14mz model list we could simply change the date to be before other models in the list BUT it aint that easy!  The 14mz has two Checksums in the file.  A Checksum is a math calculation done on the file. It adds up all the bytes is a data block and creates a Checksum number which is then stored at the end of the data block.  If the Checksum is not correct then the 14mz will ignore the mdl file and not even display the model in the list.  If you edit any data in the MDL file the Checksum will no longer match. So we must find these Checksums and edit them as well.  This is where Hex Workshop helps as you can select a block of data (or the entire file) and have it calculate a Checksum which you can then use to make the mdl file correct again.

So where are these Checksums?  Well one is at byte offset 184 just after the date and time and is the Checksum for the model name and date and time stamp data block.  The other is at the end of the file at byte offset 131068 and is the Checksum for the entire mdl file.

This screen shows the model name / date time stamp data block Checksum location.

This screen shows the end of file Checksum location at offset 131068.

So let's now go modify the date and set the Checksums

NOTE: I would NOT change the date to some time in the future of what the 14mz's date and time is set to.  I have not tested what will happen!!!!  So always set the date BACK.

First step is to change the date.  In this example I am just going to edit the DAY but you can do this for month or year.
Using the GOTO function go to byte offset 174 (red circle #1 and #3 in the picture below).
Now down in the lower left area of Hex Workshop double click on the number next to Unsigned Byte and a edit box will appear.
Change this number to the day you want in decimal format.  In this example the day is 6.

That's it! You just change the date of the mdl file.

Now we need to set the Checksums so the mdl file will work.
First lets change the filename date/time data block Checksum.
Using the GOTO function go to offset 184.  The cursor should be blinking if front of that offset (in this example 110A).  Now drag your cursor to the top of the file in front of the first byte 5400 so all that data block is selected (red circle #1 in the picture below).  Now click the Checksum button (red circle #2 in picture below).

After clicking the Checksum button you will get this dialog pictured below.  Make sure Checksum (16 bit) is selected and SELECTION is selected (see red circles).  Click the generate button and the Checksum will be calculated and the dialog will close.

The Checksum will be in the lower right box of Hex Workshop as noted in the picture below with the red circle.  Now this double byte (WORD) in High byte low byte format!  We need to reverse the 2 bytes when we enter this into the data at offset 184.

So reverse the bytes and enter them in location 184.  In this example is was 110A.  The Checksum calculation gave us 0A0F so we reverse the Checksum order and will enter 0F0A into that location.  The screen shot below shows the summary of the changes we made thus far.
Red circle 1 shows we changed the DAY from a 6 to a 4.  Red circle #2 shows are NEW recalculated Checksum of 0A0F, and red circle #3 shows that we reversed the 2 bytes and entered 0F0A at offset 184.

OK last step!  We need to calculate and edit the FILE Checksum.

At the top of the file (the first byte) we see the value 5400.  Click in front of the 5400 so the cursor is blinking in front of the 5400.  Now using the window scroller on the left side of Hex Workshop, scroll all the way to the END of the mdl file.  At the end of the file again you will see the value 5400 but we want the cursor to be clicked in front of the word just before the 5400.  So HOLD DOWN THE SHIFT KEY and click in front of the word prior to the 5400. In this example the value there is F1D1.  Once you click the entire data block from the top of the file to the end, excluding the last two words, should now be selected.  See screen shot below.

Now click the generate Checksum button just like you did in the previous step and generate the Checksum.  Again make sure the generate Checksum dialog has 16 bit and SELECTION is selected and click the generate button.  The dialog will close and again the new Checksum will be in the lower right box of Hex Workshop.  Again the Checksum is in low byte/high byte format and we must enter this into the Checksum location reversed!!  Now click on the 2nd to the last word (in this example value F1D1) and enter the Checksum reversed (in this example the Checksum calculated was D1ED so we enter it as EDD1).  The screen shot below shows what we just did in this example.  Red Circle #1 was our new calculated Checksum and red circle #2 shows it entered with the 2 bytes reversed.

That's it!  Now just go up to the FILE menu of Hex Workshop and save the file.  It will ask you if you want to make a back up so say yes if you like.

Now copy this file to your CF card and then copy it into your 14mz memory.

If the model does not show up on the CF card this means you did not do the Checksum calculations or entries properly!!!!  Toss this file and use the backup made by hex workshop and try again.

So this completes project #1

Enjoy!

Hit Counter