35 static char *
reg[] = {
"b",
"c",
"d",
"e",
"h",
"l",
"m",
"a" };
36 static char *
rp[] = {
"b",
"d",
"h",
"sp" };
37 static char *
push_rp[] = {
"b",
"d",
"h",
"psw" };
38 static char *
cond[] = {
"nz",
"z",
"nc",
"c",
"po",
"pe",
"p",
"m" };
39 static char *
rst[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7" };
55 { 0x06, 2,
"mvi", { 3, 3, 7,
reg }, { 1 } },
56 { 0xc3, 3,
"jmp", { 2 } },
57 { 0x40, 1,
"mov", { 3, 3, 7,
reg }, { 3, 0, 7,
reg } },
58 { 0x01, 3,
"lxi", { 3, 4, 3,
rp }, { 2 } },
59 { 0x32, 3,
"sta", { 2 } },
60 { 0x3a, 3,
"lda", { 2 } },
61 { 0x2a, 3,
"lhld", { 2 } },
62 { 0x22, 3,
"shld", { 2 } },
63 { 0x0a, 1,
"ldax", { 3, 4, 1,
rp } },
64 { 0x02, 1,
"stax", { 3, 4, 1,
rp } },
68 { 0xc5, 1,
"push", { 3, 4, 3,
push_rp } },
69 { 0xc1, 1,
"pop", { 3, 4, 3,
push_rp } },
70 { 0xdb, 2,
"in", { 1 } },
71 { 0xd3, 2,
"out", { 1 } },
72 { 0x03, 1,
"inx", { 3, 4, 3,
rp } },
73 { 0x0b, 1,
"dcx", { 3, 4, 3,
rp } },
74 { 0x04, 1,
"inr", { 3, 3, 7,
reg } },
75 { 0x05, 1,
"dcr", { 3, 3, 7,
reg } },
76 { 0x09, 1,
"dad", { 3, 4, 3,
rp } },
89 { 0xcd, 3,
"call", { 2 } },
91 { 0xc7, 1,
"rst", { 3, 3, 7,
rst } },
92 { 0xc0, 1,
"r", { 3, 3, 7,
cond } },
93 { 0xc2, 3,
"j", { 3, 3, 7,
cond }, { 2 } },
94 { 0xc4, 3,
"c", { 3, 3, 7,
cond }, { 2 } },
95 { 0x80, 1,
"add", { 3, 0, 7,
reg } },
96 { 0x80|0x46, 2,
"adi", { 1 } },
97 { 0x88, 1,
"adc", { 3, 0, 7,
reg } },
98 { 0x88|0x46, 2,
"aci", { 1 } },
99 { 0x90, 1,
"sub", { 3, 0, 7,
reg } },
100 { 0x90|0x46, 2,
"sui", { 1 } },
101 { 0x98, 1,
"sbb", { 3, 0, 7,
reg } },
102 { 0x98|0x46, 2,
"sbi", { 1 } },
103 { 0xa0, 1,
"ana", { 3, 0, 7,
reg } },
104 { 0xa0|0x46, 2,
"ani", { 1 } },
105 { 0xa8, 1,
"xra", { 3, 0, 7,
reg } },
106 { 0xa8|0x46, 2,
"xri", { 1 } },
107 { 0xb0, 1,
"ora", { 3, 0, 7,
reg } },
108 { 0xb0|0x46, 2,
"ori", { 1 } },
109 { 0xb8, 1,
"cmp", { 3, 0, 7,
reg } },
110 { 0xb8|0x46, 2,
"cpi", { 1 } },
116 if (
arg->type == 3) {
121 else if (
arg->type == 2)
132 int const grp =
cmd &
133 ~((
op->arg1.mask <<
op->arg1.shift) |
134 (
op->arg2.mask <<
op->arg2.shift));
135 int const branch = (grp == 0xc0 || grp == 0xc2 || grp == 0xc4);
136 if (grp ==
op->cmd) {
140 if (
op->arg2.type != 0) strcat(
text, (
branch ?
" " :
", "));
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
static void arg(char *s, int const cmd, struct arg_t const *arg, int val)
static struct opcode_t opcodes[]
static int i8080_disasm(unsigned char const *const code, char *text, int text_sz)