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,165 @@
*****************************************************************
* *
* initiate program execution *
* *
*****************************************************************
*
*
.globl _GO
.globl _STEP
.globl _BDOS
.globl _GETSSP
.text
*
*
_GO: movem.l d0-d7/a0-a5,regsave save register variables
movem.l a6/a7,asave
move.w #22,d0 set up illegal trap vector
move.w #iltv,d1
move.w d1,thvnum
move.l #th,d2
trap #3
move.l d0,savev
*
move.l 4(a7),a0 addr of state save area
*
move.w #62,d0 get supervisor mode
trap #2
move.l a7,realssp
*
move.l (a0),pctr pc to start at
move.w 12(a0),status starting status
move.l 4(a0),a1 set up stack pointers
move.l a1,usp user stack pointer
move.l 8(a0),a7 supervisor stack pointer
movem.l 14(a0),d0-d7/a0-a6 set up other registers
move.l pctr,-(a7) set up for rte
and.w #$7FFF,status
move.w status,-(a7)
rte begin executing
*
* trap handling for _GO and _STEP
*
th: move.w (a7)+,status grab info from sys stack
move.l (a7)+,pctr
move.l a7,savessp
move.l realssp,a7
move.l a0,savea0
move.l usp,a0
move.l a0,saveusp
move.l savea0,a0
andi $5fff,sr
movem.l a6/a7,bsave save regs
move.l asave+4,a7 get old regs
move.l 4(a7),a6
move.l pctr,(a6)
move.l saveusp,4(a6)
move.l savessp,8(a6)
move.w status,12(a6)
and.w #$7FFF,12(a6)
movem.l d0-d7/a0-a5,14(a6)
move.w #22,d0
move.w thvnum,d1
move.l savev,d2
trap #3
move.l bsave,70(a6)
move.l bsave+4,74(a6)
btst #5,status
beq wasusr
move.l savessp,74(a6)
wasusr: move.l asave,a6
movem.l regsave,d0-d7/a0-a5
rts back to ddt proper
*
*
*****************************************************************
* *
* execute one user instruction (trace or notrace) *
* *
*****************************************************************
*
_STEP: movem.l d0-d7/a0-a5,regsave save registers
movem.l a6/a7,asave save registers
*
move.w #62,d0 get supervisor mode
trap #2
move.l a7,realssp
*
move.w #22,d0
move.w #trv,d1
move.w d1,thvnum
move.l #th,d2
trap #3
move.l d0,savev
*
move.l asave+4,a0 caller's stack ptr
move.l 4(a0),a0 address of cpu state save area
move.l (a0),pctr starting pc
move.w 12(a0),d0 status
ori.w #$8000,d0 set trace bit
move.w d0,status starting status
move.l 4(a0),a1 user stack pointer
move.l a1,usp
move.l 8(a0),a7 system stack pointer
movem.l 14(a0),d0-d7/a0-a6 registers
move.l pctr,-(a7) set up for rte
move.w status,-(a7)
rte
*
.bss
*
asave: .ds.l 2
bsave: .ds.l 2
regsave: .ds.l 14
realssp: .ds.l 1
savessp: .ds.l 1
saveusp: .ds.l 1
savea0: .ds.l 1
iltv = $4 illegal instruction vector number
trv = $9 trace exception vector number
*
savev: .ds.l 1
thvnum: .ds.w 1
*
setexp = 61
setsup = 62
*
pctr: .ds.l 1
status: .ds.w 1
*
*
.text
*
*****************************************************************
* *
* BDOS Call Subroutine -- C Callable *
* *
*****************************************************************
*
_BDOS: move.w 4(a7),d0
move.l d1,saved1
move.l 6(a7),d1
trap #2
move.l saved1,d1
rts
*
.bss
*
saved1: .ds.l 1
*
.text
*
*****************************************************************
* *
* GETSSP -- supplies system stack pointer to C *
* *
*****************************************************************
*
_GETSSP: move.w #62,d0
trap #2
move.l a7,d0
andi #$5fff,sr
rts
*
.end

View File

@@ -0,0 +1,47 @@
/****************************************************************/
/* */
/* Define BDOS Function Codes */
/* */
/****************************************************************/
#define SYSRESET 0
#define CONIN 1
#define CONOUT 2
#define READIN 3
#define PUNOUT 4
#define LISTOUT 5
#define DCONIO 6
#define GETIOB 7
#define SETIOB 8
#define PRNTSTR 9
#define READBUF 10
#define CONSTAT 11
#define GETVER 12
#define RESETDSK 13
#define SELDSK 14
#define OPEN 15
#define CLOSE 16
#define SRCHFST 17
#define SRCHNXT 18
#define DELETE 19
#define READSEQ 20
#define WRITSEQ 21
#define MAKEFILE 22
#define RENAME 23
#define GTLOGIN 24
#define CURDSK 25
#define SETDMA 26
#define WRTPROT 28
#define GETROV 29
#define SETATTR 30
#define GETDPB 31
#define USERCD 32
#define READRND 33
#define WRITRND 34
#define FILESIZ 35
#define SETRND 36
#define RESTDRV 37
#define WRANDZF 40
#define GETFREE 46
#define DBIOSCL 50
#define PGMLOAD 59

View File

@@ -0,0 +1,13 @@
$ set nover
$ set noon
$ c68 :== $bin:c68.exe
$ c068 :== $bin:c068.exe
$ c168 :== $bin:c168.exe
$ as68 :== $bin:as68.exe
$ lo68 :== $bin:lo68.exe
$ c68 'p1'.c 'p1'.i
$ c068 'p1'.i 'p1'.ic 'p1'.st
$ c168 'p1'.ic 'p1'.s -L
$ as68 -l -u -p 'p1'.s >'p1'.lis
$ delete 'p1'.s;*,'p1'.ic;*,'p1'.i;*,'p1'.st;*
$ set ver

View File

@@ -0,0 +1,101 @@
conv: proc options(main);
dcl (inname,outname) char(50) varying;
dcl (infile,outfile) file;
dcl bytes char(2);
dcl wigit char(512);
dcl digit char;
dcl bdigit(128) bit(8);
dcl (j,i,bnum) bin ;
Dcl bytesb(2) char(1) based (bp1) ;
Dcl bp1 ptr ;
dcl (eof,fof) bit(1);
dcl (temp,temp2) bit(8);
on endfile(infile) eof = '1'b;
on undefinedfile(infile) begin;
put skip list('File not found');
stop;
end;
bp1 = addr(bytes) ;
put skip edit('Source Filename: ')(a(23)); get edit(inname)(a(50));
put skip edit('Destination Filename: ')(a(23)); get edit(outname)(a(50));
open file(infile) input environment(block_io) sequential title(inname);
open file(outfile) output stream linesize(80) title(outname);
eof = '0'b; fof = '0'b;
read file(infile) into (wigit);
do while( ^fof);
fof = eof;
do bnum = 1 to 512;
temp = unspec(substr(wigit,bnum,1));
do i = 1 to 8 ; substr(temp2,i,1) = substr(temp,9-i,1); end;
bytes = byte_to_hex(temp2);
put file(outfile) edit((bytesb(i) do i = 1 to 2)) (2(a));
end;
if ^eof then read file(infile) into (wigit);
end;
close file(infile);
close file(outfile);
/* utility routines for conversions */
bit_to_hex:
proc(xb) returns(char(1));
dcl
xb bit(4),
xi fixed bin(7),
hex(16) bit(4) static initial
('0000','0001','0010','0011',
'0100','0101','0110','0111',
'1000','1001','1010','1011',
'1100','1101','1110','1111'),
list char(16) static initial
('0123456789ABCDEF');
do xi = 1 to 16 while(hex(xi) ^= xb);
end;
return(substr(list,xi,1));
end bit_to_hex;
hex_to_bit:
proc(xc) returns(bit(4));
dcl
xc char(1),
xi fixed bin(7),
hex(16) bit(4) static initial
('0000','0001','0010','0011',
'0100','0101','0110','0111',
'1000','1001','1010','1011',
'1100','1101','1110','1111'),
list char(16) static initial
('0123456789ABCDEF');
xi = index(list,xc);
if xi = 0 then
do;
put skip list('INVALID HEX CHARACTER:');
stop;
end;
else
return(hex(xi));
end hex_to_bit;
byte_to_hex:
proc(xb) returns(char(2));
dcl
xb bit(8);
return(bit_to_hex(substr(xb,1,4))||bit_to_hex(substr(xb,5,4)));
end byte_to_hex;
hex_to_byte:
proc(xc) returns(bit(8));
dcl
xc char(2);
return(hex_to_bit(substr(xc,1,1))||hex_to_bit(substr(xc,2,1)));
end hex_to_byte;
end;

View File

@@ -0,0 +1,17 @@
$ set noon
$ set def [cpm68k.freeze.ddt]
$ assign drb0:[steve.bin] bin:
$ assign drb0:[steve.lib] lib:
$ as68 :== $bin:as68.exe
$ ld68 :== $bin:lo68.exe
$ cc68 ddt1
$ cc68 ddt2
$ cc68 ddtutil
$ cc68 disasm
$ as68 -u -l -p bdos.s >bdos.lis
$ ld68 -r -o ddt1.68k ddt1.o ddt2.o ddtutil.o disasm.o bdos.o
$ as68 -u -l -p ddtload.s >ddtload.lis
$ ld68 -r -o ddt.68k ddtload.o
$ pr/nofeed ddt1.c,ddt2.c,ddtutil.c,disasm.c,bdos.lis, -
ddtinc.h,disas.h,optab.h,bdosfunc.h,stdio.h, -
ddtload.lis

View File

@@ -0,0 +1,439 @@
/****************************************************************/
/* */
/* DDT-68K (tm) */
/* */
/* Copyright 1982, Digital Research */
/* */
/****************************************************************/
#include "ddtinc.h"
#include "stdio.h"
#include "bdosfunc.h"
#include "disas.h"
char *copyrt="CP/M-68K(tm), Version 1.1, Copyright (c) 1983, Digital Research";
char *serial = "XXXX-0000-654321";
main(bpptr)
struct basepage *bpptr;
{
char combuf[BUFLEN];
char *cx;
char *dispaddr; /* current display address */
char *listaddr; /* current disassembly addr*/
struct cpustate state; /* state of user program registers */
struct value curvals; /* values relating to current file or pgm */
register int i; /* workhorse integer */
/* phony machine state initialization */
for (i=0; i<8; i++) {state.dreg[i]=0L; state.areg[i]=0L;}
state.pc = 0x0;
state.usp = 0x00001000L;
state.areg[7]=state.usp;
state.ssp = GETSSP();
state.status = 0x0000;
dispaddr = 0;
listaddr = 0;
curvals.kind = 0; /* no current file or program */
init(bpptr, &state, &curvals, &dispaddr, &listaddr, &bpptr);
while ( 1 ) {
while ( ! (cx = readcom(combuf)) );
switch ( *cx ) {
/* one case for each possible command */
case 'D' : display(cx, &dispaddr);
break;
case 'E' : ecmd(cx, bpptr, &state, &curvals,
&dispaddr, &listaddr, &bpptr);
break;
case 'F' : fillmem(cx);
break;
case 'G' : gocmd(cx, &state);
break;
case 'H' : hexmath(cx);
break;
case 'I' : incomtl(cx, &curvals);
break;
case 'L' : disasm(cx, &listaddr);
break;
case 'M' : movemem(cx);
break;
case 'R' : readfl(cx, bpptr, &curvals, &dispaddr);
break;
case 'S' : setmem(cx);
break;
case 'T' : trace(cx, &state, &listaddr, (int)1);
break;
case 'U' : trace(cx, &state, &listaddr, (int)0);
break;
case 'V' : vcmd(cx, &curvals);
break;
case 'W' : wrtfile(cx, &curvals);
break;
case 'X' : examine(cx, &state);
break;
default : stout("Unknown Command\n\n");
break;
}; /* end of switch on comx */
}; /* end of while loop */
} /* end of function main */
init(basep, statep, valuep, dap, lap, bppa)
struct basepage *basep;
struct cpustate *statep;
struct value *valuep;
char **dap;
char **lap;
long *bppa;
{
/* if program file argument, then load it */
/* set up trap vectors */
/* initialize tables */
stout("\nDDT-68K\nCopyright 1982, Digital Research\n\n");
if (basep->fcb1.fn[0] != ' ')
loadpgm(&(basep->fcb1), basep, statep, valuep, dap, lap, bppa);
}
char *readcom(buf) /* read one command line, return command type */
register char *buf;
{
register char *cx;
register short int i,nc;
do {
stout("\r\r-"); /* prompt */
*buf = BUFLEN-3;
BDOS(READBUF, buf); /* get command line */
putchar('\n');
} while ( ( nc=buf[1]) == 0 );
buf[2+nc] = 0;
for ( cx = &buf[2]; *cx; *cx=toupper(*cx), cx++);
for ( cx= &buf[2], i=0 ; iswhite(*cx) && (i<nc) ; cx++ , i++ );
return( (i==nc) ? NULL : cx );
}
clean()
{
/* restore trap vectors */
}
display(cx, dap)
char *cx;
char **dap;
{
/* display memory in hex and ascii */
short int format; /* 1=byte, 2=word, 4=long word */
char *s; /* start address */
char *f; /* end address */
char *i; /* working variable */
char *j; /* ditto */
short int c; /* column number */
/* parse command and extract parameters */
format = getform(&cx);
if ( ! gethex(&cx, &s) ) { /* get start address */
if ( nomore(cx) ) s = *dap; /* or use default */
else { bad(); return(0); } /* junk on the line */
}
if ( (format != 1) && (s & 1) ) s += 1; /* force even */
if ( GETSEP ) {if ( ! gethex(&cx, &f) ) {bad(); return;} }
else f = s + (12*16-1); /* not there, use def */
if ( ! nomore(cx) ) {bad(); return;} /* rest of line must be empty */
/* now do the display */
f = f - format + 1; /* first byte of last chunk to print */
for ( ; s <= f ; s += 16 ) { /* one line per pass */
if ( keyhit() ) return;
puthexl(s); putchar(' '); putchar(' '); c = 10;
for ( i=s, j=min(s+15,f);
i <= j;
i += format ) {
switch ( format ) {
case 1 : puthexb(i->memb);
break;
case 2 : puthexw(i->memw);
break;
case 4 : puthexl(i->meml);
break;
} /* end of switch */
putchar(' ');
c += (2*format+1);
} /* end of loop across line */
while ( c++ < 60 ) putchar(' ');
for ( i=s, j=min(s+15,f); i<=j ; i++ ) putbyte(*i);
putchar('\n');
} /* end of loop through lines */
*dap = f + format;
} /* end display */
ecmd(cx, basep, statep, valuep, dap, lap, bppa)
char *cx;
struct basepage *basep;
struct cpustate *statep;
struct value *valuep;
char **dap;
char **lap;
long *bppa;
{
/* Load the program named in the command */
struct fcb pgmfcb;
deblank(&cx);
if (parse(&cx, &pgmfcb, "68K") && nomore(cx))
loadpgm ( &pgmfcb, basep, statep, valuep, dap, lap, bppa);
else bad();
}
loadpgm(fcbp, basep, statep, valuep, dap, lap, bppa)
struct fcb *fcbp;
struct basepage *basep;
struct cpustate *statep;
struct value *valuep;
char **dap;
char **lap;
long *bppa;
{
/* load a program for execution */
struct lpb pgmlpb;
int loaderr;
struct basepage *newbp;
long *stkptr;
int i;
/* open program file */
while(1)
{
if ( (BDOS(OPEN, fcbp) & 0xffL) == 0x0FFL )
{
if(fcbp->t[0] != ' ')
{ /* open failed */
stout("Cannot open program file\n");
return;
}
else
{
fcbp->t[0] = '6';
fcbp->t[1] = '8';
fcbp->t[2] = 'K';
}
}
else
break;
}
/* set up lpb */
pgmlpb.fcbaddr = fcbp;
pgmlpb.tpabase = basep->lowtpa;
pgmlpb.tpatop = basep;
pgmlpb.flags = 0;
/* now do program load */
loaderr = (int)(BDOS(PGMLOAD, &pgmlpb) & 0x0FFFFL);
switch ( loaderr ) {
case 0: { /* successful */
newbp = pgmlpb.bpaddr;
valuep->kind = 1;
valuep->textbase = newbp->csstart;
valuep->textlen = newbp->cslen;
valuep->database = newbp->dsstart;
valuep->datalen = newbp->dslen;
valuep->bssbase = newbp->bsstart;
valuep->bsslen = newbp->bslen;
valuep->bpa = newbp;
valuep->initstk = pgmlpb.stkinit;
statep->pc = newbp->csstart;
stkptr = pgmlpb.stkinit;
(*--stkptr) = newbp;
(*--stkptr) = *--bppa;
statep->usp = stkptr;
statep->areg[7]= stkptr;
statep->status = 0;
*dap = newbp->csstart;
*lap = newbp->csstart;
newbp->fcb1.dr = 0;
newbp->fcb2.dr = 0;
for ( i = 0; i < 11; ++i) {
newbp->fcb1.fn[i] = ' ';
newbp->fcb2.fn[i] = ' ';
}
newbp->fcb1.cr = 0;
newbp->fcb2.cr = 0;
newbp->fcb1.ex = 0;
newbp->fcb2.ex = 0;
}
break; /* end case 0 -- success */
case 1: { stout("Insufficient memory or bad file header\n");
return;
}
break;
case 2: { stout("Read error\n");
return;
}
break;
case 3: { stout("Bad relocation bits\n");
return;
}
break;
default: { stout("Unknown program load error\n");
return;
}
break;
} /* end switch */
showvals(valuep);
} /* end loadpgm */
fillmem(cx)
char *cx;
{
/* fill memory with constant */
register short int format; /* 1=byte, 2=word, 4=long word */
char *s; /* start address */
char *f; /* end address */
long v; /* value to stuff into memory */
/* parse command and extract parameters */
format = getform(&cx);
if ( gethex(&cx, &s) ); /* get start address */
else {bad(); return(0);} /* not there, error */
if ( (format != 1) && (s & 1) ) /* must be even address, error */
{bad(); return(0);}
if ( GETSEP && gethex(&cx, &f) ); /* get end address */
else { bad(); return(0); } /* not there, error */
if ( GETSEP && gethex(&cx, &v) ); /* get value to stuff */
else { bad(); return(0); }
if ( ! nomore(cx) ) {bad(); return;} /* rest of line must be empty */
if ((s>f) || /* test for junk or nonsense */
( (format == 1) && ((v > 255L) || (v < 0)) ) ||
( (format == 2) && ((v > 65535L) || (v < 0)) ) )
{ bad(); return(0); }
/* now do the stuffing */
for ( ; (s+format) <= (f+1); s += format )
{
switch ( format ) {
case 1 : s->memb = (char)v;
if ((s->memb ^ (char)v) & 0xFF) badram(s);
break;
case 2 : s->memw = (short int)v ;
if ((s->memw ^ (short int)v) & 0xFFFF) badram(s);
break;
case 4 : s->meml = (long)v ;
if ( s->meml != v ) badram(s);
break;
} /* end of switch */
} /* end of for */
} /* end of fillmem */
/**/

View File

@@ -0,0 +1,438 @@
/****************************************************************/
/* */
/* DDT-68K (tm) */
/* */
/* Copyright 1982, Digital Research */
/* */
/****************************************************************/
#include "ddtinc.h"
#include "stdio.h"
#include "bdosfunc.h"
#include "disas.h"
gocmd(cx, statep) /* begin executing (with optional breakpoints) */
char *cx;
struct cpustate *statep;
{
int nbp;
long brkpt[MAXBP];
short brkwd[MAXBP];
long newpc;
long x;
int i;
deblank(&cx);
newpc = statep->pc;
if (gethex(&cx, &x)) newpc = x;
nbp = 0;
while ( GETSEP ) {
if (nbp >= MAXBP) {bad(); return;}
else { if (gethex(&cx,&x)) brkpt[nbp++]=x;
else {bad(); return;}
}
}
if ( ! nomore(cx) ) {bad(); return(0);}
/* now set up brkpts and go */
for (i=0; i<nbp; i++) {
brkwd[i]=(brkpt[i])->memw;
brkpt[i]->memw = ILLEGAL;
}
statep->pc = newpc;
GO(statep);
for (i=0; i<nbp; i++) brkpt[i]->memw = brkwd[i];
showstate(statep);
} /* end of go command */
hexmath(cx) /* print sum and difference of operands */
char *cx;
{
long a, b;
deblank(&cx);
if ( gethex(&cx, &a) && GETSEP && gethex(&cx, &b) && nomore(cx) ) {
puthexl(a+b);
putchar(' ');
puthexl(a-b);
putchar('\n');
}
else bad();
}
incomtl(cx, valuep)
char *cx;
struct value *valuep;
{
/* process command tail */
register char *p;
register char *q;
register char nc;
register struct basepage *bpp;
if ( (valuep->kind) != 1 ) {bad(); return;} /* no pgm loaded */
bpp = valuep->bpa;
p = cx + 1;
q = &(bpp->comtail[1]);
nc = 0;
while (*p) { *q++ = *p++; nc += 1;}
*q = *p;
bpp->comtail[0] = nc;
if ( parse(&cx, &(bpp->fcb1), " ") && GETSEP )
parse(&cx, &(bpp->fcb2), " ");
}
disasm(cx, dap)
char *cx;
char **dap;
{
/* display memory in assembly format */
char *s; /* start address */
char *f; /* end address */
register short int deflt; /**/
register short int nl; /**/
/* parse command and extract parameters */
deblank(&cx);
if ( ! gethex(&cx, &s) ) { /* get start address */
if (nomore(cx)) s = *dap; /* or use default */
else {bad(); return(0);} /* junk on the line */
}
if ( s & 1) { bad(); return(0);} /* must use even address */
if ( GETSEP ) { /* get end address */
if ( gethex(&cx, &f) ) deflt=0; /* got it */
else { bad(); return(0); }
}
else { f = s; deflt = 1; } /* not there, use def */
if((!nomore(cx)) || (s>f)) {bad(); return(0);} /* junk or nonsense */
/* now do the display */
nl = 0;
while ( (s<=f) || (deflt && (nl<12)) ) {
if ( keyhit() ) return;
puthexl(s); putchar(' ');
dot = s;
pinstr();
putchar('\n');
s += dotinc;
nl++;
*dap = s;
} /* end of loop through instructions */
} /* end disassembly */
movemem(cx)
char *cx;
{
/* move memory block */
char *s; /* start address */
char *f; /* end address */
char *d; /* destination address */
/* parse command and extract parameters */
deblank(&cx);
if ( gethex(&cx, &s) ); /* get start address */
else {bad(); return(0);} /* not there, error */
if ( GETSEP && gethex(&cx, &f) ); /* get end address */
else { bad(); return(0); } /* not there, error */
if ( GETSEP && gethex(&cx, &d) ); /* get dest address */
else { bad(); return(0); }
if ((!nomore(cx)) || (s>f) ) /* test for junk or nonsense */
{ bad(); return(0); }
/* now do the moving */
for ( ; s <= f; s++, d++ ) d->memb = s->memb;
} /* end of movemem */
readfl(cx, basep, valuep, dap)
char *cx;
struct basepage *basep;
struct value *valuep;
char **dap;
{
/* read a file into memory */
struct fcb fcb1;
long lotpa;
long hitpa;
long curdma;
int endofile;
deblank(&cx);
if ( parse(&cx, &fcb1, " ") && nomore(cx))
{
if ( (BDOS(OPEN, &fcb1) & 0xffL) == 0xffL) /* open failed */
{
stout("Cannot open file\n");
return;
}
fcb1.cr = 0;
lotpa = basep->lowtpa;
hitpa = basep;
curdma = lotpa;
endofile = 0;
while ( (! endofile) && (curdma+128 <= hitpa) )
{
/* read a sector */
BDOS(SETDMA, curdma);
endofile = (BDOS(READSEQ, &fcb1) & 0xffL);
curdma += 128;
}
if ( ! endofile ) stout("\nFile too big -- read truncated.\n");
valuep->kind = 2;
valuep->textbase = lotpa;
valuep->textlen = curdma - lotpa - 128;
showvals(valuep);
*dap = lotpa;
}
else bad(); /* parsing error */
}
setmem(cx)
char *cx;
{
/* set memory */
register short int format; /* 1=byte, 2=word, 4=long word */
char *s; /* start address */
long v; /* value to stuff into memory */
char buf[BUFLEN]; /* input buffer */
char *bx; /* points into buf */
short int nc; /* num of hex digits input */
/* parse command and extract parameters */
format = getform(&cx);
if ( gethex(&cx, &s) ); /* get start address */
else {bad(); return(0);} /* not there, error */
if ( (format != 1) && (s & 1) ) /* must be even address, error */
{bad(); return(0);}
if (!nomore(cx)) { bad(); return(0); } /* test for junk */
/* now do the stuffing */
for ( ; ; s += format ) {
puthexl(s); putchar(' ');
switch ( format ) {
case 1: puthexb(s->memb);
break;
case 2: puthexw(s->memw);
break;
case 4: puthexl(s->meml);
break;
} /* end of switch */
putchar(' ');
*buf = BUFLEN - 2;
BDOS ( READBUF, buf );
putchar('\n');
buf[2+(nc=buf[1])] = 0;
if ( nc > 0 ) {
if ( buf[2] == '.' ) {return(0);}
for ( bx = &buf[1] ; *++bx ; ) *bx = toupper(*bx) ;
bx = &buf[1];
if ( gethex( &bx, &v ) );
else { bad(); return(0); }
while ( (*++bx) == 0x20 ) ; /* skip blanks */
if ( (*bx != 0) || /* test for bad input */
( (format == 1) && ((v>255L) || (v<0)) ) ||
( (format == 2) && ((v>65535L) || (v<0)) ) )
{ bad(); return(0); }
/* stuff the value */
switch ( format ) {
case 1 : s->memb = (char)v ;
if ( (s->memb ^ v) & 0x0ffL ) badram(s);
break;
case 2 : s->memw = (short int)v ;
if ( (s->memw ^ v) & 0x0ffffL ) badram(s);
break;
case 4 : s->meml = (long)v ;
if ( s->meml ^ v ) badram(s);
break;
} /* end of switch */
} /* end of nc > 0 */
} /* end of for */
} /* end of setmem */
trace(cx, statep, dap, tr)
char *cx;
struct cpustate *statep;
char **dap;
int tr;
{
/* trace program execution for n steps */
long nsteps;
register int inst;
register long addr;
deblank(&cx);
if ( ! gethex(&cx, &nsteps)) nsteps = 1;
if ( ! nomore(cx) ) {bad(); return;}
while ( nsteps-- ) {
inst = (addr = (statep->pc))->memw;
if ( (inst == BDOSCALL) || (inst == BIOSCALL) )
{
/* don't trace through system calls */
inst = (addr += 2)->memw;
addr->memw = ILLEGAL;
GO(statep);
addr->memw = inst;
}
else STEP(statep);
if (tr) showstate(statep);
if ( keyhit() ) nsteps = 0;
}
if ( ! tr ) showstate(statep);
*dap = statep->pc;
}
vcmd(cx, valuep)
char *cx;
struct value *valuep;
{
/* display start and end of stuff loaded with R or E commands */
if (nomore(cx)) showvals(valuep);
}
wrtfile(cx, valuep)
char *cx;
struct value *valuep;
{
/* write memory contents to disk */
struct fcb fcb1;
long s;
long f;
deblank(&cx);
if ( ! parse(&cx, &fcb1, " ") ) {bad(); return;}
if ( nomore(cx) ) /* use default start and end */
{
if ( (valuep->kind) != 2 ) {bad(); return;}
s = valuep->textbase;
f = s + valuep->textlen - 1;
}
else /* try to parse s & f values */
{
if ( ( ! GETSEP ) || ( ! gethex(&cx, &s) ) ||
( ! GETSEP ) || ( ! gethex(&cx, &f) ) ||
( ! nomore(cx) ) ) {bad(); return;}
}
BDOS(DELETE, &fcb1);
if ( (BDOS(MAKEFILE, &fcb1) & 0xffL) == 0xffL )
{
stout("Cannot create file.\n");
return;
}
fcb1.cr = 0;
while ( s <= f )
{
BDOS(SETDMA, s);
if ( BDOS(WRITSEQ, &fcb1) & 0xffL )
{
stout("File write error.\n");
s = f + 1;
}
s += 128;
}
BDOS(CLOSE, &fcb1);
}
int dummy(s)
char *s;
{
stout("\n\nUnimplemented Function: ");
stout(s);
stout("\n\n");
}
/**/

View File

@@ -0,0 +1,138 @@
/********************************************************/
/* */
/* Stuff to INCLUDE in DDT-68K */
/* */
/********************************************************/
#define MAXBP 10 /* max breakpoints allowed */
#define ILLEGAL 0x4AFC /* ILLEGAL instruction */
#define BDOSCALL 0x4E42 /* TRAP #2 instruction */
#define BIOSCALL 0x4E43 /* TRAP #3 instruction */
#define BUFLEN 85 /* command buffer length */
#define GETSEP getsep(&cx)
struct bytestr { char memb; };
struct wordstr { int memw; };
struct longstr { long meml; };
/****************************************************************/
/* */
/* Define the CPU Status Structure and Related Tables */
/* */
/****************************************************************/
struct cpustate {
long pc;
long usp;
long ssp;
int status;
long dreg[8];
long areg[8];
};
#define TRACE 0x8000
#define SUPER 0x2000
#define INTMSK 0x0700
#define EXTEND 0x0010
#define NEG 0x0008
#define ZERO 0x0004
#define OFLOW 0x0002
#define CARRY 0x0001
/****************************************************************/
/* */
/* Define FCB Structure */
/* */
/****************************************************************/
struct fcb {
char dr; /* drive code */
char fn[8]; /* file name */
char t[3]; /* file type */
char ex; /* extent */
char s1; /* used by sys */
char s2; /* used by sys */
char rc; /* rec count */
char d[16]; /* used by sys */
char cr; /* curr rec no */
char r[3]; /* rand rec no */
};
/****************************************************************/
/* */
/* Base Page Structure */
/* */
/****************************************************************/
struct basepage {
long lowtpa; /* low address of tpa */
long hightpa; /* high address of tpa */
long csstart; /* start of code seg */
long cslen; /* length of code seg */
long dsstart; /* start of data seg */
long dslen; /* length of data seg */
long bsstart; /* start of bss seg */
long bslen; /* length of bss seg */
long freelen; /* free mem after bss */
long reserved[5];
struct fcb fcb2;
struct fcb fcb1;
char comtail[80];
};
/************************************************************************/
/* */
/* Define a structure for holding information about the most */
/* recently loaded program or file */
/* */
/************************************************************************/
struct value {
int kind; /* 0 => none, 1 => pgm, 2 => file */
long textbase; /* if kind==2 then use textseg for file */
long textlen;
long database;
long datalen;
long bssbase;
long bsslen;
long bpa;
long initstk;
};
/************************************************************************/
/* */
/* Define the Load Program Parameter Block */
/* */
/************************************************************************/
struct lpb {
struct fcb *fcbaddr;
long tpabase;
long tpatop;
long *bpaddr;
long stkinit;
int flags;
};
/****************************************************************/
/* */
/* Some Forward Function Definitions */
/* */
/****************************************************************/
char *readcom();
char hexchar();
short int getform();
long int GETSSP();
/**/

View File

@@ -0,0 +1,8 @@
$ set def [bill.cpm68k.ddt]
$ cc68 :== @cc68.com
$ assign drb0:[steve.bin] bin:
$ assign drb0:[steve.lib] lib:
$ as68 :== $bin:as68.exe;17
$ ld68 :== $bin:lo68.exe
$ ld68 -r -o ddt.68k ddt1.o ddt2.o ddtutil.o disasm.o environ.o -
examine.o bdos.o

View File

@@ -0,0 +1,197 @@
*****************************************************************
* *
* DDT Loader -- This program loads DDT at the top of *
* the TPA, hands it its command tail, and passes control *
* to it. *
* *
*****************************************************************
*
.text
*
start: move.l (a7)+,ccprtn * save stacked info
move.l (a7)+,bpaddr
*
lea mystack+$80,a7 * switch to local stack
*
move.l bpaddr,a0 * copy base page to local area
lea localbp,a1
move.l #$100,d0 * count of bytes to move
bsr copy * branch to subroutine
*
move.w #32,d0 * get the current user # and save it
move.l #$ff,d1 * d1 = 255
trap #2 * call the bdos
move.l d0,d3 * d3 holds current user #
*
move.l bpaddr,a0 * get drive for DDT1
move.b $24(a0),ddt1fcb * and stuff into FCB
move.w #openf,d0 * open file DDT1.68K
move.l #ddt1fcb,d1 * get address of fcb
trap #2 * call the bdos
cmpi.b #$ff,d0 * check for failure
bne openok * if not then go ahead
*
tst d3 * check if we are on user 0
beq loadfail * if so then we have failed
*
move.w #32,d0 * if not then switch to user 0
clr.l d1 * d1 = 0
trap #2 * call the bdos
*
move.w #openf,d0 * try the open again
move.l #ddt1fcb,d1 * address of fcb
trap #2 * call the bdos
cmpi.b #$ff,d0 * check for errors
beq loadfail * error, load failed
*
openok: move.w #setdma,d0 * set up to read pgm header
move.l #dskbuf,d1 * dma address
trap #2 * call the bdos
*
move.w #readseq,d0 * read the header
move.l #ddt1fcb,d1 * address of fcb
trap #2 * call the bdos
cmpi.w #0,d0 * check for errors
bne loadfail * error, load failed
*
lea dskbuf,a0
move.l tsize(a0),d0 * compute size of DDT1.68K
add.l dsize(a0),d0 * by adding component sizes
add.l bsize(a0),d0
add.l #$1000,d0 * fake stack size since Belton doesnt
add.l #bplen+fudge,d0
*
cmpi.w #goodmgc,magic(a0) * must be $601A
bne loadfail
*
tst.w rlbflg(a0) * must be 0
bne loadfail
*
lea localbp,a0
lea lpb,a1
lea ddt1fcb,a2
move.l a2,lpbfcb(a1)
move.l bphitpa(a0),d1 * set up lpb and load pgm
move.l d1,lpbhitpa(a1)
sub.l d0,d1
bclr.l #0,d1
move.l d1,lpblotpa(a1)
clr.w lpbcf(a1)
clr.b ddt1fcb+fcbcr
move.w #pgmldf,d0 * now do load
move.l a1,d1
trap #2
tst.w d0
bne loadfail * load has failed
*
move.l d3,d1 * restore the old user 0
move.w #32,d0 * get bdos function #
trap #2 * call the bdos
*
* set up for ddt execution
*
move.l lpbbpa(a1),a2 * addr of new bp
move.l bplotpa(a0),bplotpa(a2) * copy tpa lower bound
move.l lpbdusp(a1),a7 * default user stack ptr
move.l a2,-(a7) * stack new bp address
move.l ccprtn,-(a7) * stack ccp rtn address
move.l bpcsstrt(a2),-(a7) * stack entry to ddt1
lea bpfcb2(a0),a0 * copy parsed fcb's &
lea bpfcb2(a2),a1 * command tail to new bp
move.l #bplen-bpfcb2,d0
bsr copy
rts * exit to ddt1
*
* BDOS Function Code Equates
*
prstrng = 9
openf = 15
closef = 16
readseq = 20
setdma = 26
bioscall= 50
pgmldf = 59
*
*
* Local Variables etc.
*
mystack: .ds.l $20 * local stack
*
fudge = $10
*
bplen = $100
localbp: .ds.l bplen * local copy of base page
bplotpa = 0
bphitpa = 4
bpcsstrt= 8
bpcslen = $C
bpdsstrt= $10
bpdslen = $14
bpbsstrt= $18
bpbslen = $1C
bpfcb2 = $38
bpfcb1 = $5C
*
ccprtn: .ds.l 1 * return addr in CCP
bpaddr: .ds.l 1 * base page address
*
ddt1fcb: .dc.b 0 * FCB for DDT1.68K
.dc.b 'DDT1 68K' * file name and type
.dc.b 0 * extent
.dc.b 0,0 * s1, s2
.dc.b 0 * rc
.ds.b 16 * d0 ... dn
.dc.b 0 * cr
.ds.b 0,0,0 * random record number
*
.even
*
fcbcr = 32
*
dskbuf: .ds.w 64 * used to hold pgm header
magic = 0 * offsets in pgm header
tsize = 2
dsize = 6
bsize = 10
stksize = 18
rlbflg = 26
*
goodmgc = $601A * legal value for magic number
*
*
*
lpb: .ds.w 11 * loader parameter block
lpbfcb = 0
lpblotpa= 4
lpbhitpa= 8
lpbbpa = 12
lpbdusp = 16
lpbcf = 20
*
*
* Copy Bytes from (a0)+ to (a1)+ for d0
*
copy: subi.l #1,d0
bmi copyxit
copylp: move.b (a0)+,(a1)+
dbf d0,copylp
copyxit: rts
*
*
* Can't Load DDT1.68K, Print Error Message
*
loadfail: move.w #prstrng,d0
move.l #loaderr,d1
trap #2
move.l ccprtn,-(a7)
rts
*
.data
loaderr: .dc.b 13,10,'Cannot load DDT1.68K.',13,10,'$'
*
copyrt: .dc.b 'Copyright 1983, Digital Research.'
serial: .dc.b 'XXXX-0000-654321'
*
*
.end

View File

@@ -0,0 +1,21 @@
$ set noon
$ set def [bill.cpm68k.ddt]
$ cc68 :== @cc68.com
$ assign drb0:[steve.bin] bin:
$ assign drb0:[steve.lib] lib:
$ as68 :== $bin:as68.exe
$ ld68 :== $bin:lo68.exe
$ cc68 ddt1
$ cc68 ddt2
$ cc68 ddtutil
$ cc68 disasm
$ as68 -u -l -p bdos.s >bdos.lis
$ ld68 -r -o ddt1.68k ddt1.o ddt2.o ddtutil.o disasm.o bdos.o
$ as68 -u -l -p ddtload.s >ddtload.lis
$ ld68 -r -o ddt.68k ddtload.o
$ r conv
ddt1.68k
ddt1.cnv
$ r conv
ddt.68k
ddt.cnv

View File

@@ -0,0 +1,28 @@
$set def [bill.cpm68k.ddt]
$num
ddt1.c
ddt1.num
$num
ddt2.c
ddt2.num
$num
ddtutil.c
ddtutil.num
$num
disasm.c
disasm.num
$num
ddtinc.h
ddtinc.num
$num
disas.h
disas.num
$num
optab.h
optab.num
$num
bdosfunc.h
bdosfunc.num
$num
stdio.h
stdio.num

View File

@@ -0,0 +1,2 @@
$pr/dev=lpb0 ddt1.c,ddt2.c,ddtutil.c,disasm.c,bdos.s, -
ddtinc.h,disas.h,optab.h,bdosfunc.h,stdio.h,ddtload.s

View File

@@ -0,0 +1,530 @@
/****************************************************************/
/* */
/* DDT-68K (tm) Utility Procedures */
/* */
/* Copyright 1982, Digital Research */
/* */
/****************************************************************/
#include "ddtinc.h"
#include "stdio.h"
#include "bdosfunc.h"
#include "disas.h"
putchar(x)
register char x;
{
BDOS(CONOUT, (long)x);
if (x == '\n') BDOS(CONOUT, (long)'\r');
}
int stout(s) /* write a string */
register char *s;
{
register int nc;
nc = 0;
while ( *s ) { putchar( *s++ ); nc++; }
return(nc);
}
int gethex ( cpp, np ) /* get longest possible hex number from string */
char **cpp; /* +*cpp, and store it in *np. return # of digits */
long *np;
{
register char *cp;
register long n;
register short int nd;
for ( n=0, nd=0, cp = *cpp;
ishex(*++cp);
nd++, n=(n<<4)+hexval(*cp) );
*cpp = --cp;
*np = n;
return(nd);
}
int ishex ( c )
register char c;
{
return ( ( ('0'<=c) && (c<='9') ) || ( ('A'<=c) && (c<='F') ) );
}
int hexval ( c )
register char c;
{
if ( ('0'<=c) && (c<='9') ) return ( c-'0');
else return ( 10 + c - 'A' );
}
char hexchar(n)
register char n;
{
return ( n<10 ? '0'+n : 'A'+n-10 );
}
int puthex(n, i, zs)
register long n;
register int i;
register int zs;
{
register char d;
while ( i >= 4 )
{
i -= 4;
d = hexchar( (char)((n>>i) & 0xf) );
if ( d != '0' ) zs = 0;
if ( (! zs) || (! i) ) putchar(d);
}
}
int puthexl(n) /* write a long integer in hex */
long n;
{
puthex(n, 32, 0);
}
int puthexw(n) /* write an integer in hex */
short int n;
{
puthex((long)n, 16, 0);
}
puthexb(n) /* write a byte in hex */
char n;
{
puthex((long)n, 8, 0);
}
int putbyte(c) /* write an ascii byte. if not printable, write '.' */
register char c;
{
char d[2];
d[1] = 0;
d[0] = ( ( (c < 0x20) || (c > 0x7E) ) ? '.' : c );
stout(d);
}
bad()
{
stout("?\n");
}
badram(a)
long a;
{
stout("Bad or non-existent RAM at ");
puthexl(a);
putchar('\n');
}
nomore(cx)
char *cx;
{
++cx;
while (*cx)
{
if (*cx != ' ') return(0);
else ++cx;
}
return(1);
}
getsep(cxp)
register char **cxp;
{
register char *cx;
cx = (*cxp) + 1;
if ((*cx != ' ') && (*cx != ',')) return(0);
while ( *cx == ' ' ) ++cx;
if ( ! *cx ) return(0);
if ( *cx != ',' ) {*cxp = --cx; return(1);}
++cx;
while ( *cx == ' ' ) ++cx;
*cxp = --cx;
return(1);
}
deblank(cxp)
register char **cxp;
{
++*cxp;
while ( **cxp == ' ' ) ++*cxp;
--*cxp;
}
short int getform(cxp)
register char **cxp;
{
register char *cx;
register short int format;
cx = *cxp;
if ( *++cx == 'W' ) format = 2;
else if ( *cx == 'L' ) format = 4;
else { format = 1; cx--; }
*cxp = cx;
deblank(cxp);
return(format);
}
parse(cxp, fcbp, dtp)
register char **cxp;
struct fcb *fcbp;
char *dtp;
{
/* parse a filename into an fcb */
register char *cx;
register char c;
register int n;
fcbp->ex = 0;
fcbp->cr = 0;
cx = *cxp;
c = *++cx;
if ( ! (isalpha(c) || isdigit(c) || iswild(c))) return(0);
if ( *(cx+1) == ':' ) {fcbp->dr = c - 'A' + 1; cx += 2; }
else fcbp->dr = 0;
n = 0;
c = *cx;
while (isalpha(c) || isdigit(c) || iswild(c)) {
if ( n >= 8 ) return(0);
if(c == '*')
{
while(n < 8)
fcbp->fn[n++] = '?';
c = *++cx;
break;
}
fcbp->fn[n++] = c;
c = *++cx;
}
while ( n < 8 ) fcbp->fn[n++] = ' ';
for (n = 0; n < 3; ++n) {
if (*dtp) fcbp->t[n] = *dtp++;
else fcbp->t[n] = ' ';
}
if (*cx != '.') {*cxp = --cx; return(1);}
n = 0;
c = *++cx;
while ( isalpha(c) || isdigit(c) || iswild(c)) {
if ( n >= 3 ) return(0);
if(c == '*')
{
while(n < 3)
fcbp->t[n++] = '?';
c = *++cx;
break;
}
fcbp->t[n] = c;
++n;
c = *++cx;
}
while ( n < 3 ) fcbp->t[n++] = ' ';
*cxp = --cx;
return(1);
} /* end of parse fcb */
int keyhit()
{
if ( BDOS(CONSTAT, 0L) & 0xFFFFL ) {
BDOS(CONIN, 0L);
return(1);
}
else return(0);
}
showvals(vp)
register struct value *vp;
{
register int i, j;
register long * lp;
switch ( vp->kind )
{
case 0: stout("\nERROR, no program or file loaded.\n");
break;
case 1: /* do program vals */
for ( i = 0; i < 2; ++i )
{
lp = &(vp->textbase);
lp += i;
for (j = 0; j < 3; ++j)
{
switch ( j )
{
case 0: stout("text "); break;
case 1: stout("data "); break;
case 2: stout("bss "); break;
}
switch ( i )
{
case 0: stout(" base "); break;
case 1: stout(" length"); break;
}
stout(" = ");
puthexl(*lp);
lp += 2;
stout(" ");
}
putchar('\n');
}
stout("base page address = ");
puthexl(vp->bpa);
stout(" initial stack pointer = ");
puthexl(vp->initstk);
break; /* end of program values */
case 2: /* do file values */
stout("Start = ");
puthexl(vp->textbase);
stout(" End = ");
puthexl((vp->textbase)+(vp->textlen)-1L);
break;
}
putchar('\n');
} /* end of showvals */
/**/
/****************************************************************/
/* */
/* Examine/Alter CPU Registers */
/* */
/****************************************************************/
examine(cx, statep)
char *cx;
struct cpustate *statep;
{
if (nomore(cx)) showstate(statep);
else if (*++cx == 'D') pdareg('D', cx, statep->dreg);
else if (*cx == 'A') pdareg('A', cx, statep->areg);
else if (cmp("PC",--cx)) pregl("PC", &(statep->pc));
else if (cmp("USP",cx)) { if (pregl("USP",&(statep->usp)) &&
((statep->status & SUPER) == 0 ))
statep->areg[7] = statep->usp;
}
else if (cmp("SSP",cx)) { if (pregl("SSP",&(statep->ssp)) &&
(statep->status & SUPER) )
statep->areg[7] = statep->ssp;
}
else if (cmp("ST", cx)) { pregw("ST",&(statep->status) );
if ( statep->status & SUPER) statep->areg[7] = statep->ssp;
else statep->areg[7] = statep->usp;
}
else bad();
if ( statep->status & SUPER) statep->ssp = statep->areg[7];
else statep->usp = statep->areg[7];
}
showstate(statep)
register struct cpustate *statep;
{
register short int status;
stout("PC="); puthexl(statep->pc); putchar(' ');
stout("USP="); puthexl(statep->usp); putchar(' ');
stout("SSP="); puthexl(statep->ssp); putchar(' ');
stout("ST="); puthexw(status = statep->status);
stout("=>");
if (status & TRACE) stout("TR ");
if (status & SUPER) stout("SUP ");
stout("IM="); putchar(((status & INTMSK)>>8)+'0');
if (status & EXTEND) stout(" EXT");
if (status & NEG) stout(" NEG");
if (status & ZERO) stout(" ZER");
if (status & OFLOW) stout(" OFL");
if (status & CARRY) stout(" CRY");
putchar('\n');
preglrow('D', statep->dreg); /* D registers */
preglrow('A', statep->areg); /* A registers */
dot = statep -> pc;
pinstr(); /* disassembled instruction */
putchar('\n');
}
pdareg(da, cx, rp) /* print data or address register contents */
char da;
register char *cx;
long *rp;
{
char str[3];
if ( ('0' <= *++cx) && (*cx <= '7') && nomore(cx) ) {
str[0] = da;
str[1] = *cx;
str[2] = 0;
pregl(str, rp + *cx - '0');
}
else bad();
}
pregl(rname, regp) /* print register contents as long */
char *rname;
long *regp;
{
return( preg(rname, regp, 4) );
}
pregw(rname, regp) /* print register contents as word */
char *rname;
long *regp;
{
return( preg(rname, regp, 2) );
}
preg(rname, regp, size) /* print register contents */
register char *rname;
register long *regp;
register int size;
{
char buf[BUFLEN];
register short int nc;
long int newval;
char *bp;
register int modify;
modify = 0;
stout(rname);
putchar('=');
switch(size)
{
case 1 : puthexb(regp->memb);
break;
case 2 : puthexw(regp->memw);
break;
case 4 : puthexl(regp->meml);
break;
}
putchar(' ');
*buf = BUFLEN-2;
BDOS(READBUF, buf);
putchar('\n');
if ((nc=buf[1])>0) {
buf[nc+2]=0;
bp = buf + 1;
while (*++bp) *bp = toupper(*bp);
bp = buf + 1;
if (gethex(&bp, &newval) && nomore(bp)) {
switch(size)
{
case 1 : regp->memb = (char)(newval & 0xffL);
break;
case 2 : regp->memw = (int)(newval & 0xffffL);
break;
case 4 : regp->meml = newval;
break;
}
modify = 1;
}
else if ( ! nomore(buf+1) ) bad();
}
return(modify);
}
preglrow(ch, rowp)
char ch;
long *rowp;
{
register int n;
putchar(ch);
putchar(' ');
for (n=0; n<8; n++) {
putchar(' ');
puthexl(*rowp++);
if (n==3) putchar(' ');
}
putchar('\n');
}
tryflags(cx, statep)
register char *cx;
register struct cpustate *statep;
{
bad();
}
cmp(str, ctl)
register char *str;
register char *ctl;
{
while (*str && (*str++ == *++ctl)) ;
if ( ( ! *str) && nomore(ctl) ) return(1);
else return(0);
}
/****************/

View File

@@ -0,0 +1,76 @@
#
/*
Copyright 1981
Alcyon Corporation
8474 Commerce Av.
San Diego, Ca. 92121
*/
#define NUMSS 1 /*number of special symbols*/
#define SSRG 0 /*max symbol offset to display symbolically*/
#define LSTENT 12
struct symtab {
char syname[8];
char *syval;
};
struct {
int hiword;
int loword;
};
char *symbuf; /*start of symbol table*/
char *esymbuf; /*end of symbol table*/
int *symptr;
int errflg;
/* the following definitions must not be changed -- esp. the order */
int symlen;
int symct;
char ssymbol[8];
int ssymflg;
char *ssymval;
/* end of order dependant declarations */
char *dot;
char *tdot;
int dotinc;
char *sdot; /* symbolic operand temporary dot */
int textsym;
#define TEXTS 01000
#define DATAS 02000
#define BSSS 0400
#define ABSS 03400
char tsym[10];
char fsymbol[10];
int seffadr, sefaflg; /* effective address search variables */
int ssval[NUMSS]; /* special symbol values */
int instr; /* holds instruction first word */
#define BYTE 0
#define WORD 1
#define LONG 2
/* flags for symbols */
# define SYDF 0100000 /* defined */
# define SYEQ 0040000 /* equated */
# define SYGL 0020000 /* global - entry or external */
# define SYER 0010000 /* equated register */
# define SYXR 0004000 /* external reference */
# define SYDA 0002000 /* DATA based relocatable */
# define SYTX 0001000 /* TEXT based relocatable */
# define SYBS 0000400 /* BSS based relocatable */
struct { /* NOT PORTABLE !!!!!! */
char hibyte;
char lobyte;
};
#define AREG0 8
#define PC 16
char lbuf[40];

View File

@@ -0,0 +1,817 @@
/*
Copyright 1981
Alcyon Corporation
8474 Commerce Av.
San Diego, Ca. 92121
*/
#include "ddtinc.h"
#include "optab.h"
#include "stdio.h"
#include "bdosfunc.h"
#include "disas.h"
int noin();
int inf1();
int inf2();
int inf3();
int inf4();
int inf5();
int inf6();
int inf7();
int inf8();
int inf9();
int inf10();
int inf11();
int inf12();
int inf13();
int inf14();
int inf15();
int inf16();
int inf17();
int inf18();
int inf19();
int inf20();
int inf21();
int inf22();
int inf23();
int inf24();
int inf25();
int inf26();
int inf27();
int inf28();
/* print an instruction in assembler format */
pinstr()
{
register struct optbl *p;
register short int reg;
sdot=dot+2; /* next word address */
dotinc = 2;
instr=dot->memw; /* instruction in binary */
p = &optab;
while(1) { /* last table entry matches anything */
if((instr&(p->inmsk)) == p->invalu)
break; /* found it */
p++;
}
stout(p->innam); /* print mnemonic */
if(p->infmt>=0 && p->infmt<=MAXFMT) {
if(p->infmt) {
switch ( p->infmt) { /* call proper funct */
case 0 : noin(); break; case 1 : inf1(); break;
case 2 : inf2(); break; case 3 : inf3(); break;
case 4 : inf4(); break; case 5 : inf5(); break;
case 6 : inf6(); break; case 7 : inf7(); break;
case 8 : inf8(); break; case 9 : inf9(); break;
case 10 : inf10(); break; case 11 : inf11(); break;
case 12 : inf12(); break; case 13 : inf13(); break;
case 14 : inf14(); break; case 15 : inf15(); break;
case 16 : inf16(); break; case 17 : inf17(); break;
case 18 : inf18(); break; case 19 : inf19(); break;
case 20 : inf20(); break; case 21 : inf21(); break;
case 22 : inf22(); break; case 23 : inf23(); break;
case 24 : inf24(); break; case 25 : inf25(); break;
case 26 : inf26(); break; case 27 : inf27(); break;
case 28 : inf28(); break;
}
}
putchar(' ');
return;
}
putchar('?');
return;
}
noin()
{
stout("illegal instruction format #\n");
return;
}
inf1()
{
register reg,mode;
reg = ((instr&0xe00)>>9);
if((instr&0xc0) == 0xc0) { /* adda or suba */
putchar('a');
mode=WORD;
if((instr&0x1c0)==0x1c0) { /* long opmode */
mode = LONG;
stout(".l");
}
reg =+ 8;
}
else {
mode = (instr&0xc0)>>6;
prsize(mode);
}
putchar(' ');
if(reg>7 || (instr&0x100)==0) {
prtop(instr&077,mode);
putchar(',');
prtreg(reg);
}
else {
prtreg(reg);
putchar(',');
prtop(instr&077,mode); /* destination */
}
}
/* move instruction */
inf3()
{
register size;
register i;
i = instr&0x3000; /* size field */
if(i==0x1000)
size = BYTE;
else if(i==0x3000)
size = WORD;
else if(i==0x2000)
size = LONG;
else
badsize();
prsize(size);
putchar(' ');
prtop(instr&077,size);
putchar(',');
i = ((instr&07000)>>9) | ((instr&0700)>>3);
prtop(i,size);
}
/* immediate instructions */
inf2()
{
register size;
size = (instr&0xc0)>>6;
prsize(size);
putchar(' ');
primm(size);
putchar(',');
switch(instr)
{
case 0x027c:
case 0x0a7c:
case 0x007c: stout("sr");
break;
case 0x023c:
case 0x0a3c:
case 0x003c: stout("ccr");
break;
default : prtop(instr&077,size);
}
}
/* abcd, addx, sbcd, subx */
inf4()
{
register size,i;
size = (instr&0xc0)>>6;
prsize(size);
putchar(' ');
i = (instr&0xe00)>>9;
if(instr&8) {
paripd(instr&7); putchar(','); paripd(i);
}
else {
pdr(instr&7); putchar(','); pdr(i);
}
}
/* chk, cmp, cmpa, div, mul */
inf5()
{
register i,size,arg;
arg = 0;
i = instr&0xf000;
size = (instr&0x1c0)>>6;
if(i==0xb000) { /* cmp or cmpa */
if(size==3 || size==7) { /* cmpa */
arg++;
size =>> 1;
if(size==3)
size = 2;
}
prsize(size);
}
else
size = WORD;
putchar(' ');
prtop(instr&077,size);
putchar(',');
i = (instr&0xe00)>>9;
if(arg) /* cmpa */
par(i);
else
prtreg(i);
}
prsize(amode)
{
if(amode==BYTE)
stout(".b");
else if(amode==LONG)
stout(".l");
else if(amode!=WORD)
badsize();
}
badsize()
{
stout("\n**illegal size field\n");
}
prtreg(areg)
{
register reg;
reg = areg;
if(reg>7) {
par(reg-8);
}
else {
pdr(reg);
}
}
/* print an operand symbolically */
prtop(adrtype,asize)
{
register short int reg,mode,defer;
long la;
register long p;
mode = (adrtype&070)>>3;
reg = adrtype&7;
switch(mode) {
case 0: /* D reg direct */
pdr(reg);
return;
case 1: /* A reg direct */
par(reg);
return;
case 2: /* A indirect */
pari(reg);
return;
case 3: /* A+ */
paripi(reg);
return;
case 4: /* -(An) */
paripd(reg);
return;
case 5: /* d(an) */
prdisp();
pari(reg);
return;
case 6: /* d(An,Ri) */
prindex(reg);
return;
case 7:
la = 0;
switch(reg) {
case 1: /* xxx.L */
la.hiword = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
la.loword = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
putchar('$');
hexlzs(la);
return;
case 0: /* xxx.W */
p = sdot->memw;
if(p&0x8000)
p =| 0xffff0000; /* sign extend like hard */
sdot =+ 2;
dotinc =+ 2;
hexlzs(p);
return;
case 2: /* d(PC) */
prdisp();
stout("(PC)");
return;
case 3: /* d(PC,Ri) */
prindex(PC);
return;
case 4:
primm(asize);
return;
}
}
}
prdisp()
{
register short int i;
i = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
putchar('$'); hexwzs(i);
}
prindex(areg)
{
register short int i;
i = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
putchar('$');
hexbzs((char)i&0xFF);
putchar('(');
if(areg==PC)
stout("PC,");
else
{par(areg); putchar(',');}
prtreg((i>>12)&0xf);
if(i&0x800)
stout(".l");
putchar(')');
}
primm(asize)
{
long l1;
l1 = 0;
if(asize == LONG) {
l1.hiword = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
}
l1.loword = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
stout("#$");
hexlzs(l1);
}
/* initialize the default special symbol values */
initssv()
{
ssval[SSRG] = 010000; /* symbol range */
}
/* branches & bsr */
inf6()
{
register short int i;
register char *p;
i = instr.lobyte;
if(i) {
p = sdot + i;
}
else {
p = sdot + sdot->memw;
sdot =+ 2;
dotinc =+ 2;
}
stout(" $");
hexlzs(p);
}
/* bchg, bclr, bset, btst */
inf7()
{
putchar(' ');
if(instr&0x100) { /* bit # dynamic */
prtreg((instr&0xe00)>>9);
}
else {
primm(WORD);
}
putchar(',');
prtop(instr&077,WORD);
}
/* shifts and rotates */
inf8()
{
register i,size;
if(instr&0x100)
putchar('l');
else
putchar('r');
size = (instr&0xc0)>>6;
if(size != 3) {
prsize(size);
putchar(' ');
i = (instr&0xe00)>>9;
if(instr&0x20) { /* bit # in reg */
prtreg(i);
}
else {
if(i==0)
i = 8;
putchar('#');
hexbzs(i);
}
putchar(',');
prtreg(instr&7);
}
else {
putchar(' ');
prtop(instr&077,WORD);
}
}
/* jmp, jsr, pea */
inf9()
{
putchar(' ');
prtop(instr&077,WORD);
}
/* cmpm */
inf10()
{
register i;
prsize((instr&0xc0)>>6);
i = (instr&0xe00)>>9;
putchar(' ');
paripi(instr&7); putchar(','); paripi(i);
}
/* dbcc */
inf11()
{
register char *p;
putchar(' ');
prtreg(instr&7);
putchar(',');
p = sdot + sdot->memw;
sdot =+ 2;
dotinc =+ 2;
hexlzs(p);
}
/* exg */
inf12()
{
register rx,ry,i;
rx = (instr&0xe00)>>9;
ry = instr&7;
i = instr&0xf8;
if(i==0x48) { /* exg a regs */
rx =+ AREG0;
ry =+ AREG0;
}
else if(i==0x88) { /* exg a reg & d reg */
ry =+ AREG0;
}
putchar(' ');
prtreg(rx);
putchar(',');
prtreg(ry);
}
/* swap & unlk */
/* called by ext (format 27) */
inf13()
{
putchar(' ');
prtreg(instr&0xf);
}
/* stop */
inf14()
{
putchar(' ');
primm(WORD);
}
/* lea */
inf15()
{
putchar(' ');
prtop(instr&077,WORD);
putchar(',');
prtreg(((instr&0xe00)>>9)+AREG0);
}
/* not used */
inf16()
{
stout("unknown opcode");
}
/* addq, subq */
inf17()
{
register i;
prsize((instr&0xc0)>>6);
i = (instr&0xe00)>>9;
if(i==0)
i = 8;
stout(" #$"); hexbzs((char) i); putchar(',');
prtop(instr&077,WORD);
}
/* trap */
inf18()
{
stout(" #$"); hexbzs((char)(instr&0xf));
}
/* link */
inf19()
{
putchar(' ');
par(instr&7);
stout(",#$"); hexwzs(sdot->memw);
sdot =+ 2;
dotinc =+ 2;
}
short int regmsk0[] {0100000,040000,020000,010000,04000,02000,01000,0400,0200,
0100,040,020,010,4,2,1};
short int regmsk1[] {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,010000,
020000,040000,0100000};
/* movem */
inf20()
{
if(instr&0x40)
stout(".l");
putchar(' ');
if (instr & 0x0400) /* test for mem->reg xfer */
{
prtop(instr & 077, WORD);
putchar(',');
putrlist(regmsk1);
}
else /* must be reg->mem */
{
if ( (instr & 070) == 040 ) putrlist(regmsk0); /* predec */
else putrlist(regmsk1);
putchar(',');
prtop(instr & 077, WORD);
}
}
putrlist(ap)
short int *ap;
{
register short int i,mask,*p;
register short int j;
mask = sdot->memw;
sdot =+ 2;
dotinc =+ 2;
p = ap;
j = -1;
for(i=0; i<16; i++) {
if(mask&*p++) {
if(j==0)
putchar('/');
if(j != 1) {
prtreg(i);
putchar('-');
}
j = 1;
}
else if(j==1) {
prtreg(i-1);
j = 0;
}
}
if(j==1)
stout("A7");
}
/* movep */
inf21()
{
register i,j;
if(instr&0x40)
stout(".l");
putchar('\t');
i = instr&0x180;
if(i==0x180) {
prtreg((instr&0xe00)>>9);
putchar(',');
}
j = sdot->memw;
hexwzs(j); pari(instr&7);
if(i==0x100) {
putchar(',');
prtreg((instr&0xe00)>>9);
}
sdot =+ 2;
dotinc =+ 2;
}
/* moveq */
inf22()
{
stout(" #$"); hexbzs((char)(instr&0xff)); putchar(',');
prtreg((instr&0xe00)>>9);
}
/* eor */
inf23()
{
prsize((instr&0xc0)>>6);
putchar(' ');
prtreg((instr&0xe00)>>9);
putchar(',');
prtop(instr&077,WORD);
}
/* clr, neg, negx, not, tst */
inf24()
{
prsize((instr&0xc0)>>6);
inf25();
}
/* scc, nbcd, tas */
inf25()
{
putchar(' ');
prtop(instr&077,WORD);
}
/* move SR & CCR */
inf26()
{
register i;
i = instr&0x600;
if(i==0) {
stout(" SR,");
}
else
putchar(' ');
prtop(instr&077,WORD);
if(i==0x400)
stout(",CCR");
else if(i==0x600)
stout(",SR");
}
/* ext */
inf27()
{
if((instr&0x1c0)==0xc0)
stout(".l");
inf13();
}
/* move USP */
inf28()
{
register i;
i = instr&7;
if(instr&8) { /* USP to An */
stout(".l USP,"); par(i);
}
else {
stout(".l "); par(i); stout(",USP");
}
}
/* some utilities for printing addresses */
pdr(r)
short int r;
{
putchar('D'); putchar(hexchar(r));
}
par(r)
short int r;
{
putchar('A'); putchar(hexchar(r));
}
pdri(r)
short int r;
{
putchar('('); pdr(r); putchar(')');
}
pari(r)
short int r;
{
putchar('('); par(r); putchar(')');
}
paripd(r)
short int r;
{
putchar('-'); pari(r);
}
paripi(r)
short int r;
{
pari(r); putchar('+');
}
hexlzs(n) /* write a long integer in hex */
long n;
{
puthex(n, 32, 1);
}
int hexwzs(n) /* write an integer in hex */
short int n;
{
puthex((long)n, 16, 1);
}
int hexbzs(n) /* write a byte as a hex integer */
char n;
{
puthex((long)n, 8, 1);
}

View File

@@ -0,0 +1,14 @@
vax b:BDOS.S $$frants
vax b:BDOSFUNC.H $$frants
vax b:DDT1.C $$frants
vax b:DDT2.C $$frants
vax b:DDTINC.H $$frants
vax b:DDTLOAD.S $$frants
vax b:DDTPRINT.COM $$frants
vax b:DDTUTIL.C $$frants
vax b:DISAS.H $$frants5
vax b:DISASM.C $$frants
vax b:OPTAB.H $$frants
vax b:STDIO.H $$frants
vax b:make.sub $$frants
vax b:next.sub $$frants

View File

@@ -0,0 +1,141 @@
/****************************************************************/
/* */
/* Examine/Alter CPU Registers */
/* */
/****************************************************************/
#include "ddtinc.h"
examine(cx, statep)
char *cx;
struct cpustate *statep;
{
if (nomore(cx)) showstate(statep);
else if (*++cx == 'D') pdareg('D', cx, statep->dreg);
else if (*cx == 'A') pdareg('A', cx, statep->areg);
else if (cmp("PC",--cx)) preg("PC", &(statep->pc));
else if (cmp("USP",cx)) { if (preg("USP",&(statep->usp)) &&
((statep->status & SUPER) == 0 ))
statep->areg[7] = statep->usp;
}
else if (cmp("SSP",cx)) { if (preg("SSP",&(statep->ssp)) &&
(statep->status & SUPER) )
statep->areg[7] = statep->ssp;
}
else tryflags(cx, statep);
}
showstate(statep)
register struct cpustate *statep;
{
register short int status;
stout("PC="); puthexl(statep->pc); putchar(' ');
stout("USP="); puthexl(statep->usp); putchar(' ');
stout("SSP="); puthexl(statep->ssp); putchar(' ');
stout("ST="); puthexw(status = statep->status);
stout("=>");
if (status & TRACE) stout("TR ");
if (status & SUPER) stout("SUP ");
stout("IM="); putchar(((status & INTMSK)>>8)+'0');
if (status & EXTEND) stout(" EXT");
if (status & NEG) stout(" NEG");
if (status & ZERO) stout(" ZER");
if (status & OFLOW) stout(" OFL");
if (status & CARRY) stout(" CRY");
putchar('\n');
pregrow('D', statep->dreg); /* D registers */
pregrow('A', statep->areg); /* A registers */
dot = statep -> pc;
pinstr(); /* disassembled instruction */
putchar('\n');
}
pdareg(da, cx, rp) /* print data or address register contents */
char da;
register char *cx;
long *rp;
{
char str[3];
if ( ('0' <= *++cx) && (*cx <= '7') && nomore(cx) ) {
str[0] = da;
str[1] = *cx;
str[2] = 0;
preg(str, rp + *cx - '0');
}
}
preg(rname, regp) /* print register contents */
register char *rname;
register long *regp;
{
char buf[BUFLEN];
register short int nc;
long int newval;
char *bp;
register int modify;
modify = 0;
stout(rname);
putchar('=');
puthexl(*regp);
putchar(' ');
*buf = BUFLEN-2;
BDOS(READBUF, buf);
putchar('\n');
if ((nc=buf[1])>0) {
buf[nc+2]=0;
bp = buf + 1;
while (*++bp) *bp = toupper(*bp);
bp = buf + 1;
if (gethex(&bp, &newval) && nomore(bp)) {
*regp = newval;
modify = 1;
}
else if ( ! nomore(buf+1) ) bad();
}
return(modify);
}
pregrow(ch, rowp)
char ch;
long *rowp;
{
register int n;
putchar(ch);
putchar(' ');
for (n=0; n<8; n++) {
putchar(' ');
puthexl(*rowp++);
if (n==3) putchar(' ');
}
putchar('\n');
}
tryflags(cx, statep)
register char *cx;
register struct cpustate *statep;
{
stout("Error or unimplemented function.");
}
cmp(str, ctl)
register char *str;
register char *ctl;
{
while (*str && (*str++ == *++ctl)) ;
if ( ( ! *str) && nomore(ctl) ) return(1);
else return(0);
}

View File

@@ -0,0 +1,37 @@
pip d:=as68symb.dat[g0
cp68 ddt1.c ddt1.i
c068 ddt1.i ddt1.ic ddt1.st
c168 ddt1.ic ddt1.s -LD
as68 -l -u ddt1.s
era ddt1.s*
era ddt1.i*
cp68 ddt2.c ddt2.i
c068 ddt2.i ddt2.ic ddt2.st
c168 ddt2.ic ddt2.s -LD
as68 -l -u ddt2.s
era ddt2.i*
era ddt2.s*
cp68 ddtutil.c ddtutil.i
c068 ddtutil.i ddtutil.ic ddtutil.st
c168 ddtutil.ic ddtutil.s -LD
as68 -l -u ddtutil.s
era ddtutil.s*
era ddtutil.i*
cp68 disasm.c disasm.i
c068 disasm.i disasm.ic disasm.st
c168 disasm.ic disasm.s -LD
as68 -l -u disasm.s
era disasm.s*
era disasm.i*
as68 -l -u bdos.s
as68 -l -u ddtload.s
lo68 -r -o ddt1.68k ddt1.o ddt2.o ddtutil.o disasm.o bdos.o
lo68 -r -o ddt.rel ddtload.o
submit next

View File

@@ -0,0 +1 @@
user 9 ! make

View File

@@ -0,0 +1,149 @@
#
/* struct for optab */
struct optbl {
int inmsk;
int invalu;
int infmt;
char *innam;
};
#define MAXFMT 28
#define OPENT 4 /* # words per line in optab */
struct optbl optab[]
{
0xf1c0, 0xc1c0, 5, "muls",
0xf1c0, 0xc0c0, 5, "mulu",
0xf1f0, 0xc100, 4, "abcd",
0xfff8, 0x4840, 13, "swap",
0xf100, 0xc100, 12, "exg",
0xfff8, 0x54c8, 11, "dbcc",
0xfff8, 0x55c8, 11, "dbcs",
0xfff8, 0x57c8, 11, "dbeq",
0xfff8, 0x51c8, 11, "dbra",
0xfff8, 0x5cc8, 11, "dbge",
0xfff8, 0x5ec8, 11, "dbgt",
0xfff8, 0x52c8, 11, "dbhi",
0xfff8, 0x5fc8, 11, "dble",
0xfff8, 0x53c8, 11, "dbls",
0xfff8, 0x5dc8, 11, "dblt",
0xfff8, 0x5bc8, 11, "dbmi",
0xfff8, 0x56c8, 11, "dbne",
0xfff8, 0x5ac8, 11, "dbpl",
0xfff8, 0x50c8, 11, "dbt",
0xfff8, 0x58c8, 11, "dbvc",
0xfff8, 0x59c8, 11, "dbvs",
0xffc0, 0x54c0, 25, "scc",
0xffc0, 0x55c0, 25, "scs",
0xffc0, 0x57c0, 25, "seq",
0xffc0, 0x51c0, 25, "sf\040",
0xffc0, 0x5cc0, 25, "sge",
0xffc0, 0x5ec0, 25, "sgt",
0xffc0, 0x52c0, 25, "shi",
0xffc0, 0x5fc0, 25, "sle",
0xffc0, 0x53c0, 25, "sls",
0xffc0, 0x5dc0, 25, "slt",
0xffc0, 0x5bc0, 25, "smi",
0xffc0, 0x56c0, 25, "sne",
0xffc0, 0x5ac0, 25, "spl",
0xffc0, 0x50c0, 25, "st\040",
0xffc0, 0x58c0, 25, "svc",
0xffc0, 0x59c0, 25, "svs",
0xf1f0, 0xd100, 4, "addx",
0xf1f0, 0xd140, 4, "addx",
0xf1f0, 0xd180, 4, "addx",
0xf000, 0xd000, 1, "add",
0xff00, 0x0600, 2, "addi",
0xf100, 0x5000, 17, "addq",
0xf000, 0xc000, 1, "and",
0xff00, 0x0200, 2, "andi",
0xf018, 0xe000, 8, "as",
0xfec0, 0xe0c0, 8, "as",
0xff00, 0x6000, 6, "bra",
0xff00, 0x6400, 6, "bcc",
0xff00, 0x6500, 6, "bcs",
0xff00, 0x6700, 6, "beq",
0xff00, 0x6c00, 6, "bge",
0xff00, 0x6e00, 6, "bgt",
0xff00, 0x6200, 6, "bhi",
0xff00, 0x6f00, 6, "ble",
0xff00, 0x6300, 6, "bls",
0xff00, 0x6d00, 6, "blt",
0xff00, 0x6b00, 6, "bmi",
0xff00, 0x6600, 6, "bne",
0xff00, 0x6a00, 6, "bpl",
0xff00, 0x6800, 6, "bvc",
0xff00, 0x6900, 6, "bvs",
0xff00, 0x6100, 6, "bsr",
0xff00, 0x0c00, 2, "cmpi",
0xf1f8, 0x0108, 21, "movep",
0xf1f8, 0x0148, 21, "movep",
0xf1f8, 0x0188, 21, "movep",
0xf1f8, 0x01c8, 21, "movep",
0xf1c0, 0x0140, 7, "bchg",
0xffc0, 0x0840, 7, "bchg",
0xf1c0, 0x0180, 7, "bclr",
0xffc0, 0x0880, 7, "bclr",
0xf0c0, 0x00c0, 7, "bset",
0xffc0, 0x08c0, 7, "bset",
0xf1c0, 0x0100, 7, "btst", /* fix to Belton's code */
0xffc0, 0x0800, 7, "btst",
0xf1c0, 0x4180, 5, "chk",
0xff00, 0x4200, 24, "clr",
0xf1f8, 0xb108, 10, "cmpm",
0xf1f8, 0xb148, 10, "cmpm",
0xf1f8, 0xb188, 10, "cmpm",
0xf1c0, 0xb0c0, 5, "cmpa",
0xf1c0, 0xb1c0, 5, "cmpa",
0xf100, 0xb100, 23, "eor",
0xf000, 0xb000, 5, "cmp",
0xf1c0, 0x81c0, 5, "divs",
0xf1c0, 0x80c0, 5, "divu",
0xff00, 0x0a00, 2, "eori",
0xfe38, 0x4800, 27, "ext",
0xffc0, 0x4ec0, 9, "jmp",
0xffc0, 0x4e80, 9, "jsr",
0xf1c0, 0x41c0, 15, "lea",
0xfff8, 0x4e50, 19, "link",
0xf018, 0xe008, 8, "ls",
0xfec0, 0xe2c0, 8, "ls",
0xf000, 0x1000, 3, "move",
0xf000, 0x2000, 3, "move",
0xf000, 0x3000, 3, "move",
0xfff0, 0x4e60, 28, "move", //move usp
0xf9c0, 0x40c0, 26, "move", //special moves
0xfb80, 0x4880, 20, "movem",
0xf100, 0x7000, 22, "moveq",
0xffc0, 0x4800, 25, "nbcd",
0xff00, 0x4400, 24, "neg",
0xff00, 0x4000, 24, "negx",
0xffff, 0x4e71, 0, "nop",
0xff00, 0x4600, 24, "not",
0xf000, 0x8000, 1, "or",
0xff00, 0x0000, 2, "ori",
0xffc0, 0x4840, 9, "pea",
0xffff, 0x4e70, 0, "reset",
0xfec0, 0xe6c0, 8, "ro", //rotate memory
0xfec0, 0xe4c0, 8, "rox",
0xf018, 0xe018, 8, "ro", //rotate
0xf018, 0xe010, 8, "rox",
0xffff, 0x4e73, 0, "rte",
0xffff, 0x4e77, 0, "rtr",
0xffff, 0x4e75, 0, "rts",
0xf1f0, 0x8100, 4, "sbcd",
0xffff, 0x4e72, 14, "stop",
0xf1f0, 0x9100, 4, "subx",
0xf1f0, 0x9140, 4, "subx",
0xf1f0, 0x9180, 4, "subx",
0xf000, 0x9000, 1, "sub",
0xff00, 0x0400, 2, "subi",
0xf100, 0x5100, 17, "subq",
0xffc0, 0x4ac0, 25, "tas",
0xfff0, 0x4e40, 18, "trap",
0xffff, 0x4e76, 0, "trapv",
0xff00, 0x4a00, 24, "tst",
0xfff8, 0x4e58, 13, "unlk",
0, 0, 0, "*unknown instruction*"
};

View File

@@ -0,0 +1,16 @@
$ set noon
$ vsend BDOS.S
$ vsend BDOSFUNC.H
$ vsend DDT1.C
$ vsend DDT2.C
$ vsend DDTINC.H
$ vsend DDTLOAD.S
$ vsend DDTUTIL.C
$ vsend DISAS.H
$ vsend DISASM.C
$ vsend EXAMINE.C
$ vsend MAKE.SUB
$ vsend NEXT.SUB
$ vsend OPTAB.H
$ vsend STDIO.H
$ vsend done

View File

@@ -0,0 +1,28 @@
Directory DRB0:[STEVE.CPM68K.DDT]
BDOS.S;35
BDOSFUNC.H;26
CC68.COM;25
CONV.PLI;20
DDT.COM;50
DDT1.C;26
DDT2.C;31
DDTINC.H;38
DDTLNK.COM;26
DDTLOAD.S;35
DDTNOPR.COM;14
DDTNUM.COM;23
DDTPRINT.COM;26
DDTUTIL.C;51
DISAS.H;26
DISASM.C;35
DOWNLOAD.SUB;4
EXAMINE.C;24
MAKE.SUB;6
NEXT.SUB;2
OPTAB.H;30
SEND.COM;1
STDIO.H;28
Total of 23 files.

View File

@@ -0,0 +1,72 @@
/************************************************************************/
/* */
/* File I/O Definitions */
/* */
/* The definitions in this section are used by the run-time */
/* package to provide an interface between CP/M-68K I/O and */
/* standard C I/O. */
/* */
/************************************************************************/
/****************************************************************************/
/* Miscellaneous Definitions: */
/****************************************************************************/
#define FAILURE (-1) /* Function failure return val */
#define SUCCESS (0) /* Function success return val */
#define YES 1 /* "TRUE" */
#define NO 0 /* "FALSE" */
#define FOREVER for(;;) /* Infinite loop declaration */
#define NULL 0 /* Null pointer value */
#define EOF (-1) /* EOF Value */
#define TRUE (1) /* Function TRUE value */
#define FALSE (0) /* Function FALSE value */
#define BUFSIZE 128 /* # bytes in a buffer */
/**/
/****************************************************************************/
/* */
/* M A C R O S */
/* ----------- */
/* */
/* Define some stuff as macros .... */
/* */
/****************************************************************************/
#define getchar() ((char) BDOS(CONIN, 0)) /* Get character from console */
/**/
#define isalpha(c) (islower(c)||isupper(c)) /* true if "c" a letter */
#define isdigit(c) ('0' <= (c) && (c) <= '9') /* Ascii only!! */
#define iswhite(c) ((c) <= 040 || 0177<= (c)) /* Is control / funny char */
#define iswild(c) ((c) == '*' || (c) == '?') /* true if a wildcard char */
/**/
#define islower(c) ('a' <= (c) && (c) <= 'z') /* Ascii only!! */
#define isupper(c) ('A' <= (c) && (c) <= 'Z') /* Ascii only!! */
/**/
#define tolower(c) (isupper(c) ? ((c)+040):(c)) /* translate to lower case */
#define toupper(c) (islower(c) ? ((c)-040):(c)) /* translate to upper case */
/**/
#define abs(x) ((x) < 0 ? -(x) : (x)) /* Absolute value function */
#define max(x,y) (((x) > (y)) ? (x) : (y)) /* Max function */
#define min(x,y) (((x) < (y)) ? (x) : (y)) /* Min function */
/**/
/************************************************************************/
/* */
/* BDOS Procedure Declaration */
/* */
/************************************************************************/
long BDOS();
/***/