Opcodes

Opcodes are the basic instructions run by the CPU.

Mnemonics

In assembly, instructions are written as small acronyms, called mnemonics. For example, ADC stands for Add with Carry, and a full command would be ADC %11,%15.

Duplicate Opcodes

It’s worthwhile to note that there are multiple opcodes tied to each mnemonic. This is because something we would consider the same instruction is often several different instructions.

For example: ADD %01,%02 is a different opcode from ADD %01,#%15 because one adds two registers, while the other adds a number to a register. Since the CPU just sees a bunch of numbers, it has to know what you want it to do.

Duplicate Mnemonics

When there are multiple mnemonics applied to the same hex, the situation is a little different. For example, BIT is a command that changes an individual bit to whatever you want. BSET and BCLR use the same HEX, because they are just hardcoded to set the bit to 0 or 1.

Most instructions are 1 byte long, not including operands. However, if you start an instruction with 1Fh, it allows you to use one of the 2-byte instructions. 1F70h, for example, is PUSH using an Immediate Value.

Cpu Instruction Table

This table lists all the instructions and their corresponding mnemonics in alphabetical order.

Mnemonic Description Hex
ADC Add with Carry 12h, 13h, 14h, 15h, 16h, 17h
ADCX Add with Carry (Extended Addressing) 18h, 19h
ADD Add 02h, 03h, 04h, 05h, 06h, 07h
ADDX Add (Extended Addressing) 08h, 09h
AND Logical AND 52h, 53h, 54h, 55h, 56h, 57h
ANDX Logical AND (Extended Addressing) 58h, 59h
ATM Atomic Execution for 3 instructions. 2Fh
BCLR Bit Clear E2h
BIT Bit Set/Clear E2h
BRK Debugger Break 00h
BSET Bit Set E2h
BSWAP Bit Swap (7:0 becomes 0:7) D5h
BTJ Bit Test and Jump F6h, F7h
BTJNZ Bit Test and Jump if 1 F6h, F7h
BTJZ Bit Test and Jump if 0 F6h, F7h
CALL Call Function (Return with RET) D4h
CCF Complement Carry Flag (NOT Carry) EFh
CLR Clear Register (Set to 0) B0h, B1h
COM Complement (NOT) 60h, 61h
CP Compare (Changes C,Z,S,V Flags) A2h, A3h, A4h, A5h, A6h, A7h
CPC Compare w/ Carry 1FA2h, 1FA3h, 1FA4h, 1FA5, 1FA6h, 1FA7
CPCX Compare w/ Carry (Extended Addressing) 1FA8h, 1FA9h
CPX Compare (Extended Addressing) A8h,A9h
DA Decimal Adjust (Converts register to decimal) 40h, 41h
DEC Decrement Register 30h, 31h
DECW Decrement Word 80h, 81h
DI Disable Interrupts 8Fh
DJNZ Decrement and jump if not zero *Ah
EI Enable Interrupts 9Fh
HALT Enter HALT mode 7Fh
INC Increment Register 20h, 21h
INCW Increment Word A0h, A1h
IRET Return from interrupt BFh
JP Jump (test condition code if present) C4h, *Dh, * is cc
JR Jump, relative to position *Bh, * is cc
LD Load to register E3h, E4h, E5h, E6h, E7h, F3h, F5h
LDC Load to/from program mem C2h, D2h
LDCI Load to/from program mem and increment the addresses used C3h, D3h
LDE Load to/from External mem 82h, 92h
LDEI Load to/from External mem and increment the addresses used 83h, 93h
LDWX Load Word (Extended Addressing) 1FE8h
LDX Load to Reg (Extended Addressing) E8h, E9h
LEA Load Effective Address 98h, 99h
MULT Multiply Register Pair, store back F4h
NOP Do nothing 0Fh
OR Logical OR 42h, 43h, 44h, 45h, 46h, 47h
ORX Logical OR (Extended Addressing) 48h, 49h
POP Pop value from the stack 50h, 51h
POPX Pop value from the stack (Extended Addressing) D8h
PUSH Push value to the stack 70h, 71h, 1F70h
PUSHX Push value to the stack (Extended Addressing) C8h
RCF Reset the Carry Flag CFh
RET Return from CALL AFh
RL Rotate Left 90h, 91h
RLC Rotate Left with Carry 10h, 11h
RR Rotate Right E0h, E1h
RRC Rotate Right with Carry C0h, C1h
SBC Subtract with Carry 32h, 33h, 34h, 35h, 36h, 37h
SBCX Subtract with Carry (Extended Addressing) 38h, 39h
SCF Set Carry Flag DFh
SRA Shift Right Arithmetic (Keeps Sign) D0h, D1h
SRL Shift Right Logical (Shifts Sign) 1FC0h, 1FC1h
SRP Set Register Pointer (Choose working registers) 01h
STOP Enter STOP mode 6Fh
SUB Subtract 22h, 23h, 24h, 25h, 26h, 27h
SUBX Subtract (Extended Addressing) 28h, 29h
SWAP Swap nybbles (7:4 and 3:0) F0h, F1h
TCM Test Complement under Mask 62h, 63h, 64h, 65h, 66h, 67h
TCMX Test Complement under Mask (Extended Addressing) 68h, 69h
TM Test under Mask 72h, 73h, 74h, 75h, 76h, 77h
TMX Test under Mask (Extended Addressing) 78h, 79h
TRAP Software TRAP F2h
WDT Refresh Watchdog Timer 5Fh
XOR Logical Exclusive OR B2h, B3h, B4h, B5h, B6h, B7h
XORX Logical Exclusive OR (Extended Addressing) B8h, B9h

Please submit corrections, suggestions, and new documentation here: Submit a ticket
← Return to Reference Index
This is not an official Zilog website. Zilog nor 8times8 are liable for any damage done to equipment. Tutorial and reference copyright ©8times8 Creative Commons CC-0 License (public domain.) This reference uses content from Zilog's technical datasheets. Fair use only. Datasheets copyright © 2013 Zilog®, Inc. Z8, Z8 Encore!, Z8 Encore! XP and Z8 Encore! MC are trademarks or registered trademarks of Zilog, Inc. Read Zilog's terms at zilog.com

Website design by Koen van Vliet. Hosted by sourceforge.net