+ Post New Thread
Page 3 of 3 FirstFirst 1 2 3
Results 41 to 55 of 55
  1. #41
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    c_mitra it does not work same only shows a dot,and i have re-tried last both files
    The source code files you have posted are different but compiles ok.

    I shall try to edit the hex file...



  2. #42
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    .Can you try the last one mw104.zip .
    Yes, I have finally modified the mw104.zip (this appears to be a newer file). The corrected file is attached here:final.zip

    You need to unzip and upload the final.hex - fortunately the code was not protected for modification.

    I have modified only the first line and you should now see REVE FM LEBANON displayed.

    If this works, I shall outline the steps on how to edit the text in the hex file.

    Good luck.


    1 members found this post helpful.

  3. #43
    Full Member level 1
    Points: 2,301, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jul 2009
    Location
    leb
    Posts
    95
    Helped
    0 / 0
    Points
    2,301
    Level
    11

    Re: public hex to asm possible to get

    Thanks c_mitra my freind but i need for tomorrow to reply .
    regards.



  4. #44
    Full Member level 1
    Points: 2,301, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jul 2009
    Location
    leb
    Posts
    95
    Helped
    0 / 0
    Points
    2,301
    Level
    11

    Re: public hex to asm possible to get

    I can say C_mitra , we get what we need finally ,but there is minor error in the name LEBANON .



  5. #45
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    but there is minor error in the name LEBANON .
    It is my fault; I did not double check. I should have.

    Now that it is working, I can tell you how I did edit the hex file OR I can do the correction.

    I did edit the file in vim; it has context color and is not difficult.

    There may be other editors, but the hex file is a text file (this is intel format file; hex bytes are written in ASCII). There is a specific format for each line of text.

    I shall edit them and send you again.

    - - - Updated - - -

    I shall edit them and send you again.
    The error corrected file is here: final1.zip

    This is the last attempt! I am getting bored with editing!


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  6. #46
    Full Member level 1
    Points: 2,301, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jul 2009
    Location
    leb
    Posts
    95
    Helped
    0 / 0
    Points
    2,301
    Level
    11

    Re: public hex to asm possible to get

    hi no please dont get bored ,yes i know it is boring but i need to learn a bit ,i hvae downloaded the vim software ,but i need the steps to ,if i want to change anything later thanks .i have teamviwer ?
    I can tell you how I did edit the hex file OR I can do the correction.

    - - - Updated - - -

    final1.zip it is not working only dots

    - - - Updated - - -

    34 46 33 34 35 41 33 34 33 32 33 34 34 33 33 34 37 32 0D 0A 3A 31 30 31 36 35 41 30 30 35 30 33 34 35 35 33 34 32 30 33 34 34 34 33 34 34 39 33 34 34 37 33 34 34 39 33 34 35 37 33 34 41 37 0D 0A 3A 31 30 31 36 36 41 30 30 34 31 33 34 35 34 33 34 35 34 33 34 34 44 33 34 34 35 33 34 35 34 33 34 34 35 33 34 35 32 33 34 36 41 0D 0A 3A 31 30 31 36 37 41 30 30 30 30 33 34 34 46 33 34 35 41 33 34 33 32 33 34 34 33 33 34 35 30 33 34 35 35 33 34 32 30 33 34 44 44 0D 0A 3A 31 30 31 36 38 41 30 30 34 34 33 34 34 39 33 34 34 37 33 34 34 39 33 34 35 37 33 34 34 31 33 34 35 34 33 34 35 34 33 34 35 33 0D 0A 3A 31 30 31 36 39 41 30 30 34 44 33 34 34 35 33 34 35 34 33 34 34 35 33 34 35 32 33 34 30 30 33 34 35 36 33 34 36 35 33 34 36 38
    is this where have you edit ?



  7. #47
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    Sorry, I must have made some mistake in the editing. I am outlining the steps to be followed with some screenshots.

    1. Start with the last working file, final.zip, extract it to get final.hex. This file has some mistakes and we wish to change /correct that.

    2. I use vim for this; when I use vim final.hex, I get the output. (pic below).

    Click image for larger version. 

Name:	Screenshot from 2019-11-19 09-51-02.png 
Views:	6 
Size:	62.2 KB 
ID:	156565

    This is the hex image in intel format. Each line is one record; first two chars (one byte) tells the number of bytes in the record. Next four chars (two bytes) are the address. Next 16 bytes (32 chars) are the data. Last two chars are the checksum for this record.

    The color coding has been done by vim.

    When we change a byte, we must also recalculate the checksum.

    Let us see how to locate the string. First we search for the char L:

    We type in vim /4C to look for the char L. But there may be some that are not part of the data string. So we cannot change at random.

    We type :%s/4C//gn in vim. We see that the char L occurs 50 times. So we go for another char. This time we search for "!"
    In vim I type /21. We see where they are present.

    Finally we locate them in address line 165A. Look up an ascii table ans see that the ascii codes for LEBANON are 4C 45 42 41 4E 4F 4E

    (see next post)

    - - - Updated - - -

    Searching is messy because they may not occur on the same line. ALso note that each char is separated by hex 34.

    Search /4C344534 and you will that it is presence only once ... (it should be present twice but because of the spelling error)

    Now we know that we have typed LF (by mistake) - so we search for /4C344634.

    We reach the line that needs correction. Address line 168A.

    in this line change 46 to 45. Also change 21 (code for !) to 41 (code for A). That is all.

    Wait, we have made some changes to the file and the checksum is now to be corrected.

    Open a calculator in hex mode. And add the following: 10 +16 +8A +20 +34 +4C+ 34 +45 +34 +42 +34 +41 +34 +4E +34+ 4F +34 +4E +34

    (number of bytes + address two bytes + data bytes (sixteen in this case): in this case 46F. We take twos complement and take the last byte: 91.

    We must put the correct checksum in line 168A (the last byte is the checksum). We replace B0 with 91.

    Now you save and exit. (command is in vim).

    That is all, load and run!

    - - - Updated - - -

    In the screenshot, vim is saying [dos] on the status line; by mistake I opened the file without the -b option. You should open the hex file in binary mode (i.e., vim -b final.hex)- otherwise other stuff may be written in the file.

    After the edit, the original file (you kept a copy, right?) and final file must have he same size.

    Also a diff orig.file chang.file should show only one line (because we have modified only one line).

    I hope I have made the basics clear.


    1 members found this post helpful.

  8. #48
    Full Member level 1
    Points: 2,301, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jul 2009
    Location
    leb
    Posts
    95
    Helped
    0 / 0
    Points
    2,301
    Level
    11

    Re: public hex to asm possible to get

    Hi i knew that you Helped me a lot lot ,and this thread began to be long and maybe boring for others ,and you put lots of energie and work and effort and time ,but thoses they are hard to me to understand because i dont have that basic ,i will try to learn what you did but i am sure it would took a lot of time and maybe i will not achieve my goal.so i would save thoses instructions guide for a to do ,OKAY i should try myself thoses simple instruction to learn a bit ,and if i will not succssed because i am not so familiar ,then i will ask to corrrect ,please keep an eye from moment to moment
    regards .
    thanks edaboard.
    Last edited by radium98; 19th November 2019 at 07:54. Reason: try myself



  9. #49
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    thanks edaboard.
    The corrected file is -- test.zip

    Hope that is useful.


    1 members found this post helpful.

  10. #50
    Super Moderator
    Points: 82,033, Level: 69
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,454
    Helped
    4488 / 4488
    Points
    82,033
    Level
    69

    Re: public hex to asm possible to get

    Patching a HEX file is not something we would normally do so don't worry about learning it too much. Having said that, I think most of us 'more experienced' engineers have had to do it once or twice in the past.

    You are not changing the software itself, you are manually searching for the characters in the binary file the MCU runs and substituting new ones then modifying the checksum to keep the programming hardware happy.
    It works but there are some drawbacks:
    1. the characters are in the middle of other code and you can't move that code, that means your new text must be the same length as the old one.
    2. you have to manually re-calculate the checksum as c_mitra explained, the final byte is used by the programming hardware to confirm the whole line is good so you have to compensate for your changes.
    3. the program you are editing may be encrypted or may do its own internal checks to confirm the text hasn't been changed, to protect against piracy for example.
    4. sometimes the whole program is verified with a checksum, either in the HEX file or by some internal routine (PC BIOS for example). This is much harder to edit because there can be other changes hidden in the HEX file.
    5. the characters may not be in standard ASCII code. If they use UTF coding for example, each character you see on the LCD may be more than one byte in the HEX file.

    Re-compiling for source code is the best way by far because it creates a new HEX file for you with all the changes and checksums freshly calculated. I'm not sure why c_mitra's source edits didn't work but I suspect it is because a HEX file can also contain a section that isn't part of the program itself but is instructions to the programming hardware to configure the MCU. If that is missing the program will appear to compile but it will not run or behave unpredictably in real silicon.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



    •   AltAdvertisement

        
       

  11. #51
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    Patching a HEX file is not something we would normally do so don't worry about learning it too much....
    You are correct; but this is a nice exercise for a beginner.

    Fortunately the code was not protected. PIC HEX files can be resistant to editing if they are code protected. However, I do not know how that works exactly.

    Fortunately I had the original source (but that did not work because of some other errors) and I see that the strings have been defined in one place - all with a fixed 20 char length- padded with space. We were double luckey!

    Fortunately, the display can take only ASCII chars (it can display custom char but that is a hassle).

    The original poster gave me the source and it compiled ok but I could not follow the logic. And it did not work- for some strange reasons. I could not debug because I did not follow the logic.

    If there were a checksum for the whole file, that would have increased the work load. But it could have been done.

    The program is very old and written carelessly. But that is a different story.

    I moved some of the __CONFIG statements to #pragma. Some of the in-build variable names have been changed (and I modified them too).

    But it is tough to modify if you do not follow the logic.

    I have used PIC for some projects eons ago; but the student did most of the work and I mostly supervised and debugged the program.

    My point is that the software and the hardware cannot be divorced; the user must learn both as a package.

    MPLAB IDE is also having lots of bugs (it flags errors that are not really errors)- but that is a different story in another direction.



    •   AltAdvertisement

        
       

  12. #52
    Full Member level 1
    Points: 2,301, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jul 2009
    Location
    leb
    Posts
    95
    Helped
    0 / 0
    Points
    2,301
    Level
    11

    Re: public hex to asm possible to get

    Thanks for you both for every teaching.
    C_mitra there still my freind a little error ONLY in the first page and not in the end ,the error is in the name , i have already said that before ,but maybe you have not seen it,only one character is wrong ,instead of LEBANO n you put another char ,this is the only mistake ,please correct it .



  13. #53
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    yes, I fount the error and made changes. Here is the correct file: test.zip


    1 members found this post helpful.

  14. #54
    Full Member level 1
    Points: 2,301, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jul 2009
    Location
    leb
    Posts
    95
    Helped
    0 / 0
    Points
    2,301
    Level
    11

    Re: public hex to asm possible to get

    I thank you very much c_mitra ,because you took a long time to mind on me and helped me.Worked okay .



  15. #55
    Advanced Member level 5
    Points: 17,798, Level: 32
    Achievements:
    7 years registered

    Join Date
    Nov 2012
    Posts
    3,249
    Helped
    808 / 808
    Points
    17,798
    Level
    32

    Re: public hex to asm possible to get

    because you took a long time to mind on me and helped me.Worked okay...
    It took long time because I made mistakes after mistakes. I made mistakes not because I did not know how to do but because I was not careful enough.

    I am glad that it worked. Happy coding and recoding.


    1 members found this post helpful.

--[[ ]]--