Skip to content

Commit

Permalink
Add support for Z80 IX and IY tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibara committed Apr 4, 2021
1 parent 737062c commit 36d84d9
Show file tree
Hide file tree
Showing 3 changed files with 617 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
d80
===
`d80` is an Intel 8080/Zilog Z80 disassembler.
Supports the entire i80 instruction set and the main, CB, and ED Z80 tables
only (for now).
Supports the entire i80 instruction set and the main, CB, DD, ED, and FD Z80
tables only (for now).

Usage
-----
Expand Down
86 changes: 85 additions & 1 deletion source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,48 @@ static void disz80(ubyte[] b)
case 0xdb:
writef(insnz80[b[a]].s, b[a + 1]);
break;
case 0xdd: /// DD table
switch (b[a + 1]) {
case 0x21:
case 0x22:
case 0x2a:
case 0x36:
writef(insnz80dd[b[a + 1]].s, b[a + 3], b[a + 2]);
a += insnz80dd[b[a + 1]].n;
break;
case 0x26:
case 0x2e:
case 0x34:
case 0x35:
case 0x46:
case 0x4e:
case 0x56:
case 0x5e:
case 0x66:
case 0x6e:
case 0x70:
case 0x71:
case 0x72:
case 0x73:
case 0x74:
case 0x75:
case 0x77:
case 0x7e:
case 0x86:
case 0x8e:
case 0x96:
case 0x9e:
case 0xa6:
case 0xae:
case 0xb6:
case 0xbe:
writef(insnz80dd[b[a + 1]].s, b[a + 2]);
a += insnz80dd[b[a + 1]].n;
break;
default:
writef("%s", insnz80dd[b[a + 1]].s);
}
break;
case 0xed: /// ED table
switch (b[a + 1]) {
case 0x43:
Expand All @@ -54,13 +96,55 @@ static void disz80(ubyte[] b)
case 0x6b:
case 0x73:
case 0x7b:
write(insnz80ed[b[a + 1]].s, b[a + 3], b[a + 2]);
writef(insnz80ed[b[a + 1]].s, b[a + 3], b[a + 2]);
a += insnz80ed[b[a + 1]].n;
break;
default:
writef("%s", insnz80ed[b[a + 1]].s);
}
break;
case 0xfd: /// FD table
switch (b[a + 1]) {
case 0x21:
case 0x22:
case 0x2a:
case 0x36:
writef(insnz80fd[b[a + 1]].s, b[a + 3], b[a + 2]);
a += insnz80fd[b[a + 1]].n;
break;
case 0x26:
case 0x2e:
case 0x34:
case 0x35:
case 0x46:
case 0x4e:
case 0x56:
case 0x5e:
case 0x66:
case 0x6e:
case 0x70:
case 0x71:
case 0x72:
case 0x73:
case 0x74:
case 0x75:
case 0x77:
case 0x7e:
case 0x86:
case 0x8e:
case 0x96:
case 0x9e:
case 0xa6:
case 0xae:
case 0xb6:
case 0xbe:
writef(insnz80fd[b[a + 1]].s, b[a + 2]);
a += insnz80fd[b[a + 1]].n;
break;
default:
writef("%s", insnz80fd[b[a + 1]].s);
}
break;
default:
writef("%s", insnz80[b[a]].s);
if (insnz80[b[a]].n > 1) {
Expand Down
Loading

0 comments on commit 36d84d9

Please sign in to comment.