Testing sdasz80 for how Z80N codes are generated, I've observed:
1) ldws is not implemented, an error is reported.
2) using mirror without parameters crashes the assembler (mirror a is OK)
3) there's an implementation of mirror de which doesn't exist in Z80N anymore
4) ldirscale doesn't exist anymore
Removing 3 and 4 won't have any impact. I expect that I can very easily fix both 1) and 2) and that fixing them will also have no impact to the existing regression tests (as they are clearly not used by them). I can submit one patch for all 4 soon, it shouldn't be hard.
as a reference, this source contains all the Z80N codes that exist now, and it hasn't changed since 2019:
https://github.com/z00m128/sjasmplus/blob/master/tests/z80n/op_zx_spectrum_next_2_00_26.asm
This fixes all 4 issues:
Attached in the .zip: this .diff and the .asm from the previous link adapted to sdasz80 syntax.
Edit: updated to use 0xA5 constant (and not 0xa5), consistent to all other capitalized.
Last edit: Janko Stamenović 2025-01-23
Attached: a script to test the encodings from testallz80n.asm from the previous.
Looks okay to me (though I'd suggest to make
mirrorwithout an operand give an aerr()-error instead of silently giving it the semantics ofmirror a, since there is another Z80-derivative that has amirror r-like instruction, but I do not have a strong opinion on this).I've kept it only because, if I understand, that other assembler accepts it without the explicit A and using that example source induced the crash where I started too look for the cause. I also understood that sdasz80 has these modes, i.e.
.zxnand my understanding is that it's only the handling ofX_ZXN_MIRRORthat I've impacted. If that helps SDCC elsewhere I can definitely put that explicit requirement of an operand.Edit: I also haven't studied the exact cause of the crash: why exactly
mirrorwithout a parameter crashed and some other instructions also don't checkmorebefore they use similar constructs, even if the syntax is practically AFAIK == what thatmachinefunction implements.Last edit: Janko Stamenović 2025-01-27
So I suggest to leave out the part about
mirrorfor now, and only put the changes for the other instructions into the next branch (or trunk after the SDCC 4.5.0 release).I fully agree. The only change that a potential user could see in 4.5.0 (minus the Win x64 crash which is anyway much less specific, now I understand that) would be an absence of
ldwsbut that never prevented any hypothetical use case because it can be implemented with an assembler macro too.I still see an error trying to use
ldwsin current trunk.