In general, Sjasm follows the original Zilog notation for the instructions.
Differences with Z80 mnemonics:
As you probably know the Z80 recognizes more instructions than just the official ones. Sjasm recognizes all undocumented instructions, so you can use:
For some reason the designers of the R800 did not implement all of the Z80 instructions. Because of this none of the undocumented instructions of the Z80 work on the R800, except the use of the ixl, ixh, iyl and iyh registers.
Sjasm does not understand the official R800 mnemonics, so you should use the corresponding Z80 ones. MULUB and MULUW are of course recognized.
In the best Sjasm tradition, in addition to the real undocumented instructions some fake extended instructions have been added.
In all places where a 16 bit register pair is used as an indirection, you can add a ++ increment or a -- decrement operator. There should be no space between the register and the operator. Both pre and post increment and decrement are supported.
Examples:
ld a,(hl++) ; ld a,(hl)\ inc hl ld a,(++bc) ; inc bc\ ld a,(bc) ld (iy++ +5),b ; ld (iy+5),b\ inc iy add a,(--ix) ; dec ix\ add a,(ix+0) bit 1,(hl--) ; bit 1,(hl)\ dec hl
This does not work with the stack pointer, so EX (SP++),HL does not work.
The jump instructions have also been 'improved'. If you use DJNZ. (with dot) instead of DJNZ, Sjasm will use DEC B\ JP NZ,x if the jump target is out of range. Similarly, JP. and JR. use JR where possible, and JP if not.
You can inverse the condition used by conditional jumps and calls with the exclamation mark (!):
call !c, DoTheWork ; call nc, DoTheWork jp !pe, Oops ; jp po, Oops jr !nc, .loop ; jr c, .loop
This makes it easier to create conditional macros:
macro addc cond, reg, this jr !cond,.skip add reg, this .skip endmacro
with this macro
addc nc, hl, de
expands to:
jr c,.skip add hl,de .skip
Add more information - like all recognized instructions - here :)