commit e2f3d48cb2ad5ea6623874e9cee3975ebe9058c3
parent 60822915915dc8c55f83238f6b434e2ef56015ac
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 17 May 2018 14:22:48 +0000
[as/i286] Add Makefile support to build as-286
This is only a skeleton, but after this commit make all generates
a i286 binary.
Diffstat:
4 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/as/Makefile b/as/Makefile
@@ -7,10 +7,7 @@ include $(LIBDIR)/libdep.mk
OBJ = main.o symbol.o ins.o parser.o expr.o myro.o
MOREFLAGS = -I$(PROJECTDIR)/inc/$(STD) $(AS_CFLAGS)
-all: as-amd64 as-i386 as-z80
-
-as: $(OBJ)
- $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
+all: as-amd64 as-i386 as-i286 as-z80
dep:
$(PROJECTDIR)/mkdep.sh
@@ -24,6 +21,7 @@ clean:
include target/amd64.mk
include target/i386.mk
+include target/i286.mk
include target/z80.mk
#deps
diff --git a/as/target/i286.mk b/as/target/i286.mk
@@ -0,0 +1,8 @@
+
+I286_OBJ = $(OBJ) target/x86/i286tbl.o target/x86/i286.o target/x86/ins.o
+
+target/x86/i286tbl.c: gentbl.awk target/x86/x86.dat target/x86/rules.dat
+ ./gentbl.sh -f x86 -c i286
+
+as-i286: $(I286_OBJ) $(LIBDIR)/libscc.a
+ $(CC) $(SCC_LDFLAGS) $(I286_OBJ) -lscc -o $@
diff --git a/as/target/x86/8086-test.s b/as/target/x86/i286-test.s
diff --git a/as/target/x86/i286.c b/as/target/x86/i286.c
@@ -0,0 +1,53 @@
+static char sccsid[] = "@(#) ./as/target/x86/i286.c";
+
+#include "../../../inc/scc.h"
+#include "../../as.h"
+#include "../x86/proc.h"
+
+TUINT maxaddr = 0xFFFF;
+int endian = LITTLE_ENDIAN;
+int left2right = 0;
+
+void
+iarch(void)
+{
+ static struct {
+ char *name;
+ char type;
+ } regs[] = {
+ "CS", AREG_CS,
+ "DS", AREG_DS,
+ "SS", AREG_SS,
+ "ES", AREG_ES,
+
+ "AX", AREG_AX,
+ "AL", AREG_AL,
+ "AH", AREG_AH,
+
+ "BC", AREG_BX,
+ "BL", AREG_BL,
+ "BH", AREG_BH,
+
+ "CX", AREG_CX,
+ "CL", AREG_CL,
+ "CH", AREG_CH,
+
+ "DX", AREG_DX,
+ "DL", AREG_DL,
+ "DH", AREG_DH,
+
+ "SI", AREG_SI,
+ "DI", AREG_DI,
+
+ "SP", AREG_SP,
+ "BP", AREG_BP,
+
+ NULL
+ }, *bp;
+
+ for (bp = regs; bp->name; ++bp) {
+ Symbol *sym = lookup(bp->name);
+ sym->flags = FREG;
+ sym->value = bp->type;
+ }
+}