Initial revision
authorbal <none@none>
Thu, 19 Jul 1984 11:50:28 +0000 (11:50 +0000)
committerbal <none@none>
Thu, 19 Jul 1984 11:50:28 +0000 (11:50 +0000)
mach/m68k2/dl/Makefile [new file with mode: 0644]
mach/m68k2/dl/cv.c [new file with mode: 0644]
mach/m68k2/dl/dl.c [new file with mode: 0644]
mach/pmds/cv/Makefile [new file with mode: 0644]

diff --git a/mach/m68k2/dl/Makefile b/mach/m68k2/dl/Makefile
new file mode 100644 (file)
index 0000000..637d879
--- /dev/null
@@ -0,0 +1,19 @@
+CFLAGS=-O
+
+cv:             cv.o
+               cc -o cv -n cv.o
+
+install:       cv
+               cp cv ../../../bin
+
+cmp:           cv
+               -../compare cv
+
+opr:
+               make pr | opr
+
+pr:
+               @pr `pwd`/cv.c
+
+clean:
+               -rm -f *.o *.old cv
diff --git a/mach/m68k2/dl/cv.c b/mach/m68k2/dl/cv.c
new file mode 100644 (file)
index 0000000..aa273a9
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ *          This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ *      Dr. Andrew S. Tanenbaum
+ *      Wiskundig Seminarium
+ *      Vrije Universiteit
+ *      Postbox 7161
+ *      1007 MC Amsterdam
+ *      The Netherlands
+ *
+ */
+
+#include <stdio.h>
+#include <a.out.h>
+
+/*
+ * NOTE: Beware that the a.out.h file included here should be the a.out.h
+ *       file of the TARGET machine, not of the SOURCE machine.
+ */
+
+struct bhdr s_exec;
+
+main(argc,argv) char **argv; {
+       unsigned short losh,hish;
+       long addr,maxaddr;
+       short count;
+       
+       maxaddr=0;
+       if (argc != 3) {
+               fprintf(stderr,"Usage: %s VU-a.out Bleasdale-a.out\n",argv[0]);
+               exit(-1);
+       }
+       if (freopen(argv[1],"r",stdin)==NULL) {
+               perror(argv[1]);
+               exit(-1);
+       }
+       if (freopen(argv[2],"w",stdout)==NULL) {
+               perror(argv[2]);
+               exit(-1);
+       }
+       while (fread(&hish,sizeof(short),1,stdin)==1) {
+               if (fread(&losh,sizeof(short),1,stdin)!=1)
+                       exit(fprintf(stderr,"foo\n"));
+               addr=losh+(((long)hish)*65536L);
+               addr -= 0x20000;  /* entry point is 0x20000 on Bleasdale */
+               if (fread(&count,sizeof(short),1,stdin)!=1)
+                       exit(fprintf(stderr,"bar\n"));
+               fseek(stdout,addr+sizeof(s_exec),0);
+               while (count--) {
+                       putchar(getchar());
+                       addr++;
+               }
+               if (addr>maxaddr)
+                       maxaddr = addr;
+       }
+       s_exec.fmagic = FMAGIC;
+       s_exec.dsize = maxaddr;
+       s_exec.entry = 0x20000;
+       fseek(stdout,0L,0);
+       fwrite(&s_exec,sizeof(s_exec),1,stdout);
+       chmod(argv[2],0755);
+       return 0;
+}
+
+               
diff --git a/mach/m68k2/dl/dl.c b/mach/m68k2/dl/dl.c
new file mode 100644 (file)
index 0000000..4fa809c
--- /dev/null
@@ -0,0 +1,105 @@
+#define MAXBYTE        24
+#include <stdio.h>
+char hex[] =  "0123456789ABCDEF";
+FILE *fp, *fopen();
+char **s;
+int bytes, bytcnt, checksum;
+long pc;
+
+
+main (argc,argv)
+int argc;
+char *argv[];
+       {
+       if (argc != 2)   fatal ("usage: %s filename\n",argv[0]);
+       if ((fp = fopen (*++argv,"r")) == NULL)
+               fatal ("can't open %s\n",*argv);
+       else    {
+               s = argv;
+               convert ();
+               fclose (fp);
+               }
+       }
+
+convert ()
+       {
+       int c;
+       do
+               {
+               pc = getword ();
+               pc = (pc << 16) | getword ();
+               bytes = getword ();
+               while (bytes != 0) 
+                       {
+                       bytcnt = (bytes < MAXBYTE) ? bytes : MAXBYTE;
+                       bytes -= bytcnt;
+                       checksum = 0;
+                       if (pc > 0xffffL) S2record (); else S1record ();
+                       }
+               c = getc (fp);
+               ungetc (c, fp);
+               }
+       while (c != EOF);
+       printf ("S9030000FC\n");
+       }
+
+
+S2record ()
+       {
+       printf ("S2");
+       bytcnt += 4;
+       outbyte (bytcnt);
+       outbyte (pc);
+       record ();
+       }
+
+S1record ()
+       {
+       printf ("S1");
+       bytcnt += 3;
+       outbyte (bytcnt);
+       record ();
+       }
+
+record ()
+       {
+       outbyte (pc << 8);
+       outbyte (pc << 16);
+       while (bytcnt != 0) 
+               {
+               outbyte (getbyte ());
+               pc ++;
+               }
+       outbyte (~checksum);
+       putchar ('\n');
+       putchar (0);
+       putchar (0);
+       }
+
+outbyte (b)
+int b;
+       {
+       checksum = (checksum + b) & 0377;
+       putchar (hex[(b>>4) & 017]);
+       putchar  (hex[b & 017]);
+       -- bytcnt;
+       }
+
+getword ()
+       {
+       int c;
+       c = getbyte ();
+       return ((getbyte () << 8) | c );
+       }
+
+getbyte ()
+       {
+       int c;
+       if ((c = getc (fp)) == EOF) fatal ("end of %s\n",*s);
+       return (c);
+       }
+fatal (s,a)
+       {
+       printf (s,a);
+       exit (-1);
+       }
diff --git a/mach/pmds/cv/Makefile b/mach/pmds/cv/Makefile
new file mode 100644 (file)
index 0000000..637d879
--- /dev/null
@@ -0,0 +1,19 @@
+CFLAGS=-O
+
+cv:             cv.o
+               cc -o cv -n cv.o
+
+install:       cv
+               cp cv ../../../bin
+
+cmp:           cv
+               -../compare cv
+
+opr:
+               make pr | opr
+
+pr:
+               @pr `pwd`/cv.c
+
+clean:
+               -rm -f *.o *.old cv