vhelin / wla-dx

WLA DX - Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
Other
549 stars 98 forks source link

Unknown symbol error could be smarter when missing operand #552

Open jeffythedragonslayer opened 1 year ago

jeffythedragonslayer commented 1 year ago

Here's an enhancement I think would make 65816 easier to learn. I used this tutorial to recreate this:

https://en.wikibooks.org/wiki/Super_NES_Programming/Initialization_Tutorial

Simply add a line like "sep" without any operand. WLA emits this error:

greenspace.asm:18: ERROR: Unknown symbol "sep".

Huh? This is valid mnemonic - WLA does actually understand this symbol - but there is no implied addressing mode for SEP. I think this would be more accurate:

greenspace.asm:18: ERROR: Illegal addressing mode for "sep".

vhelin commented 1 year ago

As a quick 1st stage fix perhaps

greenspace.asm:18: ERROR: Unknown symbol "sep".

could be

greenspace.asm:18: ERROR: Cannot parse "sep". Syntax error?

instead?

jeffythedragonslayer commented 1 year ago

Sure, though nitpick I think the fact that WLA would know there is a newline after it means that it succeeded in parsing the illegal instruction.

vhelin commented 1 year ago

Adding support for more intelligent error report in that case would require additional code to every instruction parser in WLA DX. It wouldn't be difficult to do, but require quite a lot of work. So not a very high priority issue. :)

jeffythedragonslayer commented 1 year ago

I can't just start with the 65816?

vhelin commented 1 year ago

Sure you can, but for the sake of being consistent, in the end all WLA's assmeblers should behave the same way. Anyway, after one assembler supports this then copypasting it to the others shouldn't be a big deal.