Author Topic: Apply Keyword to first byte only  (Read 838 times)

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Apply Keyword to first byte only
« on: February 15, 2017, 08:56:22 am »
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?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #1 on: February 15, 2017, 10:42:42 am »
Hi the1,

try this
Code: XML
  1. <Style name="Registers" image="13" bold="0" italic="0" underline="0" clr="Keyword3" bkclr="#FFFFFFFF">
  2.   <Keywords lead="$">
  3.     <Keyword text="1A"/>
  4.     ....
  5.   </Keywords>
  6. </Style>
  7.  
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

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Apply Keyword to first byte only
« Reply #2 on: February 15, 2017, 10:06:01 pm »
Hi Alex, Thanks for that, it works a treat, ive attached the file for submission a free licence would be handy :)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #3 on: February 16, 2017, 01:43:12 am »
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.

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Apply Keyword to first byte only
« Reply #4 on: February 16, 2017, 02:08:29 am »
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #5 on: February 17, 2017, 01:54:20 am »
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.

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Apply Keyword to first byte only
« Reply #6 on: February 17, 2017, 04:16:04 am »
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.

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Apply Keyword to first byte only
« Reply #7 on: February 17, 2017, 04:18:25 am »
it's working fine for me?


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #8 on: February 17, 2017, 07:03:21 pm »
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:


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

BR, Alex.
« Last Edit: February 17, 2017, 07:10:26 pm by alex »

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Apply Keyword to first byte only
« Reply #9 on: February 20, 2017, 12:37:32 am »
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

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #10 on: February 20, 2017, 11:42:38 am »
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
  1. <Keyword text="ABDA"/>
  2. <Keyword text="ADC A" descr="Add with Carry to A"/>
  3. <Keyword text="ADC B" descr="Add with Carry to B"/>
  4. <Keyword text="ADMMUX1"/>
  5. <Keyword text="ADREAD"/>
  6. <Keyword text="ASL A" descr="Arithmetic Shift Left A"/>
  7. <Keyword text="ASL B" descr="Arithmetic Shift Left B"/>
  8. <Keyword text="ASL D" descr="Arithmetic Shift Left D"/>
  9. <Keyword text="ASR A" descr="Arithmetic Shift Right A"/>
  10. <Keyword text="ASR B" descr="Arithmetic Shift Right B"/>
  11. <Keyword text="DEC A" descr="Decrement Accumulator A"/>
  12. <Keyword text="DEC B" descr="Decrement Accumulator B"/>
  13. <Keyword text="EOR A" descr="Exclusive OR A with Memory"/>
  14. <Keyword text="EOR B" descr="Exclusive OR B with Memory"/>
  15. <Keyword text="LD D"/>
  16. <Keyword text="LD S"/>
  17. <Keyword text="LD X"/>
  18. <Keyword text="LD Y"/>
  19. <Keyword text="LDA A"/>
  20. <Keyword text="LDA B"/>
  21. <Keyword text="LDA D"/>
  22. ....
  23.  
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #11 on: March 15, 2017, 12:53:53 am »
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.

Offline the1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Apply Keyword to first byte only
« Reply #12 on: March 15, 2017, 02:16:17 am »
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2162
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Apply Keyword to first byte only
« Reply #13 on: March 15, 2017, 10:29:09 am »
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.

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
2831 Views
Last post December 11, 2008, 09:16:37 am
by Stefan
1 Replies
2097 Views
Last post April 04, 2013, 05:24:47 pm
by alex
1 Replies
780 Views
Last post May 14, 2015, 11:25:41 pm
by alex