Intel Hex not higlighting
-
@Alan-Kilborn Did you change the last digit before the FF from 5 to 6 like Eko did?
-
Hello, @david-griffiths, @ekopalypse, @alan-kilborn and All
You can find a good documentation on the
Intel Hex File Format
from below :https://developer.arm.com/documentation/ka003292/latest
https://en.wikipedia.org/wiki/Intel_HEX
And I deduced that the checksum can be calculated from this formula :
CheckSum = 256 - ( ∑ Byte Values ) MOD 256
Each Byte Value represents the decimal value of the next two hexadecimal codes, minus the last two ones, standing for the checksum
For instance, the fourth line, of your example, is :
vv----- CheckSum :10004C001D7F1093040410E008EC74D114E110939C <--------------------------------------> Data Range
So its checksum is :
= 256 - (10h + 00h + 4Ch + 00h + 1Dh + 7Fh + 10h + 93h + 04h + 04h + 10h + E0h + 08h + ECh + 74h + D1h + 14h + E1h + 10h + 93h) mod 256 = 256 - ( 16 + 0 + 76 + 0 + 29 + 127 + 16 + 147 + 4 + 4 + 16 + 224 + 8 + 236 + 116 + 209 + 20 + 225 + 16 + 147) mod 256 = 256 - 1636 mod 256 = 256 - 100
Thus, the checksum of the fourth line is
156
, so9C
BTW, it’s work pointing out that the background color of the
CHECKSUM
andCHECKSUM_WRONG
styles of theIntel Hex
language are totally transparent (α = 0
) So, for instance, the default red background of a wrong checksum is not visible if this line is the current N++ line with usual very pale blue background color !Best Regards,
guy038
-
@guy038 said in Intel Hex not higlighting:
BTW, it’s work pointing out that the background color of the CHECKSUM and CHECKSUM_WRONG styles of the Intel Hex language are totally transparent ( α = 0 ) So, for instance, the default red background of a wrong checksum is not visible if this line is the current N++ line with usual very pale blue background color !
Interesting. What’s the way around that, if any?
-
@Alan-Kilborn said in Intel Hex not higlighting:
What’s the way around that, if any?
Change the foreground color of CHECKSUM_WRONG to something that contrasts both with its red background color and with your Global Styles > Current Line Background > Background color.
-
@PeterJones said in Intel Hex not higlighting:
Change the foreground color of CHECKSUM_WRONG to something that contrasts both with its red background color and with your Global Styles > Current Line Background > Background color.
Well…yea…but I meant, isn’t there a way to do something to the current-line-background color so that you can just get the red there (or close to it due to blending of colors) for the non-current line case?
-
isn’t there a way to do something to the current-line-background color so that you can just get the red there (or close
I think the problem isn’t that the red has transparency; I think the problem is that the current-line-background has no transparency and is drawn over the red, so the current-line-background is the only visible background. It might be possible if the current-line-transparency could be set to 50% or something of that ilk, but that cannot be done in the GUI.
I tried editing stylers.xml to use either the MSB or LSB as an alpha value for the current line background
<WidgetStyle name="Current line background colour" styleID="0" bgColor="E8E8FF80" colorStyle="1" fontStyle="0" /> or <WidgetStyle name="Current line background colour" styleID="0" bgColor="80E8E8FF" colorStyle="1" fontStyle="0" />
But either was interpreted as invalid color, and current-line-background became black.
So to add transparency to current line background, it would have to be a codebase edit.
-
@PeterJones said in Intel Hex not higlighting:
So to add transparency to current line background, it would have to be a codebase edit.
I did some searching and found THIS as probably related.
-
@guy038 Thanks Guy. I know how to calculate the checksum but so does N++ and I would like it to be automatically calculated for me when I edit a line.
BTW I am still none the wiser as to why my desktop PC only wants to show Intel Hex in monochrome ??
-
@David-Griffiths said in Intel Hex not higlighting:
I know how to calculate the checksum but so does N++ and I would like it to be automatically calculated for me when I edit a line.
This goes beyond the responsibility N++ signs up for. :-)
You could certainly do something for it with a scripting plugin, e.g. Pythonscript. -
@Alan-Kilborn Yes I agree it is more than I expected from N++ but as it does know how to calculate the checksum, it would be a very small step to add a right click or such that inserted the correct value, would it not?
-
@David-Griffiths said in Intel Hex not higlighting:
N++ … does know how to calculate the checksum
Notepad++ code has absolutely no idea how to do this checksum.
It isn’t doing it.
The underlying lexer is doing it, which comes from a separate project, called Scintilla. -
@Alan-Kilborn Thanks for clarifying Alan. My knowledge of the inner workings of N++ needs work :-)
-
Sorry, I was busy with some personal matters.
Here’s a python script that hopefully does what you want. If there is something else you might want to have or it doesn’t do what you want it to be done I would kindly ask to use the github issue tracker in my repo. -
@Ekopalypse Thanks for posting this - sorry I only just noticed it. Better late than never :-)
Where should I save the file and how do invoke the script?
Any ideas why I am not seeing the highlighting on my Win10 PC? -
@David-Griffiths said in Intel Hex not higlighting:
sorry I only just noticed it. Better late than never
Wow, that was a long layoff…
Where should I save the file and how do invoke the script?
There are some basic instructions for this type of scripting HERE. See the PeterJones Jan 19, 2021 4:12pm posting.
-
@Alan-Kilborn Thank you Alan. I have installed the PythonScript plugin and created the script.
When I open a file containing 9 lines of Intel Hex and run the script, precisely nothing happens ??
This is on my desktop which does not show the highlighting of the hex file. I then tried on my laptop, which does the highlighting correctly, and the script works.
So back to the original question, why does my desktop not show the highlighting? Both running NPP v8.1.5 -
@David-Griffiths said in Intel Hex not higlighting:
When I open a file containing 9 lines of Intel Hex and run the script, precisely nothing happens ??
I doubt it’s actually nothing. Fortunately, PythonScript has a console which is useful for debugging: go to the PythonScript menu and show the console, and see if it shows any errors after you run the script.
This is on my desktop which does not show the highlighting of the hex file. I then tried on my laptop, which does the highlighting correctly, and the script works.
So obviously there is something different between the two setups.
So back to the original question, why does my desktop not show the highlighting? Both running NPP v8.1.5
My magic eight ball says “Reply hazy, try again” and then “Concentrate and ask again”. In other words: you haven’t given us enough to go on. You’ll have to provide more information, including the PythonScript console results, and maybe some example data.
-
David Griffiths
David Griffiths Aug 15, 2020, 10:24 PM@Alan-Kilborn
I doubt it’s actually nothing. Well actually it is! The console shows nothing at all after the ‘ready’ when I run the script ??Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
Initialisation took 297ms
Ready.This seems to be reporting an AMD processor which it isn’t! It is an Intel i5-6400 ??
In other words: you haven’t given us enough to go on. Fair comment, but I am not sure what I can add? Here is a sample of the data but I doubt that is relevant.
:10000000FF050102FFFFFFFFFFFFFFFFFFFF09FFF5 :10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 :10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 :10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0 :10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0 :10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0 :10006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0 :10007000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90 :00000001FF
Both machines are running Win10 Home. Obviously the screen drivers are different. Both running the latest version of NPP.
Are there any config files I can send?
Cheers, DG
-
@David-Griffiths said in Intel Hex not higlighting:
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
I’ve never really considered this before, but I think it (the “AMD”) is probably what PythonScript was built with? Or the Python exe it uses was built with it? Regardless, I don’t think it has anything to do with what machine it is currently running on.
At least you didn’t complain that it isn’t showing the current date but is rather showing Apr 20 2020 (that’s a total joke, but it adds support to that this info is being pulled from somewhere other than your current machine).
-
@David-Griffiths said in Intel Hex not higlighting:
The console shows nothing at all after the ‘ready’ when I run the script ??
I think that @PeterJones was hopeful that some sort of error message would be produced. As nothing of that ilk appears to be showing, it would seem the script is functioning as @Ekopalypse intended, just maybe not for you.