diff --git a/Makefile b/Makefile
index 8b50f45..778735a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@
SHELL = /bin/bash -o pipefail
# using gcc version 5.4.1 20161213 (Linaro GCC 5.4-2017.01-rc2)
+# This is the location of the linaro compiler in the wsbu/toolchain-linaro docker container
BASE = /opt/linaro/bin/arm-linux-gnueabihf
CC = $(BASE)-gcc
@@ -18,11 +19,13 @@ SRC2 = $(wildcard *.cpp)
MINIMIG_SRC = $(wildcard ./support/minimig/*.cpp)
SHARPMZ_SRC = $(wildcard ./support/sharpmz/*.cpp)
ARCHIE_SRC = $(wildcard ./support/archie/*.cpp)
+ST_SRC = $(wildcard ./support/st/*.cpp)
+X86_SRC = $(wildcard ./support/x86/*.cpp)
-VPATH = ./:./support/minimig:./support/sharpmz:./support/archie
+VPATH = ./:./support/minimig:./support/sharpmz:./support/archie:./support/st:./support/x86
-OBJ = $(SRC:.c=.o) $(SRC2:.cpp=.o) $(MINIMIG_SRC:.cpp=.o) $(SHARPMZ_SRC:.cpp=.o) $(ARCHIE_SRC:.cpp=.o)
-DEP = $(SRC:.c=.d) $(SRC2:.cpp=.d) $(MINIMIG_SRC:.cpp=.d) $(SHARPMZ_SRC:.cpp=.d) $(ARCHIE_SRC:.cpp=.d)
+OBJ = $(SRC:.c=.o) $(SRC2:.cpp=.o) $(MINIMIG_SRC:.cpp=.o) $(SHARPMZ_SRC:.cpp=.o) $(ARCHIE_SRC:.cpp=.o) $(ST_SRC:.cpp=.o) $(X86_SRC:.cpp=.o)
+DEP = $(SRC:.c=.d) $(SRC2:.cpp=.d) $(MINIMIG_SRC:.cpp=.d) $(SHARPMZ_SRC:.cpp=.d) $(ARCHIE_SRC:.cpp=.d) $(ST_SRC:.cpp=.d) $(X86_SRC:.cpp=.d)
CFLAGS = $(DFLAGS) -c -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\"
LFLAGS = -lc -lstdc++ -lrt
@@ -37,6 +40,12 @@ clean:
rm -f *.d *.o *.elf *.map *.lst *.bak *.rej *.org *.user *~ $(PRJ)
rm -rf obj .vs DTAR* x64
+cleanall:
+ rm -rf *.d *.o *.elf *.map *.lst *.bak *.rej *.org *.user *~ $(PRJ)
+ rm -rf obj .vs DTAR* x64
+ find . -name '*.o' -delete
+ find . -name '*.d' -delete
+
%.o: %.c
@$(info $<)
@$(CC) $(CFLAGS) -std=gnu99 -o $@ -c $< 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):\([0-9]\+\):/\1(\2,\ \3):/g'
diff --git a/menu.cpp b/menu.cpp
index 5b53d05..38104fc 100644
--- a/menu.cpp
+++ b/menu.cpp
@@ -34,23 +34,23 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include "stdio.h"
#include "string.h"
+
#include "file_io.h"
#include "osd.h"
#include "hardware.h"
#include "menu.h"
#include "user_io.h"
-#include "st_tos.h"
#include "debug.h"
-#include "support.h"
#include "fpga_io.h"
-#include
#include "cfg.h"
#include "input.h"
-#include "x86.h"
#include "battery.h"
+#include "support.h"
+
/*menu states*/
enum MENU
{
diff --git a/support.h b/support.h
index 034eee9..a0373ad 100644
--- a/support.h
+++ b/support.h
@@ -9,3 +9,10 @@
// Archie support
#include "support/archie/archie.h"
+
+// ST (Atari) support
+#include "support/st/st_ikbd.h"
+#include "support/st/st_tos.h"
+
+// X86 support
+#include "support/x86/x86.h"
\ No newline at end of file
diff --git a/st_ikbd.cpp b/support/st/st_ikbd.cpp
similarity index 99%
rename from st_ikbd.cpp
rename to support/st/st_ikbd.cpp
index ab44543..2ad1f68 100644
--- a/st_ikbd.cpp
+++ b/support/st/st_ikbd.cpp
@@ -27,10 +27,10 @@ M1 tank platoon/A_385 fixed
#include
#include
-#include "user_io.h"
-#include "spi.h"
+#include "../../user_io.h"
+#include "../../spi.h"
#include "st_ikbd.h"
-#include "debug.h"
+#include "../../debug.h"
#define IKBD_AUTO_MS 20
diff --git a/st_ikbd.h b/support/st/st_ikbd.h
similarity index 100%
rename from st_ikbd.h
rename to support/st/st_ikbd.h
diff --git a/st_tos.cpp b/support/st/st_tos.cpp
similarity index 95%
rename from st_tos.cpp
rename to support/st/st_tos.cpp
index d8c9206..c0c5ea4 100644
--- a/st_tos.cpp
+++ b/support/st/st_tos.cpp
@@ -2,14 +2,14 @@
#include
#include
-#include "hardware.h"
-#include "menu.h"
+#include "../../hardware.h"
+#include "../../menu.h"
#include "st_tos.h"
-#include "file_io.h"
-#include "debug.h"
-#include "user_io.h"
+#include "../../file_io.h"
+#include "../../debug.h"
+#include "../../user_io.h"
#include "st_ikbd.h"
-#include "fpga_io.h"
+#include "../../fpga_io.h"
#define CONFIG_FILENAME "MIST.CFG"
diff --git a/st_tos.h b/support/st/st_tos.h
similarity index 99%
rename from st_tos.h
rename to support/st/st_tos.h
index 21691b2..58b0323 100644
--- a/st_tos.h
+++ b/support/st/st_tos.h
@@ -1,7 +1,7 @@
#ifndef __ST_TOS_H__
#define __ST_TOS_H__
-#include "file_io.h"
+#include "../../file_io.h"
// FPGA spi cmommands
#define MIST_INVALID 0x00
diff --git a/x86.cpp b/support/x86/x86.cpp
similarity index 99%
rename from x86.cpp
rename to support/x86/x86.cpp
index afbd7dd..aabb4a3 100644
--- a/x86.cpp
+++ b/support/x86/x86.cpp
@@ -24,18 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
-#include "spi.h"
-#include "user_io.h"
-#include "file_io.h"
-#include "fpga_io.h"
+#include "../../spi.h"
+#include "../../user_io.h"
+#include "../../file_io.h"
+#include "../../fpga_io.h"
#define ALT_CPU_CPU_FREQ 90000000u
@@ -62,52 +62,52 @@ typedef struct
static x86_config config;
-static uint8_t dma_sdio(int status)
-{
- uint8_t res;
- EnableFpga();
- spi8(UIO_DMA_SDIO);
- res = spi_w((uint16_t)status);
- DisableFpga();
- return res;
-}
-
-static uint32_t dma_get(uint32_t address)
-{
- EnableFpga();
- spi8(UIO_DMA_READ);
- spi32w(address);
- uint32_t res = spi32w(0);
- DisableFpga();
- return res;
-}
-
-static void dma_set(uint32_t address, uint32_t data)
-{
- EnableFpga();
- spi8(UIO_DMA_WRITE);
- spi32w(address);
- spi32w(data);
- DisableFpga();
-}
-
-static void dma_sendbuf(uint32_t address, uint32_t length, uint32_t *data)
-{
- EnableFpga();
- spi8(UIO_DMA_WRITE);
- spi32w(address);
- while (length--) spi32w(*data++);
- DisableFpga();
-}
+static uint8_t dma_sdio(int status)
+{
+ uint8_t res;
+ EnableFpga();
+ spi8(UIO_DMA_SDIO);
+ res = spi_w((uint16_t)status);
+ DisableFpga();
+ return res;
+}
-static void dma_rcvbuf(uint32_t address, uint32_t length, uint32_t *data)
-{
- EnableFpga();
- spi8(UIO_DMA_READ);
- spi32w(address);
- while (length--) *data++ = spi32w(0);
- DisableFpga();
-}
+static uint32_t dma_get(uint32_t address)
+{
+ EnableFpga();
+ spi8(UIO_DMA_READ);
+ spi32w(address);
+ uint32_t res = spi32w(0);
+ DisableFpga();
+ return res;
+}
+
+static void dma_set(uint32_t address, uint32_t data)
+{
+ EnableFpga();
+ spi8(UIO_DMA_WRITE);
+ spi32w(address);
+ spi32w(data);
+ DisableFpga();
+}
+
+static void dma_sendbuf(uint32_t address, uint32_t length, uint32_t *data)
+{
+ EnableFpga();
+ spi8(UIO_DMA_WRITE);
+ spi32w(address);
+ while (length--) spi32w(*data++);
+ DisableFpga();
+}
+
+static void dma_rcvbuf(uint32_t address, uint32_t length, uint32_t *data)
+{
+ EnableFpga();
+ spi8(UIO_DMA_READ);
+ spi32w(address);
+ while (length--) *data++ = spi32w(0);
+ DisableFpga();
+}
static int load_bios(const char* name, uint8_t index)
{
@@ -178,30 +178,30 @@ static __inline fileTYPE *get_image(uint32_t type)
return &fdd_image1;
}
-static int img_mount(uint32_t type, char *name)
-{
- FileClose(get_image(type));
-
- int writable = FileCanWrite(name);
- int ret = FileOpenEx(get_image(type), name, writable ? (O_RDWR | O_SYNC) : O_RDONLY);
- if (!ret)
- {
- get_image(type)->size = 0;
- printf("Failed to open file %s\n", name);
- return 0;
- }
-
- printf("Mount %s as %s\n", name, writable ? "read-write" : "read-only");
- return 1;
-}
+static int img_mount(uint32_t type, char *name)
+{
+ FileClose(get_image(type));
-static int img_read(uint32_t type, uint32_t lba, void *buf, uint32_t len)
+ int writable = FileCanWrite(name);
+ int ret = FileOpenEx(get_image(type), name, writable ? (O_RDWR | O_SYNC) : O_RDONLY);
+ if (!ret)
+ {
+ get_image(type)->size = 0;
+ printf("Failed to open file %s\n", name);
+ return 0;
+ }
+
+ printf("Mount %s as %s\n", name, writable ? "read-write" : "read-only");
+ return 1;
+}
+
+static int img_read(uint32_t type, uint32_t lba, void *buf, uint32_t len)
{
if (!FileSeekLBA(get_image(type), lba)) return 0;
return FileReadAdv(get_image(type), buf, len);
}
-static int img_write(uint32_t type, uint32_t lba, void *buf, uint32_t len)
+static int img_write(uint32_t type, uint32_t lba, void *buf, uint32_t len)
{
if (!FileSeekLBA(get_image(type), lba)) return 0;
return FileWriteAdv(get_image(type), buf, len);
@@ -488,14 +488,14 @@ static int hdd_set(uint32_t num)
return hdd[num].present;
}
-static uint8_t bin2bcd(unsigned val)
-{
- return ((val / 10) << 4) + (val % 10);
+static uint8_t bin2bcd(unsigned val)
+{
+ return ((val / 10) << 4) + (val % 10);
}
void x86_init()
{
- user_io_8bit_set_status(UIO_STATUS_RESET, UIO_STATUS_RESET);
+ user_io_8bit_set_status(UIO_STATUS_RESET, UIO_STATUS_RESET);
load_bios("ao486/boot0.rom", 0);
load_bios("ao486/boot1.rom", 1);
@@ -532,7 +532,7 @@ void x86_init()
//-------------------------------------------------------------------------- floppy
fdd_set(config.fdd_name);
-
+
//-------------------------------------------------------------------------- hdd
hdd_set(0);
@@ -551,8 +551,8 @@ void x86_init()
unsigned char translate_mode = 1; //LBA
translate_mode = (translate_mode << 6) | (translate_mode << 4) | (translate_mode << 2) | translate_mode;
- time_t t = time(NULL);
- struct tm tm = *localtime(&t);
+ time_t t = time(NULL);
+ struct tm tm = *localtime(&t);
//rtc contents 0-127
uint32_t tmp[128] = {
@@ -650,8 +650,8 @@ void x86_init()
cmos[0x2F] = sum & 0xFF;
for(unsigned int i=0; i