summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/stand/bugexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 10:54:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 10:54:29 +0000
commitebb22450a0f6bd0357a6727bae293b3ed7a8d5e2 (patch)
tree03ceebb5ca61ef2d13f65051a6c5222e92816689 /sys/arch/mvme88k/stand/bugexec
parent77b048c5ca1ef345d036f981ff0b954c647efd7a (diff)
initial 88k import; code by nivas and based on mach luna88k
Diffstat (limited to 'sys/arch/mvme88k/stand/bugexec')
-rw-r--r--sys/arch/mvme88k/stand/bugexec/Makefile26
-rw-r--r--sys/arch/mvme88k/stand/bugexec/hellobin0 -> 8608 bytes
-rw-r--r--sys/arch/mvme88k/stand/bugexec/hello.c54
-rw-r--r--sys/arch/mvme88k/stand/bugexec/wrtos.c64
-rw-r--r--sys/arch/mvme88k/stand/bugexec/xyzbin0 -> 4512 bytes
5 files changed, 144 insertions, 0 deletions
diff --git a/sys/arch/mvme88k/stand/bugexec/Makefile b/sys/arch/mvme88k/stand/bugexec/Makefile
new file mode 100644
index 00000000000..3ed0ff02de6
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugexec/Makefile
@@ -0,0 +1,26 @@
+all: hello
+SRCS= hello.c
+OBJS= hello.o
+
+CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/${MACHINE_ARCH}
+CFLAGS+=-I${.CURDIR}/../include -I${.CURDIR}/../.. -I/usr/src/sys
+CFLAGS+=-fwritable-strings
+
+LIBBUG!= cd $(.CURDIR)/../libbug; \
+ printf "xxx:\n\techo \$${.OBJDIR}/libbug.a\n" | ${MAKE} -r -s -f - xxx
+
+BUGCRT!= cd $(.CURDIR)/../bugcrt; \
+ printf "xxx:\n\techo \$${.OBJDIR}/bugcrt.o\n" | ${MAKE} -r -s -f - xxx
+
+KERNCRT!= cd $(.CURDIR)/../kerncrt; \
+ printf "xxx:\n\techo \$${.OBJDIR}/kerncrt.o\n" | ${MAKE} -r -s -f - xxx
+
+LDADD+=${LIBBUG} /usr/local/lib/libgcc.a
+
+hello: $(OBJS) ${LIBBUG}
+ ${LD} -x -Ttext 10020 ${KERNCRT} $(OBJS) ${LDADD} -o ${.TARGET}
+clean:
+ rm -f a.out *.core
+ rm -f hello.o hello.bug hello.bug.1 hello.bug.2
+
+.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/bugexec/hello b/sys/arch/mvme88k/stand/bugexec/hello
new file mode 100644
index 00000000000..8670fd2b147
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugexec/hello
Binary files differ
diff --git a/sys/arch/mvme88k/stand/bugexec/hello.c b/sys/arch/mvme88k/stand/bugexec/hello.c
new file mode 100644
index 00000000000..08ab75d2a27
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugexec/hello.c
@@ -0,0 +1,54 @@
+#include "bug.h"
+#include "bugio.h"
+
+void putchar __P((char));
+int bcd2int __P((unsigned int));
+
+void
+putchar(char c)
+{
+ bugoutchr(c);
+}
+
+main(struct bugenv *env)
+{
+ struct bugrtc rtc;
+ struct bugbrdid brdid;
+
+ bugrtcrd(&rtc);
+ printf("From RTC:\n");
+ printf("Year %d\tMonth %d\tDay %d\tDay of Week %d\n",
+ bcd2int(rtc.Y), bcd2int(rtc.M), bcd2int(rtc.D), bcd2int(rtc.d));
+ printf("Hour %d\tMin %d\tSec %d\tCal %d\n",
+ bcd2int(rtc.H), bcd2int(rtc.m), bcd2int(rtc.s), bcd2int(rtc.c));
+ printf("From BRDID:\n");
+ bugbrdid(&brdid);
+/* printf("Eye catcher %c%c%c%c\n", brdid.eye[0], brdid.eye[1],
+ brdid.eye[2], brdid.eye[3]); */
+ printf("Board no %d (%d) \tsuffix %c%c\n", bcd2int(brdid.brdno),
+ brdid.brdno, brdid.brdsuf[0], brdid.brdsuf[1]);
+/* printf("Clun %x\tdlun %x\n", brdid.clun, brdid.dlun); */
+ return 0;
+}
+
+ipow(int base, int i)
+{
+ int cnt = 1;
+ while (i--) {
+ cnt *= base;
+ }
+ return cnt;
+}
+
+int
+bcd2int(unsigned int i)
+{
+ unsigned val = 0;
+ int cnt = 0;
+ while (i) {
+ val += (i&0xf) * ipow(10,cnt);
+ cnt++;
+ i >>= 4;
+ }
+ return val;
+}
diff --git a/sys/arch/mvme88k/stand/bugexec/wrtos.c b/sys/arch/mvme88k/stand/bugexec/wrtos.c
new file mode 100644
index 00000000000..1e01b697399
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugexec/wrtos.c
@@ -0,0 +1,64 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include "vid.h"
+
+#define sec2blk(x) ((x) * 2)
+#define BUF_SIZ 512
+
+main(int argc, char **argv)
+{
+ struct vid *pvid;
+ struct cfg *pcfg;
+ struct stat stat;
+ int exe_file;
+ int tape_vid;
+ int tape_exe;
+ char *filename;
+ char fileext[256];
+ char hdrbuf[BUF_SIZ];
+
+ if (argc == 0){
+ filename = "a.out";
+ } else {
+ filename = argv[1];
+ }
+ exe_file = open(filename, O_RDONLY,0444);
+ if (exe_file == -1)
+ {
+ printf("file %s does not exist\n",filename);
+ exit(2);
+ }
+ sprintf (fileext,"%s%s",filename,".1");
+ tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644);
+ sprintf (fileext,"%s%s",filename,".2");
+ tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644);
+
+ lseek(exe_file,0,SEEK_SET);
+ memset (hdrbuf,0,BUF_SIZ);
+ read(exe_file,hdrbuf, 0x20); /* read the header */
+
+ write(tape_vid,hdrbuf,BUF_SIZ);
+
+ copy_exe(exe_file,tape_exe);
+ close (exe_file);
+ close (tape_vid);
+ close (tape_exe);
+}
+
+copy_exe(exe_file,tape_exe)
+{
+ char *buf;
+ int cnt = 0;
+
+ buf = (char *)malloc (BUF_SIZ);
+
+ lseek (exe_file,0x20,SEEK_SET);
+ while (BUF_SIZ == (cnt = read(exe_file, buf , BUF_SIZ))) {
+ write (tape_exe,buf,cnt);
+ }
+ memset (&buf[cnt],0,BUF_SIZ-cnt);
+ write (tape_exe,buf,BUF_SIZ);
+}
diff --git a/sys/arch/mvme88k/stand/bugexec/xyz b/sys/arch/mvme88k/stand/bugexec/xyz
new file mode 100644
index 00000000000..dbdee90a4e1
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugexec/xyz
Binary files differ