EdouardBERGE / rasm

RASM powerful Z80 assembler
132 stars 16 forks source link

Non-existent op-code assembles as similar looking op code #32

Closed BitFracture closed 12 months ago

BitFracture commented 12 months ago

I have a program using LD HL,DE (nonexistent in Z80, verified in my favorite source: https://clrhome.org/table/) but it assembles successfully as op code 0x62 or LD H,D. The bad op code is on me, but I don't think the assembler should have accepted it.

RASM v2.1.3 (build xx/10/2023) - Gerieh Yasmana RASM v2.0 (build xx/07/2023) - Blue Hedgehog Windows 11 Intel x64

Does this happen for compatibility reasons and is expected, or is this a problem? Thanks for checking, love the product!

EdouardBERGE commented 12 months ago

you should read the documentation (at least the chapter http://rasm.wikidot.com/syntax:general )

so if you assemble LD HL,DE, the output will be 0x62, 0x6B aka LD H,D : LD D,E and your program is OK

there is many other super instructions, to my concern i like to use 16 bits shifts because it's always a loss of time to remember each method

regards

BitFracture commented 11 months ago

Got it, that is quite helpful to know! Is there a way to disable non-atomic instructions, say, for maximal compatibility?

EdouardBERGE commented 11 months ago

not now, that can be an evolution, i let you propose the name for the command line if you want

cpcitor commented 11 months ago

Here's a suggestion after reading https://github.com/EdouardBERGE/rasm/blob/master/rasm.c#L28520 :

    printf("-zs              only actual Z80 instructions (e.g. no LD HL,DE)\n");

Rationale:

BitFracture commented 11 months ago

That sounds reasonable to me