From cf752ab6824419980caa1c64eb4d49372680119a Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 1 Nov 2018 14:57:10 +0100 Subject: [PATCH] move src/instr.h to include/instr.h because it will be needed by assembler for code generation. --- Makefile | 4 ++-- {src => include}/instr.h | 2 -- src/cpu.c | 2 +- src/{instr.c => instr_decode.c} | 4 ++-- src/instr_decode.h | 27 +++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 7 deletions(-) rename {src => include}/instr.h (95%) rename src/{instr.c => instr_decode.c} (97%) create mode 100644 src/instr_decode.h diff --git a/Makefile b/Makefile index bf57c93..009b6df 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ CC = gcc -CFLAGS = -DMEM_SIZE=32 +CFLAGS = -Iinclude -DMEM_SIZE=32 LD = $(CC) VM = m16vm -$(VM) : src/vm.o src/cpu.o src/mm.o src/instr.o src/syscall.o src/program.o +$(VM) : src/vm.o src/cpu.o src/mm.o src/instr_decode.o src/syscall.o src/program.o $(LD) $(LDFLAGS)-o $@ $^ clean : diff --git a/src/instr.h b/include/instr.h similarity index 95% rename from src/instr.h rename to include/instr.h index 857afb1..4f776e5 100644 --- a/src/instr.h +++ b/include/instr.h @@ -66,6 +66,4 @@ struct instr { }; }; -void instr_decode(unsigned char *nibble, struct instr *instr); - #endif /* INSTR_H */ diff --git a/src/cpu.c b/src/cpu.c index c5b076d..d212bf7 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -29,7 +29,7 @@ #include "cpu.h" #include "mm.h" #include "syscall.h" -#include "instr.h" +#include "instr_decode.h" /* Program */ unsigned char *instr_mem = NULL; diff --git a/src/instr.c b/src/instr_decode.c similarity index 97% rename from src/instr.c rename to src/instr_decode.c index ff0e4ee..780d2a7 100644 --- a/src/instr.c +++ b/src/instr_decode.c @@ -1,4 +1,4 @@ -/* instr.c +/* instr_decode.c * * Copyright (C) 2012,2014 Henrik Hautakoski * @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ -#include "instr.h" +#include "instr_decode.h" void instr_decode(unsigned char *instr, struct instr *out) { diff --git a/src/instr_decode.h b/src/instr_decode.h new file mode 100644 index 0000000..1e6d92e --- /dev/null +++ b/src/instr_decode.h @@ -0,0 +1,27 @@ +/* instr_decode.h + * + * Copyright (C) 2012,2014 Henrik Hautakoski + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ +#ifndef INSTR_DECODE_H +#define INSTR_DECODE_H + +#include + +void instr_decode(unsigned char *nibble, struct instr *instr); + +#endif /* INSTR_DECODE_H */