Apply Keyword to first byte only

Started by the1, February 15, 2017, 08:56:22 AM

Previous topic - Next topic

the1

Hi everyone, i have attempted to setup a Motorolla 68HC11 syntax xml, it's all working but due to the code being hex other variables or numbers get picked up as syntax, can we limit syntax searching to the first byte only on each line?

alex

Hi the1,

try this
Code (xml) Select
<Style name="Registers" image="13" bold="0" italic="0" underline="0" clr="Keyword3" bkclr="#FFFFFFFF">
  <Keywords lead="$">
    <Keyword text="1A"/>
    ....
  </Keywords>
</Style>

You can find documentation about defining keywords here: http://wiki.hippoedit.com/syntax/styles/keywords

You may try also replace Keywords by Regexp or Block definition if registered are all combinations of hex from 00 to FF, but in this case, you will not get them suggested in auto-completion list (if a register is not yet typed in a document).

BR, Alex.
P.S: If you would like to share your syntax schema and get it available in the repository for download, you may send it to me when it is done - I will validate and publish it. It also qualify for free license, if you need it http://hippoedit.com/free_licensed_copy.php
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

the1

Hi Alex, Thanks for that, it works a treat, ive attached the file for submission a free licence would be handy :)

alex

Hi,

can you attach here (or send to supportbox at hippoedit com) a test file Motorolla 68HC11 file?
I would use it for further validation and we can also check if something can be added.

Do you have ideas about what can be:
- default file template for Motorolla 68HC11 file
- standard Code Templates that can be added to the scheme
- Some internet links to documentation, instruction documentation that can be added as syntax contextual help and reference?

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

the1

The full syntax instruction sheet is available here. The instructions Keywords is the Mnemonic field and Registers Keywords is the Instruction Opcode field. Feel free to rename.
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/

Processor information here, i am using the 68HC11F1 model which is what i have built the syntax file for.
https://en.wikipedia.org/wiki/Freescale_68HC11

Ive attached a ASM file with some strings in meaningless order but its dummy code.

alex

Hi,

checking your sample, and also other samples I have found on the Internet, I saw that the scheme was rather incomplete. Even in your example comments were not properly syntax highlighted :/
So, I have spent some time on correcting it and extending based on information from the Internet. Also adding descriptions for instructions.
Resulted scheme may be found in GitHub: https://github.com/hippoedit/syntax/tree/master/Assembler
Please validate, if it is OK (you can find attached examples or find some other samples in Web).

Also for me was confusing, that you have used for comments {} and @ for labels. Have not found any example with that.
Do you have a link to syntax specification for Freescale 68HC11?

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

the1

Unfortunately it's not a one size fits all, different companies used different compilers which wrote the assembly differently, mine is GM specific, others will be different. There are so may Variants that you will not cater to them all, this is why i have searched for many years to find a program i can customize the syntax highlighting to suit what i am using. It is fine if you dont want to publish it, it is here on the forums if people need it and can also mod it to suit their variant.

the1

it's working fine for me?


alex

#8
Hi,

can you try the version from GitHub?

You need these files:
https://github.com/hippoedit/syntax/blob/master/Assembler/asm_base_spec.xml
https://github.com/hippoedit/syntax/blob/master/Assembler/asm68HC11_spec.xml
https://github.com/hippoedit/syntax/blob/master/Assembler/asm68HC11_user.xml

I publish new schemes with a pleasure, but I need to be sure, that it has the best quality ;) And it is completely correct (at least in a way syntax rules may allow).
That is why I always verify schemes before publishing, checking in live examples.

On your example (screenshot):
- everything after ";" is not recognized as a comment
- numbers are not properly highlighted
- you have in scheme {} for comment, but I do not see this in your sample file
- you have in scheme @ for a label, but I do not see it in your sample file

Are example from here (a first match from google for "68hc11 example code"):
http://azug.minpet.unibas.ch/~lukas/68hc11/hc11lib/index.html
Is same assembler you are using?

Here, how it looks with an adapted scheme for 68hc11 assembler I have uploaded to GitHub and plan to add to the repository:
[attachimg=1]

It is still not perfect, 1AA7 shall be also highlighted as a number.

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

the1

Yes i understand.

I wasn't worried about number or comment highlight sorry just main code and syntax. But you have fixed that.

As before there is no standard schema because it depends on what compiler your using unfortunately. The one i use is not published because it's propriety. Here is the manufacturers datasheet for the chip, page 72 on has the syntax, but no standard code layout because it was left to people to use their own compilers.

http://www.nxp.com/assets/documents/data/en/data-sheets/M68HC11E.pdf

alex

OK, I see...

It makes no sense to release to others some syntax schema that they can not use because the compiler is proprietary.
But we can try to release some more generic for 68HC11 and you will do specialization of it, by inheriting the generic schema. If it will work.

Please provide a more extended version of you sample file, with labels and block comments (better with all syntax constructions that may appear) that we can verify if generic scheme fits.
As I wrote, you used @ for defining a label and {} for comments. And I do not know if it was a mistake in a scheme definition, or is a real part of the syntax - then I need to see an example that can validate that it works.

In addition, I have found several keywords that are in the scheme but not in the data sheet you have provided, as:
Code (xml) Select

<Keyword text="ABDA"/>
<Keyword text="ADC A" descr="Add with Carry to A"/>
<Keyword text="ADC B" descr="Add with Carry to B"/>
<Keyword text="ADMMUX1"/>
<Keyword text="ADREAD"/>
<Keyword text="ASL A" descr="Arithmetic Shift Left A"/>
<Keyword text="ASL B" descr="Arithmetic Shift Left B"/>
<Keyword text="ASL D" descr="Arithmetic Shift Left D"/>
<Keyword text="ASR A" descr="Arithmetic Shift Right A"/>
<Keyword text="ASR B" descr="Arithmetic Shift Right B"/>
<Keyword text="DEC A" descr="Decrement Accumulator A"/>
<Keyword text="DEC B" descr="Decrement Accumulator B"/>
<Keyword text="EOR A" descr="Exclusive OR A with Memory"/>
<Keyword text="EOR B" descr="Exclusive OR B with Memory"/>
<Keyword text="LD D"/>
<Keyword text="LD S"/>
<Keyword text="LD X"/>
<Keyword text="LD Y"/>
<Keyword text="LDA A"/>
<Keyword text="LDA B"/>
<Keyword text="LDA D"/>
....

Can you please verify the list of keywords (in updated scheme from me) against of datasheet you have provided and tell, if the list is OK. What is missing, what is incorrect, and where is your personal additions (if they are in). Check if descriptions of instructions are OK - this what will be displayed in auto completion list.
I assume all instructions with spaces inside like "PSH X" etc are alternatives to instructions without space e.g. "PSHX"?

Also, I would like to know, what means are "registers" on the first column. Are they works as labels? While in all other samples I have found, it was a place for labels. Is it required that first "column" is always filled?
And for what means a second column where numbers are used? This actually was a problem for extending the definition of number to support also HEX because I need rules to distinguish it from instruction in the text, e.g. "ADCD".

Let us do it well ;)

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

alex

Hi,

while I did not get any response and clarification from you, I have stripped from the scheme instructions I have not found in the official documentation, comment style with {} and registers and have published the scheme in that way in the on-line repository. Now other users can benefit from it.
http://asm68hc11-editor.hippoedit.com

But to still keep your extension, I have moved them in new "specialized" scheme, which inherits from base ASM68HC11 and extend it with additional styles and keywords. You can find it on GiHub:
https://github.com/hippoedit/syntax/blob/master/Assembler/asm68HC11X_spec.xml
If you want to use it, you need to install base ASM68HC11 and extension. Then you can disable the base scheme in settings to not get it selected/suggested.

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

the1

Yes unfortunately these older processors it was specialized, so it may not be of use to all people using the same processor. Standardization has come along way now with compilers. Im not sure what you really want me to do, i have verified it does what i need it to do so i dont really have anything more to add.

Yes the spaces i added in like PSHX and PSH X was because some of my code can have either. I spaced it in some of my later code for ease of reading.

The reference highlights you can call what you wish that is just what i came up with. Yes the highlighting of things that have the same value is a problem.

When i get time ill have a look at your updated one.

alex

Hi,

for me was important to know, what is a common instruction set/syntax for Freescale 68HC11 and what is an extension for your special case. Because I can only publish most common part.
That was a reason for my questions. I can not be an expert in all syntaxes, so for preparation/validation of syntax scheme, I need someone who has a deep knowledge in the language specification.

But OK, now it is done, I have published the common syntax, hope it is OK.
And, as mentioned, your extensions for common subset of Freescale 68HC11 instructions you can find in "ASM68HC11X" on GitHub.

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]