From 0d2f94314a9d1408336317667b43339ec7409264 Mon Sep 17 00:00:00 2001 From: julianb0 Date: Thu, 16 May 2019 19:59:14 +0200 Subject: [PATCH] starting assembly --- .gitignore | 4 +++- Makefile | 22 ++++++---------------- as/Makefile | 0 as/k-as.py | 4 ++++ {instr => pc}/INSTRS | 0 pc/Makefile | 25 +++++++++++++++++++++++++ {karch => pc}/arch.h | 0 {karch => pc}/decd.c | 0 {karch => pc}/dump.c | 0 {instr => pc}/instrs.c | 0 {instr => pc}/instrs.h | 0 {instr => pc}/instrs.py | 2 +- {instr => pc}/jumps.c | 0 {karch => pc}/main.c | 0 {karch => pc}/regs.c | 0 15 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 as/Makefile create mode 100644 as/k-as.py rename {instr => pc}/INSTRS (100%) create mode 100644 pc/Makefile rename {karch => pc}/arch.h (100%) rename {karch => pc}/decd.c (100%) rename {karch => pc}/dump.c (100%) rename {instr => pc}/instrs.c (100%) rename {instr => pc}/instrs.h (100%) rename {instr => pc}/instrs.py (98%) rename {instr => pc}/jumps.c (100%) rename {karch => pc}/main.c (100%) rename {karch => pc}/regs.c (100%) diff --git a/.gitignore b/.gitignore index 3ff52c5..27041d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -k.exe +*.exe +*.out *.o +test* arch_i.h diff --git a/Makefile b/Makefile index 46ece94..c5dc40d 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,13 @@ # The OS/K Team licenses this file to you under the MIT license. # See the LICENSE file in the project root for more information. -all: k.exe +all: pc as -src = instr/instrs.c karch/decd.c karch/main.c karch/regs.c \ - karch/dump.c instr/jumps.c +pc: + cd pc && make -obj = $(patsubst %.c,%.o,$(src)) +as: + cd as && make -%.o: %.c instrs/i_arch.h */*.h $(src) - @gcc -O2 -Wall -I./karch -c $< -o $@ - -instrs/i_arch.h: instr/INSTRS instr/instrs.py - @python3 instr/instrs.py - -clean: - @rm */*.o - -k.exe: $(obj) instrs/i_arch.h instr/INSTRS instr/instrs.py - @gcc -O2 -Wall $(obj) -o k.exe - @rm */*.o +test: all diff --git a/as/Makefile b/as/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/as/k-as.py b/as/k-as.py new file mode 100644 index 0000000..a9c9568 --- /dev/null +++ b/as/k-as.py @@ -0,0 +1,4 @@ +#!/usr/bin/python3 + + + diff --git a/instr/INSTRS b/pc/INSTRS similarity index 100% rename from instr/INSTRS rename to pc/INSTRS diff --git a/pc/Makefile b/pc/Makefile new file mode 100644 index 0000000..2944e13 --- /dev/null +++ b/pc/Makefile @@ -0,0 +1,25 @@ +# The OS/K Team licenses this file to you under the MIT license. +# See the LICENSE file in the project root for more information. + +all: k.exe + +src = instrs.c decd.c main.c regs.c \ + dump.c jumps.c + +obj = $(patsubst %.c,%.o,$(src)) + +%.o: %.c instrs/i_arch.h */*.h $(src) + @gcc -O2 -Wall -I./karch -c $< -o $@ + +instrs/i_arch.h: INSTRS instrs.py + @python3 instrs.py + +.PHONY: clean + +clean: + @rm *.o + +k.exe: $(obj) i_arch.h INSTRS instrs.py + @gcc -O2 -Wall $(obj) -o ../k.exe + @rm *.o + diff --git a/karch/arch.h b/pc/arch.h similarity index 100% rename from karch/arch.h rename to pc/arch.h diff --git a/karch/decd.c b/pc/decd.c similarity index 100% rename from karch/decd.c rename to pc/decd.c diff --git a/karch/dump.c b/pc/dump.c similarity index 100% rename from karch/dump.c rename to pc/dump.c diff --git a/instr/instrs.c b/pc/instrs.c similarity index 100% rename from instr/instrs.c rename to pc/instrs.c diff --git a/instr/instrs.h b/pc/instrs.h similarity index 100% rename from instr/instrs.h rename to pc/instrs.h diff --git a/instr/instrs.py b/pc/instrs.py similarity index 98% rename from instr/instrs.py rename to pc/instrs.py index f64f857..6d3f706 100644 --- a/instr/instrs.py +++ b/pc/instrs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # The OS/K Team licences this file to you under the MIT license. # See the LICENSE file in the project root for more information. diff --git a/instr/jumps.c b/pc/jumps.c similarity index 100% rename from instr/jumps.c rename to pc/jumps.c diff --git a/karch/main.c b/pc/main.c similarity index 100% rename from karch/main.c rename to pc/main.c diff --git a/karch/regs.c b/pc/regs.c similarity index 100% rename from karch/regs.c rename to pc/regs.c