|
- # Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
- # Released under the terms of the MIT License. See LICENSE for details.
-
- # *** ASM Instruction Description File ***
-
- # This file is used to generate 'instructions.inc.c'.
-
- # `make` should trigger a rebuild when this file is modified; if not, use:
- # `python scripts/update_asm_instructions.py`.
-
- ---
-
- adc:
- args: yes
- cases:
- - type: [register, register]
- cases:
- - if: [a, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x88)]
- - if: [hl, bc|de|hl|sp]
- return: [0xED, reg(0x4A 0x10)]
- - type: [register, immediate]
- cases:
- - if: [a, u8]
- return: [0xCE, u8]
- - type: [register, indirect_hl_or_indexed]
- cases:
- - if: [a, _]
- return: [0x8E]
-
- add:
- args: yes
- cases:
- - type: [register, register]
- cases:
- - if: [a, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x80)]
- - if: [hl|ixy, bc]
- return: [0x09]
- - if: [hl|ixy, de]
- return: [0x19]
- - if: [hl|ixy, hl|ixy]
- return: [0x29]
- - if: [hl|ixy, sp]
- return: [0x39]
- - type: [register, immediate]
- cases:
- - if: [a, u8]
- return: [0xC6, u8]
- - type: [register, indirect_hl_or_indexed]
- cases:
- - if: [a, _]
- return: [0x86]
-
- and:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0xA0)]
- - type: [immediate]
- cases:
- - if: [u8]
- return: [0xE6, u8]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xA6]
-
- bit:
- args: yes
- cases:
- - type: [immediate, register]
- cases:
- - if: [bit, a|b|c|d|e|h|l]
- return: [0xCB, bit(reg(0x40))]
- - type: [immediate, indirect_hl_or_indexed]
- cases:
- - if: [bit, _]
- return: [0xCB, bit(0x46)]
-
- call:
- args: yes
- cases:
- - type: [immediate]
- cases:
- - if: [u16]
- return: [0xCD, u16]
- - type: [condition, immediate]
- cases:
- - if: [nz|z|nc|c|po|pe|p|m, u16]
- return: [cond(0xC4 0x08), u16]
-
- ccf:
- args: no
- return: [0x3F]
-
- cp:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0xB8)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xBE]
- - type: [immediate]
- cases:
- - if: [u8]
- return: [0xFE, u8]
-
- cpd:
- args: no
- return: [0xED, 0xA9]
-
- cpdr:
- args: no
- return: [0xED, 0xB9]
-
- cpi:
- args: no
- return: [0xED, 0xA1]
-
- cpir:
- args: no
- return: [0xED, 0xB1]
-
- cpl:
- args: no
- return: [0x2F]
-
- daa:
- args: no
- return: [0x27]
-
- dec:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0x05 0x08)]
- - if: [bc|de|hl|ixy|sp]
- return: [reg(0x0B 0x10)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0x35]
-
- di:
- args: no
- return: [0xF3]
-
- djnz:
- args: yes
- cases:
- - type: [immediate]
- cases:
- - if: [rel]
- return: [0x10, rel]
-
- ei:
- args: no
- return: [0xFB]
-
- ex:
- args: yes
- cases:
- - type: [register, register]
- cases:
- - if: [af, af_]
- return: [0x08]
- - if: [de, hl]
- return: [0xEB]
- - type: [indirect, register]
- cases:
- - if: [reg.sp, hl|ixy]
- return: [0xE3]
-
- exx:
- args: no
- return: [0xD9]
-
- halt:
- args: no
- return: [0x76]
-
- im:
- args: yes
- cases:
- - type: [immediate]
- cases:
- - if: [im.0]
- return: [0xED, 0x46]
- - if: [im.1]
- return: [0xED, 0x56]
- - if: [im.2]
- return: [0xED, 0x5E]
-
- in:
- args: yes
- cases:
- - type: [register, port]
- cases:
- - if: [a, imm]
- return: [0xDB, u8]
- - if: [a|b|c|d|e|h|l, reg.c]
- return: [0xED, reg(0x40 0x08)]
- - type: [port]
- cases:
- - if: [reg.c]
- return: [0xED, 0x70]
-
- inc:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0x04 0x08)]
- - if: [bc|de|hl|ixy|sp]
- return: [reg(0x03 0x10)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0x34]
-
- ind:
- args: no
- return: [0xED, 0xAA]
-
- indr:
- args: no
- return: [0xED, 0xBA]
-
- ini:
- args: no
- return: [0xED, 0xA2]
-
- inir:
- args: no
- return: [0xED, 0xB2]
-
- jp:
- args: yes
- cases:
- - type: [immediate]
- cases:
- - if: [u16]
- return: [0xC3, u16]
- - type: [condition, immediate]
- cases:
- - if: [nz|z|nc|c|po|pe|p|m, u16]
- return: [cond(0xC2 0x08), u16]
- - type: [indirect]
- cases:
- - if: [reg.hl|reg.ixy]
- return: [0xE9]
-
- jr:
- args: yes
- cases:
- - type: [immediate]
- cases:
- - if: [rel]
- return: [0x18, rel]
- - type: [condition, immediate]
- cases:
- - if: [nz|z|nc|c, rel]
- return: [cond(0x20 0x08), rel]
-
- ld:
- args: yes
- cases:
- - type: [register, register]
- cases:
- - if: [a, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x78)]
- - if: [b, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x40)]
- - if: [c, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x48)]
- - if: [d, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x50)]
- - if: [e, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x58)]
- - if: [h|ih, a]
- return: [0x67]
- - if: [h|ih, b]
- return: [0x60]
- - if: [h|ih, c]
- return: [0x61]
- - if: [h|ih, d]
- return: [0x62]
- - if: [h|ih, e]
- return: [0x63]
- - if: [h|ih, h|ih]
- return: [0x64]
- - if: [h|ih, l|il]
- return: [0x65]
- - if: [l|il, a]
- return: [0x6F]
- - if: [l|il, b]
- return: [0x68]
- - if: [l|il, c]
- return: [0x69]
- - if: [l|il, d]
- return: [0x6A]
- - if: [l|il, e]
- return: [0x6B]
- - if: [l|il, h|ih]
- return: [0x6C]
- - if: [l|il, l|il]
- return: [0x6D]
- - if: [a, i]
- return: [0xED, 0x57]
- - if: [i, a]
- return: [0xED, 0x47]
- - if: [a, r]
- return: [0xED, 0x5F]
- - if: [r, a]
- return: [0xED, 0x4F]
- - if: [sp, hl|ixy]
- return: [0xF9]
- - type: [register, immediate]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il, u8]
- return: [reg(0x06 0x08), u8]
- - if: [bc|de|hl|ixy|sp, u16]
- return: [reg(0x01 0x10), u16]
- - type: [register, indirect_hl_or_indexed]
- cases:
- - if: [a|b|c|d|e|h|l, _]
- return: [reg(0x46 0x08)]
- - type: [register, indirect]
- cases:
- - if: [a, reg.bc]
- return: [0x0A]
- - if: [a, reg.de]
- return: [0x1A]
- - if: [hl|ixy, imm]
- return: [0x2A, u16]
- - if: [a, imm]
- return: [0x3A, u16]
- - if: [bc|de|sp, imm]
- return: [0xED, reg(0x4B 0x10), u16]
- - type: [indirect_hl_or_indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [reg(0x70)]
- - type: [indirect_hl_or_indexed, immediate]
- cases:
- - if: [_, u8]
- return: [0x36, u8]
- - type: [indirect, register]
- cases:
- - if: [reg.bc, a]
- return: [0x02]
- - if: [reg.de, a]
- return: [0x12]
- - if: [imm, hl|ixy]
- return: [0x22, u16]
- - if: [imm, a]
- return: [0x32, u16]
- - if: [imm, bc|de|sp]
- return: [0xED, reg(0x43 0x10), u16]
-
- ldd:
- args: no
- return: [0xED, 0xA8]
-
- lddr:
- args: no
- return: [0xED, 0xB8]
-
- ldi:
- args: no
- return: [0xED, 0xA0]
-
- ldir:
- args: no
- return: [0xED, 0xB0]
-
- neg:
- args: no
- return: [0xED, 0x44]
-
- nop:
- args: no
- return: [0x00]
-
- or:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0xB0)]
- - type: [immediate]
- cases:
- - if: [u8]
- return: [0xF6, u8]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xB6]
-
- otdr:
- args: no
- return: [0xED, 0xBB]
-
- otir:
- args: no
- return: [0xED, 0xB3]
-
- out:
- args: yes
- cases:
- - type: [port, register]
- cases:
- - if: [imm, a]
- return: [0xD3, u8]
- - if: [reg.c, a|b|c|d|e|h|l]
- return: [0xED, reg(0x41 0x08)]
- - type: [port, immediate]
- cases:
- - if: [reg.c, u8.0]
- return: [0xED, 0x71]
-
- outd:
- args: no
- return: [0xED, 0xAB]
-
- outi:
- args: no
- return: [0xED, 0xA3]
-
- pop:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [bc|de|hl|ixy|af]
- return: [reg(0xC1 0x10)]
-
- push:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [bc|de|hl|ixy|af]
- return: [reg(0xC5 0x10)]
-
- res:
- args: yes
- cases:
- - type: [immediate, register]
- cases:
- - if: [bit, a|b|c|d|e|h|l]
- return: [0xCB, bit(reg(0x80))]
- - type: [immediate, indirect_hl_or_indexed]
- cases:
- - if: [bit, _]
- return: [0xCB, bit(0x86)]
- - type: [immediate, indexed, register]
- cases:
- - if: [bit, _, a|b|c|d|e|h|l]
- return: [0xCB, bit(reg(0x80))]
-
- ret:
- args: yes
- cases:
- - type: []
- return: [0xC9]
- - type: [condition]
- cases:
- - if: [nz|z|nc|c|po|pe|p|m]
- return: [cond(0xC0 0x08)]
-
- reti:
- args: no
- return: [0xED, 0x4D]
-
- retn:
- args: no
- return: [0xED, 0x45]
-
- rl:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x10)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x16]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x10)]
-
- rla:
- args: no
- return: [0x17]
-
- rlc:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x00)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x06]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x00)]
-
- rlca:
- args: no
- return: [0x07]
-
- rld:
- args: no
- return: [0xED, 0x6F]
-
- rr:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x18)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x1E]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x18)]
-
- rra:
- args: no
- return: [0x1F]
-
- rrc:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x08)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x0E]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x08)]
-
- rrca:
- args: no
- return: [0x0F]
-
- rrd:
- args: no
- return: [0xED, 0x67]
-
- rst:
- args: yes
- cases:
- - type: [immediate]
- cases:
- - if: [rst]
- return: [rst(0xC7)]
-
- sbc:
- args: yes
- cases:
- - type: [register, register]
- cases:
- - if: [a, a|b|c|d|e|h|ih|l|il]
- return: [reg(0x98)]
- - if: [hl, bc|de|hl|sp]
- return: [0xED, reg(0x42 0x10)]
- - type: [register, immediate]
- cases:
- - if: [a, u8]
- return: [0xDE, u8]
- - type: [register, indirect_hl_or_indexed]
- cases:
- - if: [a, _]
- return: [0x9E]
-
- scf:
- args: no
- return: [0x37]
-
- set:
- args: yes
- cases:
- - type: [immediate, register]
- cases:
- - if: [bit, a|b|c|d|e|h|l]
- return: [0xCB, bit(reg(0xC0))]
- - type: [immediate, indirect_hl_or_indexed]
- cases:
- - if: [bit, _]
- return: [0xCB, bit(0xC6)]
- - type: [immediate, indexed, register]
- cases:
- - if: [bit, _, a|b|c|d|e|h|l]
- return: [0xCB, bit(reg(0xC0))]
-
- sl1: &sl1
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x30)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x36]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x30)]
-
- sla:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x20)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x26]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x20)]
-
- sll: *sl1
-
- sls: *sl1
-
- sra:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x28)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x2E]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x28)]
-
- srl:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|l]
- return: [0xCB, reg(0x38)]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xCB, 0x3E]
- - type: [indexed, register]
- cases:
- - if: [_, a|b|c|d|e|h|l]
- return: [0xCB, reg(0x38)]
-
- sub:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0x90)]
- - type: [immediate]
- cases:
- - if: [u8]
- return: [0xD6, u8]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0x96]
-
- xor:
- args: yes
- cases:
- - type: [register]
- cases:
- - if: [a|b|c|d|e|h|ih|l|il]
- return: [reg(0xA8)]
- - type: [immediate]
- cases:
- - if: [u8]
- return: [0xEE, u8]
- - type: [indirect_hl_or_indexed]
- cases:
- - if: [_]
- return: [0xAE]
|