# Z80 assembler specificities Load with "Z80A". Mnemonics having only a single form, such as PUSH and POP, don't have argtype suffixes. Be aware that "SP" and "AF" refer to the same value: some 16- bit ops can affect SP, others, AF. If you use the wrong argu- ment on the wrong op, you will affect the wrong register. # Flow examples IFZ, NOP, ELSE, NOP, THEN, BEGIN, NOP, JR, AGAIN, ( unconditional ) BEGIN, NOP, JRZ, AGAIN, ( conditional ) LSET L1 NOP, L1 BR JRi, ( backward jump ) FJR JRi, TO L1 NOP, L1 FMARK ( forward jump ) # IX+, IY+ IX/IY instructions are a bit complicated. As a general rule, IX and IY are equivalent to spitting an extra $dd / $fd and then spit the equivalent of HL or (HL). In "HL" op types, IX and IY words can be used simply. Examples: IX PUSH, IY POP, IX $1234 LDdi, HL ADDIXd, In "(HL)" op types, all IX/IY words contain displacements and need to be used with IX+ and IY+ prefix words. Examples: 0 IX+ E LDIXY, ( ld e, (ix+0) ) -2 IY+ INC(IXY+), ( inc (iy-2) ) # Instructions list Letters in [] brackets indicate "argtype" variants. When the bracket starts with ",", it means that a "plain" mnemonic is available. For example, "RET," and "RETc," exist. r => A B C D E H L (HL) d => BC DE HL AF/SP c => CNZ CZ CNC CC CPO CPE CP CM i => immediate (i) => memory reference (both 8b and 16b) LD [rr, ri, di, (i)HL, HL(i), d(i), (i)d, rIXY, IXYr, (DE)A, A(DE), (i)A, A(i)] ADD [r, i, HLd, IXd, IXIX, IYd, IYIY] ADC [r, HLd] CP [r, i, (IXY+)] SBC [r, HLd] SUB [r, i] INC [r, d, (IXY+)] DEC [r, d, (IXY+)] AND [r, i] OR [r, i] XOR [r, i] OUT [iA, (C)r] IN [Ai, r(C)] JP [, c, (HL), (IX), (IY)] JR [, Z, NZ, C, NC] CALL[, c] RET [, c] PUSH POP SET RES BIT RL RLC SLA RLA RLCA RR RRC SRL RRA RRCA RST DJNZ DI EI EXDEHL EXX HALT NOP RETI RETN SCF CPI CPIR CPD CPDR IM0 IM1 IM2 INI LDI LDIR LDD LDDR NEG OUTI Macros: SUBHLd Clear carry + SBCHLd PUSHA Push value of A. Destroys BC HLZ Set Z according to HL. Destroys A DEZ Set Z according to DE. Destroys A BCZ Set Z according to BC. Destroys A LDDE(HL) 16-bit LD from (HL) to DE. HL+1 LDBC(HL) 16-bit LD from (HL) to BC. HL+1 LDHL(HL) 16-bit LD from (HL) to HL. Destroys A OUTHL ( port -- ) OUT H, then OUT L. Destroys A OUTDE ( port -- ) OUT D, then OUT E. Destroys A