Assembly quick reference
Numbers: &C000 hex (also #C000, 0xC000), %10110000 binary, 42 decimal, 'A' character. $ alone means the current address. Operators +, -, *; HI(x) and LO(x) split an address into bytes.
LD A,&FF
LD HL,&C000
LD (HL),A
LD A,(IX+5)
LD (IY-2),B
ADD A,C / ADC A,(HL)
INC HL / DEC (IX+1)
BIT 7,(HL) / SET 3,A
RLCA / SLA B / SLL CJP NZ,label
JR C,label / DJNZ label
CALL label / RET PE
PUSH IX / POP AF
EX DE,HL / EX AF,AF'
EXX / LDIR / CPIR
OUT (&7F),A / IN A,(&FF)
IM 1 / EI / DI / HALT
ORG · DEFB · DEFW · DEFS · DEFM · EQU
A label named DONE gets a debugger breakpoint automatically. Execution starts at the first ORG.
Model & limitations
Instruction-level emulation: each instruction completes in one go, then the clock advances by that instruction's time. All five opcode tables are implemented — unprefixed, CB, ED, DD/FD and DDCB/FDCB — along with the undocumented parts a real NMOS Z80A has anyway: the IXH IXL IYH IYL half-registers, SLL, the ED duplicates, the DDCB forms that also copy into a register, and bits 3 and 5 of F, including the internal WZ register that BIT n,(HL) takes them from.
The Gate Array rounds every instruction up to a whole microsecond, which is why Amstrad published its timings that way. It really stretches each machine cycle to a four-cycle slot, not the instruction as a whole, so instructions containing a long machine cycle — RST, PUSH, RET cc, DJNZ, INC rr, EX (SP),HL, the block moves — run one microsecond faster here than on hardware. Machine cycles are not modelled individually.
Video: three modes, the 27-colour hardware palette through 32 slots, 16 pens and a border, the interleaved screen layout, and CRTC registers R1, R6, R12 and R13 — enough for the screen base and hardware scrolling. The palette, border and mode are latched per scanline, so a mid-frame change draws a real split. No sprites exist on a CPC and none are invented here.
Interrupts arrive 300 times a second, every 52 scanlines, as on hardware. IM 0 behaves as RST &38. IM 2 builds its vector from I and a byte from the data bus; what the Gate Array actually drives there during an interrupt acknowledge is not something this page can state with confidence, so it uses &FF — an assumption, not a measurement.
No AY-3-8912, no keyboard, no disc or tape, and no Amstrad or Locomotive ROM: those are copyright, so there is no firmware to CALL &BB5A into, and the character set is original artwork rather than the Amstrad character ROM. The 464's flat 64 KB is all there is; the 6128's banking is not modelled.
Reset leaves the stack pointer at &C000, just below the screen, because there is no firmware here to set one up and a Z80's own reset value of &FFFF would push straight into screen memory. The power-on palette is this page's choice for the same reason.
Keyboard: Space run/pause, S step, B back, R reset. Shortcuts are inactive inside controls. Back undoes up to 512 instructions.