use crate::tables::*;

pub const MODRMBYTE: &[(u8, &'static str)] = 
&[
	(0x00, "add"),
	(0x01, "add"),
	(0x02, "add"),
	(0x03, "add"),
	(0x08, "or"),
	(0x09, "or"),
	(0x0a, "or"),
	(0x0b, "or"),
	(0x10, "adc"),
	(0x11, "adc"),
	(0x12, "adc"),
	(0x13, "adc"),
	(0x18, "sbb"),
	(0x19, "sbb"),
	(0x1a, "sbb"),
	(0x1b, "sbb"),
	(0x20, "and"),
	(0x21, "and"),
	(0x22, "and"),
	(0x23, "and"),
	(0x28, "sub"),
	(0x29, "sub"),
	(0x2a, "sub"),
	(0x2b, "sub"),
	(0x30, "xor"),
	(0x31, "xor"),
	(0x32, "xor"),
	(0x33, "xor"),
	(0x38, "cmp"),
	(0x39, "cmp"),
	(0x3a, "cmp"),
	(0x3b, "cmp"),
	(0x62, "bound"),
	(0x63, "arpl"),
	(0x84, "test"),
	(0x85, "test"),
	(0x86, "xchg"),
	(0x87, "xchg"),
	(0x88, "mov"),
	(0x89, "mov"),
	(0x8a, "mov"),
	(0x8b, "mov"),
	(0x8d, "lea")
];
pub const MODRMBYTE_0F: &[(u8, u8, &'static str, Option<u8>, Option<u8>, bool, bool)] = 
&[	
//  op     str     d    s             imm    one-o
	(0x02, 0xff, "lar", None, Some(X16_32), false, false),
	(0x03, 0xff, "lsl", None, Some(X16_32), false, false),
	(0x0d, 0xff, "nop", None, Some(X16_32), false, true),
	(0x20, 0xff, "mov", Some(REG_MEM), Some(X16_32), false, true),
	(0x21, 0xff, "mov", Some(REG_MEM), Some(X16_32), false, true),
	(0x22, 0xff, "mov", Some(REG_MEM), Some(X16_32), false, true),
	(0x23, 0xff, "mov", Some(REG_MEM), Some(X16_32), false, true),
	(0x38, 0xf0, "movbe", Some(REG_MEM), Some(X16_32), false, false),
	(0x38, 0xf1, "movbe", Some(MEM_REG), Some(X16_32), false, false),
	(0x40, 0xff, "cmovo", None, Some(X16_32), false, false),
	(0x41, 0xff, "cmovno", None, Some(X16_32), false, false),
	(0x42, 0xff, "cmovb", None, Some(X16_32), false, false),
	(0x43, 0xff, "cmovnb", None, Some(X16_32), false, false),
	(0x44, 0xff, "cmovz", None, Some(X16_32), false, false),
	(0x45, 0xff, "cmovnz", None, Some(X16_32), false, false),
	(0x46, 0xff, "cmovbe", None, Some(X16_32), false, false),
	(0x47, 0xff, "cmovbne", None, Some(X16_32), false, false),
	(0x48, 0xff, "cmovs", None, Some(X16_32), false, false),
	(0x49, 0xff, "cmovns", None, Some(X16_32), false, false),
	(0x4a, 0xff, "cmovp", None, Some(X16_32), false, false),
	(0x4b, 0xff, "cmovnp", None, Some(X16_32), false, false),
	(0x4c, 0xff, "cmovl", None, Some(X16_32), false, false),
	(0x4d, 0xff, "cmovnl", None, Some(X16_32), false, false),
	(0x4e, 0xff, "cmovle", None, Some(X16_32), false, false),
	(0x4f, 0xff, "cmovnle", None, Some(X16_32), false, false),
	(0x90, 0xff, "seto", Some(REG_MEM), Some(X8), false, true),
	(0x91, 0xff, "setno", Some(REG_MEM), Some(X8), false, true),
	(0x92, 0xff, "setb", Some(REG_MEM), Some(X8), false, true),
	(0x93, 0xff, "setnb", Some(REG_MEM), Some(X8), false, true),
	(0x94, 0xff, "setz", Some(REG_MEM), Some(X8), false, true),
	(0x95, 0xff, "setnz", Some(REG_MEM), Some(X8), false, true),
	(0x96, 0xff, "setbe", Some(REG_MEM), Some(X8), false, true),
	(0x97, 0xff, "setnbe", Some(REG_MEM), Some(X8), false, true),
	(0x98, 0xff, "sets", Some(REG_MEM), Some(X8), false, true),
	(0x99, 0xff, "setns", Some(REG_MEM), Some(X8), false, true),
	(0x9a, 0xff, "setp", Some(REG_MEM), Some(X8), false, true),
	(0x9b, 0xff, "setnp", Some(REG_MEM), Some(X8), false, true),
	(0x9c, 0xff, "setl", Some(REG_MEM), Some(X8), false, true),
	(0x9d, 0xff, "setnl", Some(REG_MEM), Some(X8), false, true),
	(0x9e, 0xff, "setle", Some(REG_MEM), Some(X8), false, true),
	(0x9f, 0xff, "setnle", Some(REG_MEM), Some(X8), false, true),
	(0xa3, 0xff, "bt", Some(MEM_REG), Some(X16_32), false, false),
	(0xa4, 0xff, "shld", Some(MEM_REG), Some(X16_32), false, false),
	(0xa5, 0xff, "shld", Some(MEM_REG), Some(X16_32), false, false),
	(0xac, 0xff, "shld", Some(MEM_REG), Some(X16_32), false, false),
	(0xad, 0xff, "shld", Some(MEM_REG), Some(X16_32), false, false),
	(0xab, 0xff, "bts", Some(MEM_REG), Some(X16_32), false, false),
	(0xaf, 0xff, "imul", Some(REG_MEM), Some(X16_32), false, false),
	(0xb0, 0xff, "cmpxchg", Some(MEM_REG), Some(X8), false, false),
	(0xb1, 0xff, "cmpxchg", Some(MEM_REG), Some(X16_32), false, false),
	(0xb2, 0xff, "lss", Some(REG_MEM), Some(X16_32), false, false),
	(0xb3, 0xff, "btr", Some(MEM_REG), Some(X16_32), false, false),
	(0xb4, 0xff, "lfs", Some(REG_MEM), Some(X16_32), false, false),
	(0xb5, 0xff, "lgs", Some(REG_MEM), Some(X16_32), false, false),
	(0xb6, 0xff, "movzx", Some(REG_MEM), Some(X8), false, false),
	(0xb7, 0xff, "movzx", Some(REG_MEM), Some(X16_32), false, false),
	(0xb8, 0xff, "popcnt", Some(REG_MEM), Some(X16_32), false, false),
	(0xbb, 0xff, "btc", Some(MEM_REG), Some(X16_32), false, false),
	(0xbc, 0xff, "bsf", Some(REG_MEM), Some(X16_32), false, false),
	(0xbd, 0xff, "bsr", Some(REG_MEM), Some(X16_32), false, false),
	(0xbe, 0xff, "movsx", Some(REG_MEM), Some(X8), false, false),
	(0xbf, 0xff, "movsx", Some(REG_MEM), Some(X8), false, false),
	(0xc0, 0xff, "xadd", Some(MEM_REG), Some(X8), false, false),
	(0xc1, 0xff, "xadd", Some(MEM_REG), Some(X16_32), false, false),
	(0xc8, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xc9, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xca, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xcb, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xcc, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xcd, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xce, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true),
	(0xcf, 0xff, "bswap", Some(MEM_REG), Some(X16_32), false, true)
];