Digital Research
This commit is contained in:
2020-11-06 18:50:37 +01:00
parent 621ed8ccaf
commit 31738079c4
8481 changed files with 1888323 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
$title('tables for ddt86 assembler')
$date(6/15/81)
asmtab: do;
$nolist
$include(optab.lit)
$list
declare op$tab (*) byte public data (
aaa$in, 1, 037h, 0,
aad$in, 2, 0d5h, 0ah,
aam$in, 2, 0d4h, 0ah,
aas$in, 1, 03fh, 0,
adc$in, 9, 10h, 2,
add$in, 9, 0, 0,
and$in, 10, 20h, 4,
call$in, 11, 0, 0,
callf$in, 17, 0, 0,
cbw$in, 1, 098h, 0,
clc$in, 1, 0f8h, 0,
cld$in, 1, 0fch, 0,
cli$in, 1, 0fah, 0,
cmc$in, 1, 0f5h, 0,
cmp$in, 9, 38h, 7,
cmpsb$in, 1, 0a6h, 0,
cmpsw$in, 1, 0a7h, 0,
cwd$in, 1, 099h, 0,
daa$in, 1, 027h, 0,
das$in, 1, 02fh, 0,
dec$in, 7, 0, 0,
div$in, 5, 0f6h, 6,
esc$in, 13, 0d8h, 0,
hlt$in, 1, 0f4h, 0,
idiv$in, 5, 0f6h, 7,
imul$in, 5, 0f6h, 5,
in$in, 15, 0e4h, 0,
inc$in, 7, 1, 0,
int$in, 12, 0, 0,
into$in, 1, 0ceh, 0,
iret$in, 1, 0cfh, 0,
ja$in, 3, 077h, 0,
jae$in, 3, 073h, 0,
jb$in, 3, 072h, 0,
jbe$in, 3, 076h, 0,
jc$in, 3, 072h, 0,
jcxz$in, 3, 0e3h, 0,
je$in, 3, 074h, 0,
jg$in, 3, 07fh, 0,
jge$in, 3, 07dh, 0,
jl$in, 3, 07ch, 0,
jle$in, 3, 07eh, 0,
jmp$in, 11, 1, 0,
jmpf$in, 17, 1, 0,
jmps$in, 3, 0ebh, 0,
jna$in, 3, 076h, 0,
jnae$in, 3, 072h, 0,
jnb$in, 3, 073h, 0,
jnbe$in, 3, 077h, 0,
jnc$in, 3, 073h, 0,
jne$in, 3, 075h, 0,
jng$in, 3, 07eh, 0,
jnge$in, 3, 07ch, 0,
jnl$in, 3, 07dh, 0,
jnle$in, 3, 07fh, 0,
jno$in, 3, 071h, 0,
jnp$in, 3, 07bh, 0,
jns$in, 3, 079h, 0,
jnz$in, 3, 075h, 0,
jo$in, 3, 070h, 0,
jp$in, 3, 07ah, 0,
jpe$in, 3, 07ah, 0,
jpo$in, 3, 07bh, 0,
js$in, 3, 078h, 0,
jz$in, 3, 074h, 0,
lahf$in, 1, 09fh, 0,
lds$in, 6, 0c5h, 0,
lea$in, 6, 08dh, 0,
les$in, 6, 0c4h, 0,
lock$in, 0ffh, 0f0h, 0,
lodsb$in, 1, 0ach, 0,
lodsw$in, 1, 0adh, 0,
loop$in, 3, 0e2h, 0,
loope$in, 3, 0e1h, 0,
loopne$in, 3, 0e0h, 0,
loopnz$in, 3, 0e0h, 0,
loopz$in, 3, 0e1h, 0,
mov$in, 20, 0, 0,
movsb$in, 1, 0a4h, 0,
movsw$in, 1, 0a5h, 0,
mul$in, 5, 0f6h, 4,
neg$in, 5, 0f6h, 3,
nop$in, 1, 090h, 0,
not$in, 5, 0f6h, 2,
or$in, 10, 8, 1,
out$in, 16, 0e6h, 0,
pop$in, 21, 0, 0,
popf$in, 1, 09dh, 0,
push$in, 8, 1, 0,
pushf$in, 1, 09ch, 0,
rcl$in, 4, 0d0h, 2,
rcr$in, 4, 0d0h, 3,
rep$in, 0feh, 0f3h, 0,
repe$in, 0feh, 0f3h, 0,
repne$in, 0feh, 0f2h, 0,
repnz$in, 0feh, 0f2h, 0,
repz$in, 0feh, 0f3h, 0,
ret$in, 14, 0c2h, 0,
retf$in, 14, 0cah, 0,
rol$in, 4, 0d0h, 0,
ror$in, 4, 0d0h, 1,
sahf$in, 1, 09eh, 0,
sal$in, 4, 0d0h, 4,
sar$in, 4, 0d0h, 7,
sbb$in, 9, 18h, 3,
scasb$in, 1, 0aeh, 0,
scasw$in, 1, 0afh, 0,
shl$in, 4, 0d0h, 4,
shr$in, 4, 0d0h, 5,
stc$in, 1, 0f9h, 0,
std$in, 1, 0fdh, 0,
sti$in, 1, 0fbh, 0,
stosb$in, 1, 0aah, 0,
stosw$in, 1, 0abh, 0,
sub$in, 9, 28h, 5,
test$in, 18, 0, 0,
wait$in, 1, 09bh, 0,
xchg$in, 19, 0, 0,
xlat$in, 1, 0d7h, 0,
xor$in, 10, 30h, 6
);
end asm$tab;


File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
;
; interface module for ddt86
; 6/15/81
;
dgroup group dats
dats segment public 'DATS'
db '?'
dats ends
;
cgroup group code
extrn asm:near
public ddtgetline
public goddt
public ddtset
;
code segment public 'CODE'
assume cs:cgroup
;
assent proc
org 2300h
jmp asm
assent endp
;
ddtgetline proc
jmp $-21fah
ddtgetline endp
;
goddt proc
jmp $-21fah
goddt endp
;
ddtset proc
jmp $-21fah
ddtset endp
;
code ends
end


File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
;
;create ddt86.cmd, on micro using ISIS interface
;
pli gentab $$d
link gentab
gentab op86.dat
;
is14
plm86 ins86.plm debug pagewidth(100) xref
plm86 dis86.plm debug pagewidth(100) xref
asm86 dislnk86.asm debug
link86 dislnk86.obj, dis86.obj, ins86.obj,plm86.lib to dis86.lnk
loc86 dis86.lnk to dis86.abs ad(sm(dats(0),code(0h))) od(sm(dats,code,const,data))
oh86 dis86.abs to dis86.h86
;
plm86 ass86.plm debug xref pagewidth(100)
plm86 asmtab.plm debug xref pagewidth(100)
asm86 asslnk86.asm debug
link86 asslnk86.obj, asmtab.obj, ass86.obj, po(dis86.abs), plm86.lib to ass86.lnk
loc86 ass86.lnk to ass86.abs ad(sm(dats(0),code(0h))) od(sm(dats,code,const,data))
oh86 ass86.abs to ass86.h86
;
cpm
asm86 ddt86 $$fi
pip ddt86.h86 = ddt86.h86, dis86.h86, ass86.h86
; the value for the minimum code group required comes from the start of
; the ??seg as listed in ass86.mp2
gencmd ddt86 8080 code[m366]


View File

@@ -0,0 +1,596 @@
$title('8086 disassembler')
$date(5/14/81)
$compact
$optimize(2)
disem86: do;
declare
cr literally '0dh',
lf literally '0ah',
true literally '1',
false literally '0';
$include(optab.dat)
declare
tab$ptrs (5) address public initial (.ops2, .ops3, .ops4, .ops5, .ops6);
declare
left$bracket byte data ('['),
right$bracket byte data (']');
declare
alt$table$base address,
alt$table based alt$table$base (16) byte,
alt$table$ptrs (8) address external;
declare
mod$bits byte,
reg$bits byte,
rm$bits byte,
byte1$reg$bits byte,
d$bit byte,
s$bit byte,
v$bit byte,
w$bit byte,
z$bit byte;
declare
mnemonic$index byte, /* index into opcodes */
instr$type byte,
table$ptr address,
table$char based table$ptr byte,
disem$ptr pointer,
disem$offset address at (.disem$ptr),
disem$end address,
disem$byte based disem$ptr (1) byte,
disem$word based disem$ptr (1) address,
b$or$w$flag byte,
error$flag byte;
declare instr$table (512) byte external;
declare
ax$reg literally '0',
cx$reg literally '1',
dx$reg literally '2',
bx$reg literally '3',
sp$reg literally '4',
bp$reg literally '5',
si$reg literally '6',
di$reg literally '7';
declare
al$reg literally '0',
cl$reg literally '1',
dl$reg literally '2',
bl$reg literally '3',
ah$reg literally '4',
ch$reg literally '5',
dh$reg literally '6',
bh$reg literally '7';
declare
es$reg literally '0',
cs$reg literally '1',
ss$reg literally '2',
ds$reg literally '3';
declare
reg16 (*) byte public initial ('AX', 'CX', 'DX', 'BX', 'SP', 'BP', 'SI', 'DI'),
reg8 (*) byte public initial ('AL', 'CL', 'DL', 'BL', 'AH', 'CH', 'DH', 'BH'),
segreg (*) byte public initial ('ES', 'CS', 'SS', 'DS');
conout: procedure (c) external;
declare c byte;
end conout;
comma: procedure;
call conout (',');
end comma;
printm: procedure (a) PUBLIC;
declare a address;
declare b based a byte;
do while b <> '$';
call conout (b);
a = a + 1;
end;
end printm;
print$nibble: procedure (b);
declare b byte;
if b > 9 then call conout (b - 10 + 'A');
else call conout (b + '0');
end print$nibble;
print$byte: procedure (b);
declare b byte;
call print$nibble (shr (b, 4));
call print$nibble (b and 0fh);
end print$byte;
print$word: procedure (a) public;
declare a address;
call print$byte (high (a));
call print$byte (low (a));
end print$word;
error: procedure;
call printm (.('??= $'));
call print$byte (disem$byte (0));
disem$offset = disem$offset + 1;
end error;
set$bits: procedure;
byte1$reg$bits = disem$byte (0) and 7;
mod$bits = shr (disem$byte (1), 6);
reg$bits = shr (disem$byte (1), 3) and 7;
rm$bits = disem$byte (1) and 7;
w$bit, z$bit = disem$byte (0) and 1;
d$bit, s$bit, v$bit = shr (disem$byte (0), 1) and 1;
end set$bits;
print$b$or$w: procedure;
if w$bit then call printm (.('WORD $'));
else call printm (.('BYTE $'));
end print$b$or$w;
print$reg: procedure (reg$add, reg);
declare reg$add address, reg byte;
table$ptr = reg$add + shl (reg, 1);
call conout (table$char);
table$ptr = table$ptr + 1;
call conout (table$char);
end print$reg;
print$reg8: procedure (reg);
declare reg byte;
call print$reg (.reg8, reg);
end print$reg8;
print$reg16: procedure (reg);
declare reg byte;
call print$reg (.reg16, reg);
end print$reg16;
print$reg$8$or$16: procedure (reg$num);
declare reg$num byte;
if w$bit then call print$reg$16 (reg$num);
else call print$reg$8 (reg$num);
end print$reg$8$or$16;
print$2$reg$16: procedure (r1, r2);
declare (r1, r2) byte;
call print$reg$16 (r1);
call conout ('+');
call print$reg$16 (r2);
end print$2$reg$16;
print$A$reg: procedure;
if w$bit then call print$reg$16 (ax$reg);
else call print$reg$8 (al$reg);
end print$A$reg;
print$seg$reg: procedure (reg);
declare reg byte;
call print$reg (.seg$reg, reg);
end print$seg$reg;
print$data$8: procedure;
call print$byte (disem$byte (0));
disem$offset = disem$offset + 1;
end print$data$8;
print$data$16: procedure;
call print$word (disem$word (0));
disem$offset = disem$offset + 2;
end print$data$16;
print$data$8$or$16: procedure;
if w$bit then call print$data$16;
else call print$data$8;
end print$data$8$or$16;
print$data$sw: procedure;
if rol (disem$byte (0), 1) then call print$word (0ff00h or disem$byte (0));
else call print$word (disem$byte (0));
disem$offset = disem$offset + 1;
end print$data$sw;
print$signed$8: procedure;
declare a address;
a = disem$byte (0);
if low (a) >= 80h then a = a or 0ff00h; /* sign extend to 16 bits */
call print$word (disem$offset + a + 1);
disem$offset = disem$offset + 1;
end print$signed$8;
print$signed$16: procedure;
call print$word (disem$offset + disem$word (0) + 2);
disem$offset = disem$offset + 2;
end print$signed$16;
print$direct$addr: procedure;
call conout (left$bracket);
call print$word (disem$word (0));
call conout (right$bracket);
disem$offset = disem$offset + 2;
end print$direct$addr;
print$mod$rm: procedure;
disem$offset = disem$offset + 1; /* point past mod/reg/rm byte */
if mod$bits = 3 then
do;
call print$reg$8$or$16 (rm$bits);
return;
end;
if b$or$w$flag then call print$b$or$w;
if rm$bits = 6 and mod$bits = 0 then
do;
call print$direct$addr;
return;
end;
if mod$bits = 1 then
do;
if (rm$bits <> 6) or (disem$byte (0) <> 0)
then call print$byte (disem$byte (0));
disem$offset = disem$offset + 1;
end;
else if mod$bits = 2 then
do;
call print$word (disem$word (0));
disem$offset = disem$offset + 2;
end;
call conout (left$bracket);
do case rm$bits;
call print$2$reg$16 (3, 6);
call print$2$reg$16 (3, 7);
call print$2$reg$16 (5, 6);
call print$2$reg$16 (5, 7);
call print$reg$16 (6);
call print$reg$16 (7);
call print$reg$16 (5);
call print$reg$16 (3);
end;
call conout (right$bracket);
end print$mod$rm;
print$mod$reg$rm: procedure;
if d$bit then
do;
call print$reg$8$or$16 (reg$bits);
call conout (',');
call print$mod$rm;
end;
else
do;
call print$mod$rm;
call conout (',');
call print$reg$8$or$16 (reg$bits);
end;
end print$mod$reg$rm;
print$mnemonic: procedure;
declare (len, i) byte;
len = 2;
do while mnemonic$index >= opn$in (len - 1);
len = len + 1;
end;
table$ptr = tab$ptrs (len - 2) + (mnemonic$index - opn$in (len - 2))
* len;
do i = 1 to 7;
if i <= len then
do;
call conout (table$char);
table$ptr = table$ptr + 1;
end;
else call conout (' ');
end;
disem$offset = disem$offset + 1;
end print$mnemonic;
type1: procedure;
call print$mnemonic;
end type1;
type2: procedure;
if disem$byte (1) = 0ah then
do;
call print$mnemonic;
disem$offset = disem$offset + 1;
end;
else error$flag = true;
end type2;
type3: procedure;
call print$mnemonic;
call print$reg$16 (byte1$reg$bits);
end type3;
type4: procedure;
declare temp byte;
temp = shr (disem$byte (0), 3) and 3;
call print$mnemonic;
call print$segreg (temp);
end type4;
type5: procedure;
call print$mnemonic;
call print$signed$8;
end type5;
type6: procedure;
call print$mnemonic;
call print$signed$16;
end type6;
type8: procedure; /* 7, 9 */
call print$mnemonic;
call print$mod$rm;
end type8;
type10: procedure;
call print$mnemonic;
call print$data$8;
end type10;
type11: procedure;
call print$mnemonic;
call print$data$16;
end type11;
type12: procedure;
call print$mnemonic;
call conout ('3');
end type12;
type13: procedure;
declare temp address;
call print$mnemonic;
temp = disem$word (0);
disem$offset = disem$offset + 2;
call print$data$16;
call conout (':');
call print$word (temp);
end type13;
type14: procedure; /* 15, 16, 17 */
call print$mnemonic;
call print$mod$reg$rm;
end type14;
type18: procedure; /* 19, 20, 21 */
call print$mnemonic;
if d$bit then
do;
call print$direct$addr;
call comma;
call print$A$reg;
end;
else
do;
call print$A$reg;
call comma;
call print$direct$addr;
end;
end type18;
type22: procedure;
call print$mnemonic;
if d$bit then
do;
call print$data$8;
call comma;
call print$A$reg;
end;
else
do;
call print$A$reg;
call comma;
call print$data$8;
end;
end type22;
type23: procedure; /* 24 */
call print$mnemonic;
call print$A$reg;
call comma;
call print$data$8$or$16;
end type23;
type25: procedure; /* 26 */
call print$mnemonic;
if d$bit then
do;
call print$reg$16 (dx$reg);
call comma;
call print$A$reg;
end;
else
do;
call print$A$reg;
call comma;
call print$reg$16 (dx$reg);
end;
end type25;
type27: procedure; /* 28, 29, 30 */
call print$mnemonic;
b$or$w$flag = true;
call print$mod$rm;
call comma;
if v$bit then call print$reg$8 (cl$reg);
else call conout ('1');
end type27;
type31: procedure; /* 32 */
call setbits;
reg$bits = byte1$reg$bits;
w$bit = shr (disem$byte (0), 3) and 1;
call print$mnemonic;
call print$reg$8$or$16 (reg$bits);
call comma;
call print$data$8$or$16;
end type31;
type33: procedure;
call print$mnemonic;
call print$reg$16 (ax$reg);
call comma;
call print$reg$16 (byte1$reg$bits);
end type33;
type34: procedure; /* 35 */
call print$mnemonic;
b$or$w$flag = true;
call print$mod$rm;
call comma;
call print$data$8$or$16;
end type34;
type36: procedure; /* 37 */
w$bit = true; /* force 16 bit reg, mem */
if reg$bits > 3 then
do;
error$flag = true;
return;
end;
call print$mnemonic;
if d$bit then
do;
call print$seg$reg (reg$bits);
call comma;
call print$mod$rm;
end;
else
do;
call print$mod$rm;
call comma;
call print$seg$reg (reg$bits);
end;
end type36;
type38: procedure;
call print$mnemonic;
call print$mod$rm;
call comma;
call print$data$8;
end type38;
type39: procedure;
if mod$bits = 3 then
do;
error$flag = true;
return;
end;
call print$mnemonic;
call print$reg$16 (reg$bits);
call comma;
call print$mod$rm;
end type39;
type40: procedure; /* 41 */
if mod$bits = 3 then
do;
error$flag = true;
return;
end;
call print$mnemonic;
b$or$w$flag = true;
call print$mod$rm;
call comma;
call print$data$8$or$16;
end type40;
type42: procedure;
call print$mnemonic;
call print$byte (shl (byte1$reg$bits, 3) or reg$bits);
call comma;
call print$mod$rm;
end type42;
type44: procedure;
call print$mnemonic;
b$or$w$flag = true;
call print$modrm;
call comma;
if s$bit = 1 and w$bit = 1 then call print$data$sw;
else call print$data$8$or$16;
end type44;
type45: procedure;
b$or$w$flag = true;
call type8;
end type45;
dis: procedure;
error$flag, b$or$w$flag = false;
call set$bits;
if instr$type = 26 then
do;
alt$table$base = alt$table$ptrs (mnemonic$index);
mnemonic$index = alt$table (reg$bits * 2);
instr$type = alt$table (reg$bits * 2 + 1);
end;
if instr$type > 28 then error$flag = true;
else
do case instr$type;
error$flag = true;
call type1;
call type2;
call type3;
call type4;
call type5;
call type6;
call type8;
call type10;
call type11;
call type12;
call type13;
call type14;
call type18;
call type22;
call type23;
call type25;
call type27;
call type31;
call type33;
call type34;
call type36;
call type38;
call type39;
call type40;
call type42;
;
call type44;
call type45;
end;
if error$flag then call error;
end dis;
disem: procedure (disloc) address public;
declare disloc pointer;
declare nprefix byte;
disem$ptr = disloc;
nprefix = 0;
do while true;
mnemonic$index = instr$table (disem$byte (0) * 2);
instr$type = instr$table (disem$byte (0) * 2 + 1);
if instr$type = 0ffh and nprefix < 3 then
do;
call print$mnemonic;
nprefix = nprefix + 1;
end;
else
do;
if instr$type = 0ffh then instr$type = 1;
call dis;
return disem$offset;
end;
end;
end disem;
end disem86;


View File

@@ -0,0 +1,28 @@
; transient interface module for 8086
; JULY, 1980
dgroup group dats
dats segment public 'DATS'
db '?'
dats ends
cgroup group code
extrn disem:near
public boot
public conin,conout
code segment public 'CODE'
assume cs:cgroup
disent proc
org 1400h
jmp disem
disent endp
boot proc
ret
boot endp
conin proc
jmp $-1301h
conin endp
conout proc
jmp $-1301h
conout endp
code ends
end


View File

@@ -0,0 +1,123 @@
gentab: proc options (main);
/* generate tables for 8086 disassembler 12/23/80 */
/* modified 5/14/81 */
declare
opcnt (2:6) fixed (7) static initial (0,0,0,0,0),
sum fixed (7),
len fixed (7),
line char (100) varying,
infile file,
outfile file,
litfile file,
opcode char (10) varying,
i fixed (7),
j fixed (15),
n fixed (7),
count fixed (15),
chars (200) char (6) varying;
open file (infile) input stream title ('OP86.DAT');
open file (outfile) print title ('OPTAB.DAT');
open file (litfile) print title ('OPTAB.LIT');
on endpage (outfile) begin; end;
on endpage (litfile) begin; end;
count = 0;
/* read op86.dat file into chars array */
get file (infile) list (opcode);
do while (opcode ^= '$');
count = count + 1;
chars (count) = opcode;
get file (infile) list (opcode);
end;
/* create ascii opcode tables, 1 for each character length */
do i = 2 to 6;
line = 'declare ops' || deblank (i) || ' (*) byte initial (';
n = 0;
do j = 1 to count;
if length (chars (j)) = i then
do;
if n > 0 then line = line || ', ';
if divide (n, 5, 7) * 5 = n then
do;
put file (outfile) skip list (line);
line = '^I';
end;
n = n + 1;
line = line || '''' || chars (j) || '''';
opcnt (i) = opcnt (i) + 1;
end;
end;
line = line || ');';
put file (outfile) skip list (line);
put file (outfile) skip;
end;
/* create array containing # of opcodes of each length */
line = 'declare nops (5) byte public initial (';
do i = 2 to 6;
line = line || deblank (opcnt (i));
if i < 6 then line = line || ', ';
end;
put file (outfile) skip list (line || ');');
put file (outfile) skip;
/* create array containing starting index for each opcode length */
line = 'declare opn$in (*) byte public initial (';
sum = 0;
do i = 2 to 6;
line = line || deblank (sum) || ', ';
sum = sum + opcnt (i);
end;
put file (outfile) skip list (line || '255);');
/* create literals for starting indexes for each opcode length */
sum = 0;
put file (litfile) skip list ('declare');
do i = 2 to 6;
put skip list (deblank (opcnt (i)), deblank (i) || '-character opcodes');
line = '^I' || 'op' || deblank (i) ||
'$in literally ''' || deblank (sum) || '''';
if i = 6 then line = line || ';';
else line = line || ',';
put file (litfile) skip list (line);
sum = sum + opcnt (i);
opcnt (i) = 0;
end;
/* create literals for position in opcode tables of each opcode */
put file (litfile) skip;
put file (litfile) skip list ('declare');
do j = 1 to count;
len = length (chars (j));
if index (chars (j), ':') > 0 then
chars (j) = substr (chars (j), 1, len-1);
line = '^I' || chars (j) || '$in literally '''
|| 'op' || deblank (len) || '$in + '
|| deblank (opcnt (len)) || '''';
if j = count then line = line || ';';
else line = line || ',';
put file (litfile) skip list (line);
opcnt (len) = opcnt (len) + 1;
end;
deblank: proc (i) returns (char (10) varying);
declare i fixed (7);
declare temp char (10) varying;
temp = char (i);
return (substr (temp, verify (temp, ' ')));
end deblank;
end gentab;


View File

@@ -0,0 +1,427 @@
$title('instruction table for 8086 disassembler')
$date(10/5/80)
instr86: do;
declare
qq$in literally '0',
alt1 literally '0',
alt2 literally '1',
alt3 literally '2',
alt4 literally '3',
alt5 literally '4',
alt6 literally '5',
alt7 literally '6',
alt8 literally '7';
$include(optab.lit)
declare
type$0 literally '0',
type$1 literally '1',
type$2 literally '2',
type$3 literally '3',
type$4 literally '4',
type$5 literally '5',
type$6 literally '6',
type$7 literally '7',
type$8 literally '7',
type$9 literally '7',
type$10 literally '8',
type$11 literally '9',
type$12 literally '10',
type$13 literally '11',
type$14 literally '12',
type$15 literally '12',
type$16 literally '12',
type$17 literally '12',
type$18 literally '13',
type$19 literally '13',
type$20 literally '13',
type$21 literally '13',
type$22 literally '14',
type$23 literally '15',
type$24 literally '15',
type$25 literally '16',
type$26 literally '16',
type$27 literally '17',
type$28 literally '17',
type$29 literally '17',
type$30 literally '17',
type$31 literally '18',
type$32 literally '18',
type$33 literally '19',
type$34 literally '20',
type$35 literally '20',
type$36 literally '21',
type$37 literally '21',
type$38 literally '22',
type$39 literally '23',
type$40 literally '24',
type$41 literally '24',
type$42 literally '25',
type$43 literally '26',
type$44 literally '27',
type$45 literally '28';
declare
prefix$type literally '0ffh';
declare alt$table$ptrs (8) address public data (
.alt$1$tab,
.alt$2$tab,
.alt$3$tab,
.alt$4$tab,
.alt$5$tab,
.alt$6$tab,
.alt$7$tab,
.alt$8$tab);
declare alt$1$tab (*) byte data (
add$in, type$44,
or$in, type$34,
adc$in, type$44,
sbb$in, type$44,
and$in, type$34,
sub$in, type$44,
xor$in, type$34,
cmp$in, type$44);
declare alt$2$tab (*) byte data (
add$in, type$44,
qq$in, type$0,
adc$in, type$44,
sbb$in, type$44,
qq$in, type$0,
sub$in, type$44,
qq$in, type$0,
cmp$in, type$44);
declare alt$3$tab (*) byte data (
add$in, type$38,
qq$in, type$0,
adc$in, type$38,
sbb$in, type$38,
qq$in, type$0,
sub$in, type$38,
qq$in, type$0,
cmp$in, type$38);
declare alt$4$tab (*) byte data (
rol$in, type$29,
ror$in, type$29,
rcl$in, type$29,
rcr$in, type$29,
shl$in, type$29,
shr$in, type$29,
qq$in, type$0,
sar$in, type$29);
declare alt$5$tab (*) byte data (
rol$in, type$27,
ror$in, type$27,
rcl$in, type$27,
rcr$in, type$27,
shl$in, type$27,
shr$in, type$27,
qq$in, type$0,
sar$in, type$27);
declare alt$6$tab (*) byte data (
test$in, type$34,
qq$in, type$0,
not$in, type$45,
neg$in, type$45,
mul$in, type$45,
imul$in, type$45,
div$in, type$45,
idiv$in, type$45);
declare alt$7$tab (*) byte data (
inc$in, type$45,
dec$in, type$45,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0);
declare alt$8$tab (*) byte data (
inc$in, type$45,
dec$in, type$45,
call$in, type$9,
callf$in, type$7,
jmp$in, type$9,
jmpf$in, type$7,
push$in, type$7,
qq$in, type$0);
/*
instruction table for 8086 disassembler
instruction is index into table
there are 2 bytes per instruction:
1. index into ascii opcode table
2. instruction type (how many operands of what type, etc.)
*/
declare instr$table (512) byte public data (
add$in, type$14, /* 0 */
add$in, type$15,
add$in, type$16,
add$in, type$17,
add$in, type$23,
add$in, type$24,
push$in, type$4,
pop$in, type$4,
or$in, type$14,
or$in, type$15,
or$in, type$16,
or$in, type$17,
or$in, type$23,
or$in, type$24,
push$in, type$4,
qq$in, type$0,
adc$in, type$14, /* 10 */
adc$in, type$15,
adc$in, type$16,
adc$in, type$17,
adc$in, type$23,
adc$in, type$24,
push$in, type$4,
pop$in, type$4,
sbb$in, type$14,
sbb$in, type$15,
sbb$in, type$16,
sbb$in, type$17,
sbb$in, type$23,
sbb$in, type$24,
push$in, type$4,
pop$in, type$4,
and$in, type$14, /* 20 */
and$in, type$15,
and$in, type$16,
and$in, type$17,
and$in, type$23,
and$in, type$24,
es$in, prefix$type,
daa$in, type$1,
sub$in, type$14,
sub$in, type$15,
sub$in, type$16,
sub$in, type$17,
sub$in, type$23,
sub$in, type$24,
cs$in, prefix$type,
das$in, type$1,
xor$in, type$14, /* 30 */
xor$in, type$15,
xor$in, type$16,
xor$in, type$17,
xor$in, type$23,
xor$in, type$24,
ss$in, prefix$type,
aaa$in, type$1,
cmp$in, type$14,
cmp$in, type$15,
cmp$in, type$16,
cmp$in, type$17,
cmp$in, type$23,
cmp$in, type$24,
ds$in, prefix$type,
aas$in, type$1,
inc$in, type$3, /* 40 */
inc$in, type$3,
inc$in, type$3,
inc$in, type$3,
inc$in, type$3,
inc$in, type$3,
inc$in, type$3,
inc$in, type$3,
dec$in, type$3,
dec$in, type$3,
dec$in, type$3,
dec$in, type$3,
dec$in, type$3,
dec$in, type$3,
dec$in, type$3,
dec$in, type$3,
push$in, type$3, /* 50 */
push$in, type$3,
push$in, type$3,
push$in, type$3,
push$in, type$3,
push$in, type$3,
push$in, type$3,
push$in, type$3,
pop$in, type$3,
pop$in, type$3,
pop$in, type$3,
pop$in, type$3,
pop$in, type$3,
pop$in, type$3,
pop$in, type$3,
pop$in, type$3,
qq$in, type$0, /* 60 */
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
qq$in, type$0,
jo$in, type$5, /* 70 */
jno$in, type$5,
jb$in, type$5,
jnb$in, type$5,
jz$in, type$5,
jnz$in, type$5,
jbe$in, type$5,
ja$in, type$5,
js$in, type$5,
jns$in, type$5,
jp$in, type$5,
jnp$in, type$5,
jl$in, type$5,
jnl$in, type$5,
jle$in, type$5,
jg$in, type$5,
alt1, type$43, /* 80 */
alt1, type$43,
alt2, type$43,
alt2, type$43,
test$in, type$14,
test$in, type$15,
xchg$in, type$16,
xchg$in, type$17,
mov$in, type$14,
mov$in, type$15,
mov$in, type$16,
mov$in, type$17,
mov$in, type$36,
lea$in, type$39,
mov$in, type$37,
pop$in, type$9,
nop$in, type$1, /* 90 */
xchg$in, type$33,
xchg$in, type$33,
xchg$in, type$33,
xchg$in, type$33,
xchg$in, type$33,
xchg$in, type$33,
xchg$in, type$33,
cbw$in, type$1,
cwd$in, type$1,
callf$in, type$13,
wait$in, type$1,
pushf$in, type$1,
popf$in, type$1,
sahf$in, type$1,
lahf$in, type$1,
mov$in, type$18, /* A0 */
mov$in, type$19,
mov$in, type$20,
mov$in, type$21,
movsb$in, type$1,
movsw$in, type$1,
cmpsb$in, type$1,
cmpsw$in, type$1,
test$in, type$23,
test$in, type$24,
stosb$in, type$1,
stosw$in, type$1,
lodsb$in, type$1,
lodsw$in, type$1,
scasb$in, type$1,
scasw$in, type$1,
mov$in, type$31, /* B0 */
mov$in, type$31,
mov$in, type$31,
mov$in, type$31,
mov$in, type$31,
mov$in, type$31,
mov$in, type$31,
mov$in, type$31,
mov$in, type$32,
mov$in, type$32,
mov$in, type$32,
mov$in, type$32,
mov$in, type$32,
mov$in, type$32,
mov$in, type$32,
mov$in, type$32,
qq$in, type$0, /* C0 */
qq$in, type$0,
ret$in, type$11,
ret$in, type$1,
les$in, type$39,
lds$in, type$39,
mov$in, type$40,
mov$in, type$41,
qq$in, type$0,
qq$in, type$0,
retf$in, type$11,
retf$in, type$1,
int$in, type$12,
int$in, type$10,
into$in, type$1,
iret$in, type$1,
alt4, type$43, /* D0 */
alt4, type$43,
alt5, type$43,
alt5, type$43,
aam$in, type$2,
aad$in, type$2,
qq$in, type$0,
xlat$in, type$1,
esc$in, type$42,
esc$in, type$42,
esc$in, type$42,
esc$in, type$42,
esc$in, type$42,
esc$in, type$42,
esc$in, type$42,
esc$in, type$42,
loopne$in, type$5, /* E0 */
loope$in, type$5,
loop$in, type$5,
jcxz$in, type$5,
in$in, type$22,
in$in, type$22,
out$in, type$22,
out$in, type$22,
call$in, type$6,
jmp$in, type$6,
jmpf$in, type$13,
jmps$in, type$5,
in$in, type$25,
in$in, type$26,
out$in, type$25,
out$in, type$26,
lock$in, prefix$type, /* F0 */
qq$in, type$0,
repne$in, prefix$type,
rep$in, prefix$type,
hlt$in, type$1,
cmc$in, type$1,
alt6, type$43,
alt6, type$43,
clc$in, type$1,
stc$in, type$1,
cli$in, type$1,
sti$in, type$1,
cld$in, type$1,
std$in, type$1,
alt7, type$43,
alt8, type$43);
end instr86;


View File

@@ -0,0 +1,126 @@
AAA
AAD
AAM
AAS
ADC
ADD
AND
CALL
CALLF
CBW
CLC
CLD
CLI
CMC
CMP
CMPSB
CMPSW
CS:
CWD
DAA
DAS
DEC
DIV
DS:
ES:
ESC
HLT
IDIV
IMUL
IN
INC
INT
INTO
IRET
JA
JAE
JB
JBE
JC
JCXZ
JE
JG
JGE
JL
JLE
JMP
JMPF
JMPS
JNA
JNAE
JNB
JNBE
JNC
JNE
JNG
JNGE
JNL
JNLE
JNO
JNP
JNS
JNZ
JO
JP
JPE
JPO
JS
JZ
LAHF
LDS
LEA
LES
LOCK
LODSB
LODSW
LOOP
LOOPE
LOOPNE
LOOPNZ
LOOPZ
MOV
MOVSB
MOVSW
MUL
NEG
NOP
NOT
OR
OUT
POP
POPF
PUSH
PUSHF
RCL
RCR
REP
REPE
REPNE
REPNZ
REPZ
RET
RETF
ROL
ROR
SAHF
SAL
SAR
SBB
SCASB
SCASW
SHL
SHR
SS:
STC
STD
STI
STOSB
STOSW
SUB
TEST
WAIT
XCHG
XLAT
XOR
$


View File

@@ -0,0 +1,41 @@
declare ops2 (*) byte initial (
'IN', 'JA', 'JB', 'JC', 'JE',
'JG', 'JL', 'JO', 'JP', 'JS',
'JZ', 'OR');
declare ops3 (*) byte initial (
'AAA', 'AAD', 'AAM', 'AAS', 'ADC',
'ADD', 'AND', 'CBW', 'CLC', 'CLD',
'CLI', 'CMC', 'CMP', 'CS:', 'CWD',
'DAA', 'DAS', 'DEC', 'DIV', 'DS:',
'ES:', 'ESC', 'HLT', 'INC', 'INT',
'JAE', 'JBE', 'JGE', 'JLE', 'JMP',
'JNA', 'JNB', 'JNC', 'JNE', 'JNG',
'JNL', 'JNO', 'JNP', 'JNS', 'JNZ',
'JPE', 'JPO', 'LDS', 'LEA', 'LES',
'MOV', 'MUL', 'NEG', 'NOP', 'NOT',
'OUT', 'POP', 'RCL', 'RCR', 'REP',
'RET', 'ROL', 'ROR', 'SAL', 'SAR',
'SBB', 'SHL', 'SHR', 'SS:', 'STC',
'STD', 'STI', 'SUB', 'XOR');
declare ops4 (*) byte initial (
'CALL', 'IDIV', 'IMUL', 'INTO', 'IRET',
'JCXZ', 'JMPF', 'JMPS', 'JNAE', 'JNBE',
'JNGE', 'JNLE', 'LAHF', 'LOCK', 'LOOP',
'POPF', 'PUSH', 'REPE', 'REPZ', 'RETF',
'SAHF', 'TEST', 'WAIT', 'XCHG', 'XLAT');
declare ops5 (*) byte initial (
'CALLF', 'CMPSB', 'CMPSW', 'LODSB', 'LODSW',
'LOOPE', 'LOOPZ', 'MOVSB', 'MOVSW', 'PUSHF',
'REPNE', 'REPNZ', 'SCASB', 'SCASW', 'STOSB',
'STOSW');
declare ops6 (*) byte initial (
'LOOPNE', 'LOOPNZ');
declare nops (5) byte public initial (12, 69, 25, 16, 2);
declare opn$in (*) byte public initial (0, 12, 81, 106, 122, 255);

View File

@@ -0,0 +1,133 @@
declare
op2$in literally '0',
op3$in literally '12',
op4$in literally '81',
op5$in literally '106',
op6$in literally '122';
declare
AAA$in literally 'op3$in + 0',
AAD$in literally 'op3$in + 1',
AAM$in literally 'op3$in + 2',
AAS$in literally 'op3$in + 3',
ADC$in literally 'op3$in + 4',
ADD$in literally 'op3$in + 5',
AND$in literally 'op3$in + 6',
CALL$in literally 'op4$in + 0',
CALLF$in literally 'op5$in + 0',
CBW$in literally 'op3$in + 7',
CLC$in literally 'op3$in + 8',
CLD$in literally 'op3$in + 9',
CLI$in literally 'op3$in + 10',
CMC$in literally 'op3$in + 11',
CMP$in literally 'op3$in + 12',
CMPSB$in literally 'op5$in + 1',
CMPSW$in literally 'op5$in + 2',
CS$in literally 'op3$in + 13',
CWD$in literally 'op3$in + 14',
DAA$in literally 'op3$in + 15',
DAS$in literally 'op3$in + 16',
DEC$in literally 'op3$in + 17',
DIV$in literally 'op3$in + 18',
DS$in literally 'op3$in + 19',
ES$in literally 'op3$in + 20',
ESC$in literally 'op3$in + 21',
HLT$in literally 'op3$in + 22',
IDIV$in literally 'op4$in + 1',
IMUL$in literally 'op4$in + 2',
IN$in literally 'op2$in + 0',
INC$in literally 'op3$in + 23',
INT$in literally 'op3$in + 24',
INTO$in literally 'op4$in + 3',
IRET$in literally 'op4$in + 4',
JA$in literally 'op2$in + 1',
JAE$in literally 'op3$in + 25',
JB$in literally 'op2$in + 2',
JBE$in literally 'op3$in + 26',
JC$in literally 'op2$in + 3',
JCXZ$in literally 'op4$in + 5',
JE$in literally 'op2$in + 4',
JG$in literally 'op2$in + 5',
JGE$in literally 'op3$in + 27',
JL$in literally 'op2$in + 6',
JLE$in literally 'op3$in + 28',
JMP$in literally 'op3$in + 29',
JMPF$in literally 'op4$in + 6',
JMPS$in literally 'op4$in + 7',
JNA$in literally 'op3$in + 30',
JNAE$in literally 'op4$in + 8',
JNB$in literally 'op3$in + 31',
JNBE$in literally 'op4$in + 9',
JNC$in literally 'op3$in + 32',
JNE$in literally 'op3$in + 33',
JNG$in literally 'op3$in + 34',
JNGE$in literally 'op4$in + 10',
JNL$in literally 'op3$in + 35',
JNLE$in literally 'op4$in + 11',
JNO$in literally 'op3$in + 36',
JNP$in literally 'op3$in + 37',
JNS$in literally 'op3$in + 38',
JNZ$in literally 'op3$in + 39',
JO$in literally 'op2$in + 7',
JP$in literally 'op2$in + 8',
JPE$in literally 'op3$in + 40',
JPO$in literally 'op3$in + 41',
JS$in literally 'op2$in + 9',
JZ$in literally 'op2$in + 10',
LAHF$in literally 'op4$in + 12',
LDS$in literally 'op3$in + 42',
LEA$in literally 'op3$in + 43',
LES$in literally 'op3$in + 44',
LOCK$in literally 'op4$in + 13',
LODSB$in literally 'op5$in + 3',
LODSW$in literally 'op5$in + 4',
LOOP$in literally 'op4$in + 14',
LOOPE$in literally 'op5$in + 5',
LOOPNE$in literally 'op6$in + 0',
LOOPNZ$in literally 'op6$in + 1',
LOOPZ$in literally 'op5$in + 6',
MOV$in literally 'op3$in + 45',
MOVSB$in literally 'op5$in + 7',
MOVSW$in literally 'op5$in + 8',
MUL$in literally 'op3$in + 46',
NEG$in literally 'op3$in + 47',
NOP$in literally 'op3$in + 48',
NOT$in literally 'op3$in + 49',
OR$in literally 'op2$in + 11',
OUT$in literally 'op3$in + 50',
POP$in literally 'op3$in + 51',
POPF$in literally 'op4$in + 15',
PUSH$in literally 'op4$in + 16',
PUSHF$in literally 'op5$in + 9',
RCL$in literally 'op3$in + 52',
RCR$in literally 'op3$in + 53',
REP$in literally 'op3$in + 54',
REPE$in literally 'op4$in + 17',
REPNE$in literally 'op5$in + 10',
REPNZ$in literally 'op5$in + 11',
REPZ$in literally 'op4$in + 18',
RET$in literally 'op3$in + 55',
RETF$in literally 'op4$in + 19',
ROL$in literally 'op3$in + 56',
ROR$in literally 'op3$in + 57',
SAHF$in literally 'op4$in + 20',
SAL$in literally 'op3$in + 58',
SAR$in literally 'op3$in + 59',
SBB$in literally 'op3$in + 60',
SCASB$in literally 'op5$in + 12',
SCASW$in literally 'op5$in + 13',
SHL$in literally 'op3$in + 61',
SHR$in literally 'op3$in + 62',
SS$in literally 'op3$in + 63',
STC$in literally 'op3$in + 64',
STD$in literally 'op3$in + 65',
STI$in literally 'op3$in + 66',
STOSB$in literally 'op5$in + 14',
STOSW$in literally 'op5$in + 15',
SUB$in literally 'op3$in + 67',
TEST$in literally 'op4$in + 21',
WAIT$in literally 'op4$in + 22',
XCHG$in literally 'op4$in + 23',
XLAT$in literally 'op4$in + 24',
XOR$in literally 'op3$in + 68';