summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2002-12-04 22:38:14 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:48:48 +0200
commitb5790e52270b149e92531a8eb0cd521ff2854dff (patch)
tree78902d047f44b04d9e0cfb10879a5b768090beaa
parent67ef77f9e0744e524188c01fe314b609edd53456 (diff)
downloaddev86-b5790e52270b149e92531a8eb0cd521ff2854dff.tar.gz
Import Dev86src-0.16.10.tar.gzv0.16.10
-rw-r--r--Changes4
-rw-r--r--Makefile2
-rw-r--r--as/syshead.h1
-rw-r--r--bcc/genloads.c55
-rw-r--r--ifdef.c15
-rw-r--r--ld/globvar.h2
-rw-r--r--ld/ld.c6
-rw-r--r--ld/writex86.c15
8 files changed, 96 insertions, 4 deletions
diff --git a/Changes b/Changes
index 49a943f..7140760 100644
--- a/Changes
+++ b/Changes
@@ -78,6 +78,10 @@ For version 0.16.*.
executable from DOS, if __argr.x.cflag is set this is running under
DOS.
+> Compile for DOS again, disable cpm86 headers under DOS.
+
+> Minor bugfix for as86 binary output re sizeof(int)/K&R problem.
+
For version 0.16.0.
> As major bugs seem to be absent 0.16.0 is escaping.
diff --git a/Makefile b/Makefile
index 8c5dbf8..2aff7fd 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# This file is part of the Linux-8086 Development environment and is
# distributed under the GNU General Public License.
-VERSION=0.16.9
+VERSION=0.16.10
TARGETS= \
clean bcc unproto copt as86 ld86 elksemu \
diff --git a/as/syshead.h b/as/syshead.h
index 2e06496..82d2cc9 100644
--- a/as/syshead.h
+++ b/as/syshead.h
@@ -16,6 +16,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <io.h>
#undef min
#undef POSIX_HEADERS_MISSING
#define VERSION "MSDOS Compile"
diff --git a/bcc/genloads.c b/bcc/genloads.c
index c3ac56a..cf0c792 100644
--- a/bcc/genloads.c
+++ b/bcc/genloads.c
@@ -573,6 +573,38 @@ store_pt targreg;
}
else
{
+#ifdef I8088
+ /* Added acess to CPU registers. Just declare _AX etc. as
+ * extern int, and you can use them to get/set
+ * the register values. (vak) */
+ if (source->storage == GLOBAL && !(source->flags & LABELLED) &&
+ *source->name.namep != 0 &&
+ strncmp(source->name.namep, "__", 2) == 0)
+ {
+ if (strcmp (source->name.namep, "__AX") == 0)
+ {
+ /* Load AX register - do nothing. */
+done: source->storage = AXREG; /* in register for further use */
+ source->flags = 0;
+ if (source->level == OFFKLUDGELEVEL)
+ source->level = EXPRLEVEL;
+ source->offset.offi = 0; /* indcount was adjusted by outadr */
+ return;
+ }
+ if (strcmp (source->name.namep, "__BX") == 0) { outstr ("mov\tax,bx\n"); goto done; }
+ if (strcmp (source->name.namep, "__CX") == 0) { outstr ("mov\tax,cx\n"); goto done; }
+ if (strcmp (source->name.namep, "__DX") == 0) { outstr ("mov\tax,dx\n"); goto done; }
+ if (strcmp (source->name.namep, "__SP") == 0) { outstr ("mov\tax,sp\n"); goto done; }
+ if (strcmp (source->name.namep, "__BP") == 0) { outstr ("mov\tax,bp\n"); goto done; }
+ if (strcmp (source->name.namep, "__SI") == 0) { outstr ("mov\tax,si\n"); goto done; }
+ if (strcmp (source->name.namep, "__DI") == 0) { outstr ("mov\tax,di\n"); goto done; }
+ if (strcmp (source->name.namep, "__CS") == 0) { outstr ("mov\tax,cs\n"); goto done; }
+ if (strcmp (source->name.namep, "__DS") == 0) { outstr ("mov\tax,ds\n"); goto done; }
+ if (strcmp (source->name.namep, "__ES") == 0) { outstr ("mov\tax,es\n"); goto done; }
+ if (strcmp (source->name.namep, "__SS") == 0) { outstr ("mov\tax,ss\n"); goto done; }
+ if (strcmp (source->name.namep, "__FLAGS") == 0) { outstr ("pushf\npop\tax\n"); goto done; }
+ }
+#endif
outload();
if (source->storage == GLOBAL && source->indcount != 0 &&
(store_t) targreg & (AXREG | ALREG))
@@ -1276,6 +1308,29 @@ struct symstruct *target;
}
else
{
+#ifdef I8088
+ /* Added acess to CPU registers. Just declare _AX etc. as
+ * extern int, and you can use them to get/set
+ * the register values. (vak) */
+ if (target->storage == GLOBAL && !(target->flags & LABELLED) &&
+ *target->name.namep != 0 &&
+ strncmp(target->name.namep, "__", 2) == 0)
+ {
+ if (strcmp (target->name.namep, "__AX") == 0) { return; }
+ if (strcmp (target->name.namep, "__BX") == 0) { outstr ("mov\tbx,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__CX") == 0) { outstr ("mov\tcx,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__DX") == 0) { outstr ("mov\tdx,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__SP") == 0) { outstr ("mov\tsp,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__BP") == 0) { outstr ("mov\tbp,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__SI") == 0) { outstr ("mov\tsi,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__DI") == 0) { outstr ("mov\tdi,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__CS") == 0) { outstr ("mov\tcs,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__DS") == 0) { outstr ("mov\tds,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__ES") == 0) { outstr ("mov\tes,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__SS") == 0) { outstr ("mov\tss,"); outregname(sourcereg); outnl(); return; }
+ if (strcmp (target->name.namep, "__FLAGS") == 0) { outstr ("push\tax"); outregname(sourcereg); outstr ("\npopf\n"); return; }
+ }
+#endif
outstore();
#ifdef I8088
if (target->storage == GLOBAL && (store_t) sourcereg & (AXREG | ALREG))
diff --git a/ifdef.c b/ifdef.c
index 869b4be..1a9a08e 100644
--- a/ifdef.c
+++ b/ifdef.c
@@ -109,8 +109,19 @@ char ** argv;
void Usage(prog)
char * prog;
{
- fprintf(stderr, "Usage: %s [-DFLAG] [-UFLAG] [-blcrMDU] [-C##] files\n",
+ fprintf(stderr, "Usage: %s [-DFLAG] [-UFLAG] [-blcrhMDU] [-C##] files\n",
prog);
+ fprintf(stderr, "\t-DFLAG\tDefine flag.\n");
+ fprintf(stderr, "\t-UFLAG\tUndefine flag.\n");
+ fprintf(stderr, "\t-C##\tComment out liines with '##'\n");
+ fprintf(stderr, "\t-b\tRemove contents of lines leaving empty lines\n");
+ fprintf(stderr, "\t-l\tUse #line lines.\n");
+ fprintf(stderr, "\t-c\tComment out with '# '\n");
+ fprintf(stderr, "\t-r\tRemove undefined lines completely.\n");
+ fprintf(stderr, "\t-h\tRemove any line beginning with a '#'\n");
+ fprintf(stderr, "\t-M\tInclude manifest constants.\n");
+ fprintf(stderr, "\t-D\tAssume any unknown names are defined.\n");
+ fprintf(stderr, "\t-U\tAssume any unknown names are undefined.\n");
exit(1);
}
@@ -430,7 +441,7 @@ manifest_constant()
#ifdef __linux__
save_name("__linux__", 'D');
#ifdef __i386__
- save_name("XX__linux_i386__", 'D');
+ save_name("__linux____i386__", 'D');
#endif
#endif
#ifdef __unix__
diff --git a/ld/globvar.h b/ld/globvar.h
index 1554b98..84cf8ff 100644
--- a/ld/globvar.h
+++ b/ld/globvar.h
@@ -13,7 +13,9 @@ EXTERN struct redlist *redfirst; /* first on list of redefined symbols */
/* K&R _explicitly_ says extern followed by public is OK */
extern char hexdigit[]; /* constant */
extern int headerless; /* Don't output header on exe */
+#ifndef MSDOS
extern int cpm86; /* Generate CP/M-86 CMD header */
+#endif
extern bin_off_t text_base_value; /* Base address of text seg */
extern bin_off_t data_base_value; /* Base or alignment of data seg */
diff --git a/ld/ld.c b/ld/ld.c
index 29e03e9..403bdfb 100644
--- a/ld/ld.c
+++ b/ld/ld.c
@@ -19,7 +19,9 @@ PUBLIC bin_off_t text_base_value = 0; /* XXX */
PUBLIC bin_off_t data_base_value = 0; /* XXX */
PUBLIC bin_off_t heap_top_value = 0; /* XXX */
PUBLIC int headerless = 0;
+#ifndef MSDOS
PUBLIC int cpm86 = 0;
+#endif
PUBLIC char hexdigit[] = "0123456789abcdef";
PRIVATE bool_t flag[128];
@@ -124,7 +126,9 @@ char **argv;
case 'z': /* unmapped zero page */
case 'N': /* Native format a.out */
case 'd': /* Make a headerless outfile */
+#ifndef MSDOS
case 'c': /* Write header in CP/M-86 format */
+#endif
case 'y': /* Use a newer symbol table */
if (arg[2] == 0)
flag[(int) arg[1]] = TRUE;
@@ -239,9 +243,11 @@ char **argv;
headerless = flag['d'];
if( headerless ) flag['s'] = 1;
+#ifndef MSDOS
/* CP/M-86 executables can't use symbols. */
cpm86 = flag['c'];
if ( cpm86 ) flag['s'] = 1;
+#endif
linksyms(flag['r']);
if (outfilename == NUL_PTR)
diff --git a/ld/writex86.c b/ld/writex86.c
index d877edc..42158e4 100644
--- a/ld/writex86.c
+++ b/ld/writex86.c
@@ -4,7 +4,9 @@
#include "syshead.h"
#include "x86_aout.h"
+#ifndef MSDOS
#include "x86_cpm86.h"
+#endif
#include "const.h"
#include "obj.h"
#include "type.h"
@@ -18,7 +20,11 @@
#define ELF_SYMS 0
#endif
+#ifdef MSDOS
+# define FILEHEADERLENGTH (headerless?0:A_MINHDR)
+#else
# define FILEHEADERLENGTH (headerless?0:(cpm86?CPM86_HEADERLEN:A_MINHDR))
+#endif
/* part of header not counted in offsets */
#define DPSEG 2
@@ -77,7 +83,9 @@ FORWARD void symres P((char *name));
FORWARD void setseg P((fastin_pt newseg));
FORWARD void skip P((unsigned countsize));
FORWARD void writeheader P((void));
+#ifndef MSDOS
FORWARD void cpm86header P((void));
+#endif
FORWARD void writenulls P((bin_off_t count));
EXTERN bool_t reloc_output;
@@ -324,8 +332,11 @@ bool_pt argxsym;
setsym("__heap_top", (bin_off_t)heap_top_value);
openout(outfilename);
+#ifndef MSDOS
if (cpm86) cpm86header();
- else writeheader();
+ else
+#endif
+ writeheader();
for (modptr = modfirst; modptr != NUL_PTR; modptr = modptr->modnext)
if (modptr->loadflag)
{
@@ -602,6 +613,7 @@ unsigned countsize;
writenulls((bin_off_t) readsize(countsize));
}
+#ifndef MSDOS
PRIVATE void cpm86header()
{
struct cpm86_exec header;
@@ -626,6 +638,7 @@ PRIVATE void cpm86header()
if( FILEHEADERLENGTH )
writeout((char *) &header, FILEHEADERLENGTH);
}
+#endif
PRIVATE void writeheader()
{