-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for MASM64 #72
Comments
Hi! It's not something I've explicitly tested for, but the LSP should have limited support for MASM64. Nearly all of the instruction information (used for instruction hover and autocomplete support) is based off of the xml files produced by the opcodes python package, which indicates that MASM instruction names are supported here. I'm really glad you like the project! If you run into any issues or have a feature request in mind, don't hesitate to open up an issue and/or discussion :). |
Yeah, unfortunately the only instruction forms supported by the python opcodes repo are This is something I can look into more once school wraps up, but if there's any relevant resources/ documentation (e.g. the ARM resources listed in this placeholder issue )you could link in the meantime to get started that would be greatly appreciated :). |
Awesome, thanks for creating this repo, really! |
Didn't see anything related to MASM in the xml in the |
I've contributed a few features recently, but the majority of the credit goes to @bergercookie. Really glad it's been helpful for you though :)
That would be great, but no pressure. Thank you! |
Still haven't found a great reference for the opcodes, but we should be able to add partial MASM support by adding the directives specified here: https://learn.microsoft.com/en-us/cpp/assembler/masm/directives-reference?view=msvc-170 |
Hi, from my understanding, opcodes are just the instructions that the ISA has. So shouldn't it be the same for any x8664 assembler? |
I meant to refer to the NASM-style suggestions you asked about in the earlier comments in this issue rather than the opcodes, but misspoke. Sorry about that! 😁 |
https://github.com/HJLebbink/asm-dude |
Thanks so much for the source! It's going to take me some time to work out the parsing code so this information can get loaded in by asm-lsp, but this should be pretty doable. From what I've read through, I'll be able to pull out instructions with descriptions and operands, as well as some assembler directives for MASM and NASM. Just to be clarify, as this isn't my area of expertise, the instruction forms in the file aren't labeled with a particular assembler flavor. For example,
Am I correct in reading that the information here corresponds to MASM/NASM-style suggestions for the |
Hello, glad you liked the source, I am more than happy to help. https://www.felixcloutier.com/x86/ Do you need to parse the instructions into some xml format for asm-lsp to consume? I think the main differences between MASM & NASM is things that are specific to the assemblers themselves like macros and procedure definitions and such but the general x8664 instructions should be the same if I'm not mistaken. |
That's the basic approach yeah. Currently all of our x86/x86-64 instruction info comes from the opcodes python project which we've copied into the repo under To illustrate, we have the following snippet from <Instruction name="XOR" summary="Logical Exclusive OR">
<InstructionForm gas-name="xorb" go-name="XORB">
<Operand type="al" input="true" output="true"/>
<Operand type="imm8"/>
<Encoding>
<Opcode byte="34"/>
<Immediate size="1" value="#1"/>
</Encoding>
</InstructionForm>
<InstructionForm gas-name="xorb" go-name="XORB">
<Operand type="r8" input="true" output="true"/>
<Operand type="imm8"/>
<Encoding>
<Opcode byte="80"/>
<ModRM mode="11" reg="6" rm="#0"/>
<Immediate size="1" value="#1"/>
</Encoding>
</InstructionForm>
Many more instruction forms follow...
</Instruction> After parsing the additional information from asm-dude, we could insert additional
could look like the following after being parsed and inserted into the main xml file <InstructionForm nasm-name="xor" masm-name="xor">
<Operand type="r8" input="true" output="true"/>
<Operand type="imm8"/>
</InstructionForm>
<InstructionForm nasm-name="xor" masm-name="xor">
<Operand type="m8" input="true" output="true"/>
<Operand type="imm8"/>
</InstructionForm> We could then add
👍 Does that sound right? Thanks so much for the help! :) |
Oh also for reference, this is the main asm-dude file to parse: |
Hello,
This lsp is amazing! Does it work for MASM64?
The text was updated successfully, but these errors were encountered: