# Copyright (C) 2014-2015 Ben Kurtovic # 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] return: [0x8F] - if: [a, b|c|d|e] return: [reg(0x88)] - if: [a, h|ih] return: [0x8C] - if: [a, l|il] return: [0x8D] - 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] return: [0x87] - if: [a, b|c|d|e] return: [reg(0x80)] - if: [a, h|ih] return: [0x84] - if: [a, l|il] return: [0x85] - if: [hl|i, bc] return: [0x09] - if: [hl|i, de] return: [0x19] - if: [hl|i, hl|i] return: [0x29] - if: [hl|i, 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] return: [0xA7] - if: [b|c|d|e] return: [reg(0xA0)] - if: [h|ih] return: [0xA4] - if: [l|il] return: [0xA5] - 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] return: [0xCB, bit(0x47)] - if: [bit, 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] return: [0xBF] - if: [b|c|d|e] return: [reg(0xB8)] - if: [h|ih] return: [0xBC] - if: [l|il] return: [0xBD] - 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] return: [0x3D] - if: [b|c|d|e] return: [reg(0x05 0x08)] - if: [h|ih] return: [0x25] - if: [l|il] return: [0x2D] - if: [bc] return: [0x0B] - if: [de] return: [0x1B] - if: [hl|i] return: [0x2B] - if: [sp] return: [0x3B] - 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|i] 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, reg.c] return: [0xED, 0x78] - if: [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] return: [0x3C] - if: [b|c|d|e] return: [reg(0x04 0x08)] - if: [h|ih] return: [0x24] - if: [l|il] return: [0x2C] - if: [bc] return: [0x03] - if: [de] return: [0x13] - if: [hl|i] return: [0x23] - if: [sp] return: [0x33] - 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_hl_or_indexed] cases: - if: [_] 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] return: [0x7F] - if: [a, b|c|d|e] return: [reg(0x78)] - if: [a, h|ih] return: [0x7C] - if: [a, l|il] return: [0x7D] - if: [b, a] return: [0x47] - if: [b, b|c|d|e] return: [reg(0x40)] - if: [b, h|ih] return: [0x44] - if: [b, l|il] return: [0x45] - if: [c, a] return: [0x4F] - if: [c, b|c|d|e] return: [reg(0x48)] - if: [c, h|ih] return: [0x4C] - if: [c, l|il] return: [0x4D] - if: [d, a] return: [0x57] - if: [d, b|c|d|e] return: [reg(0x50)] - if: [d, h|ih] return: [0x54] - if: [d, l|il] return: [0x55] - if: [e, a] return: [0x5F] - if: [e, b|c|d|e] return: [reg(0x58)] - if: [e, h|ih] return: [0x5C] - if: [e, l|il] return: [0x5D] - 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|i] return: [0xF9] - type: [register, immediate] cases: - if: [a, u8] return: [0x3E, u8] - if: [b|c|d|e, u8] return: [reg(0x06 0x08), u8] - if: [h|ih, u8] return: [0x26, u8] - if: [l|il, u8] return: [0x2E, u8] - if: [bc, u16] return: [0x01, u16] - if: [de, u16] return: [0x11, u16] - if: [hl|i, u16] return: [0x21, u16] - if: [sp, u16] return: [0x31, u16] - type: [register, indirect_hl_or_indexed] cases: - if: [a, _] return: [0x7E] - if: [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|i, imm] return: [0x2A, u16] - if: [a, imm] return: [0x3A, u16] - if: [bc, imm] return: [0xED, 0x4B, u16] - if: [de, imm] return: [0xED, 0x5B, u16] - if: [sp, imm] return: [0xED, 0x7B, u16] - type: [indirect_hl_or_indexed, register] cases: - if: [_, a] return: [0x77] - if: [_, 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|i] return: [0x22, u16] - if: [imm, a] return: [0x32, u16] - if: [imm, bc] return: [0xED, 0x43, u16] - if: [imm, de] return: [0xED, 0x53, u16] - if: [imm, sp] return: [0xED, 0x73, 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] return: [0xB7] - if: [b|c|d|e] return: [reg(0xB0)] - if: [h|ih] return: [0xB4] - if: [l|il] return: [0xB5] - 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] return: [0xED, 0x79] - if: [reg.c, 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] return: [0xC1] - if: [de] return: [0xD1] - if: [hl|i] return: [0xE1] - if: [af] return: [0xF1] push: args: yes cases: - type: [register] cases: - if: [bc] return: [0xC5] - if: [de] return: [0xD5] - if: [hl|i] return: [0xE5] - if: [af] return: [0xF5] res: args: yes cases: - type: [immediate, register] cases: - if: [bit, a] return: [0xCB, bit(0x87)] - if: [bit, 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] return: [0xCB, bit(0x87)] - if: [bit, _, 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] return: [0xCB, 0x17] - if: [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] return: [0xCB, 0x17] - if: [_, b|c|d|e|h|l] return: [0xCB, reg(0x10)] rla: args: no return: [0x17] rlc: args: yes cases: - type: [register] cases: - if: [a] return: [0xCB, 0x07] - if: [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] return: [0xCB, 0x07] - if: [_, 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] return: [0xCB, 0x1F] - if: [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] return: [0xCB, 0x1F] - if: [_, b|c|d|e|h|l] return: [0xCB, reg(0x18)] rra: args: no return: [0x1F] rrc: args: yes cases: - type: [register] cases: - if: [a] return: [0xCB, 0x0F] - if: [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] return: [0xCB, 0x0F] - if: [_, 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.0x00] return: [0xC7] - if: [rst.0x08] return: [0xCF] - if: [rst.0x10] return: [0xD7] - if: [rst.0x18] return: [0xDF] - if: [rst.0x20] return: [0xE7] - if: [rst.0x28] return: [0xEF] - if: [rst.0x30] return: [0xF7] - if: [rst.0x38] return: [0xFF] sbc: args: yes cases: - type: [register, register] cases: - if: [a, a] return: [0x9F] - if: [a, b|c|d|e] return: [reg(0x98)] - if: [a, h|ih] return: [0x9C] - if: [a, l|il] return: [0x9D] - 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] return: [0xCB, bit(0xC7)] - if: [bit, 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] return: [0xCB, bit(0xC7)] - if: [bit, _, b|c|d|e|h|l] return: [0xCB, bit(reg(0xC0))] sl1: &sl1 args: yes cases: - type: [register] cases: - if: [a] return: [0xCB, 0x37] - if: [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] return: [0xCB, 0x37] - if: [_, b|c|d|e|h|l] return: [0xCB, reg(0x30)] sla: args: yes cases: - type: [register] cases: - if: [a] return: [0xCB, 0x27] - if: [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] return: [0xCB, 0x27] - if: [_, b|c|d|e|h|l] return: [0xCB, reg(0x20)] sll: *sl1 sls: *sl1 sra: args: yes cases: - type: [register] cases: - if: [a] return: [0xCB, 0x2F] - if: [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] return: [0xCB, 0x2F] - if: [_, b|c|d|e|h|l] return: [0xCB, reg(0x28)] srl: args: yes cases: - type: [register] cases: - if: [a] return: [0xCB, 0x3F] - if: [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] return: [0xCB, 0x3F] - if: [_, b|c|d|e|h|l] return: [0xCB, reg(0x38)] sub: args: yes cases: - type: [register] cases: - if: [a] return: [0x97] - if: [b|c|d|e] return: [reg(0x90)] - if: [h|ih] return: [0x94] - if: [l|il] return: [0x95] - 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] return: [0xAF] - if: [b|c|d|e] return: [reg(0xA8)] - if: [h|ih] return: [0xAC] - if: [l|il] return: [0xAD] - type: [immediate] cases: - if: [u8] return: [0xEE, u8] - type: [indirect_hl_or_indexed] cases: - if: [_] return: [0xAE]