XL2S Entertainment

Z80 Assembly syntax

Undocumented instructions
R800 CPU
Extended instructions
Z80 instruction set

In general Sjasm follows the original Zilog notation for the instructions.

Differences with Z80 mnemonics:

Undocumented instructions

As you probably know the Z80 recognizes more instructions than just the official ones. Sjasm recognizes all undocumented instructions, so you can use:

R800 CPU

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.

Extended instructions

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.

Some 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.

Z80 instruction set

Copyright 2009 XL2S Entertainment