Permalink
Browse files

-Add : add Atari Falcon (TOS) code

to be added :
- keyboard support
- sound
- midi
- overall optimisations so the game can be playable :(
  • Loading branch information...
1 parent c2c33e3 commit a2e3ffccf37f3f22be68b4cdbf71a6ed5082c0b5 @miniupnp miniupnp committed May 6, 2016
Showing with 441 additions and 8 deletions.
  1. +9 −2 Makefile.src.in
  2. +11 −0 README.atari
  3. +21 −3 config.lib
  4. +3 −0 configure
  5. +9 −1 source.list
  6. +17 −1 src/file.c
  7. +18 −0 src/opendune.c
  8. +19 −1 src/timer.c
  9. +201 −0 src/video/c2p1x1_8.s
  10. +133 −0 src/video/video_atari.c
View
@@ -1,8 +1,10 @@
CC_HOST = !!CC_HOST!!
CC_BUILD = !!CC_BUILD!!
+AS_HOST = !!AS_HOST!!
STRIP = !!STRIP!!
CFLAGS = !!CFLAGS!!
CFLAGS_BUILD = !!CFLAGS_BUILD!!
+ASFLAGS = !!ASFLAGS!!
LIBS = !!LIBS!!
LDFLAGS = !!LDFLAGS!!
LDFLAGS_BUILD = !!LDFLAGS_BUILD!!
@@ -24,7 +26,8 @@ CONFIG_CACHE_SOURCE = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_SOURCE!!
CONFIG_CACHE_VERSION = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_VERSION!!
OBJS_C := !!OBJS_C!!
-OBJS := $(OBJS_C)
+OBJS_S := !!OBJS_S!!
+OBJS := $(OBJS_C) $(OBJS_S)
SRCS := !!SRCS!!
# All C-files depend on those 3 files
@@ -76,7 +79,7 @@ RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(REV) $(MOD
ifndef MAKEDEPEND
# The slow, but always correct, dep-check
DEP_MASK := %.d
-DEPS := $(OBJS:%.o=%.d)
+DEPS := $(OBJS_C:%.o=%.d)
# Only include the deps if we are compiling everything
ifeq ($(filter %.o clean mrproper, $(MAKECMDGOALS)),)
@@ -175,6 +178,10 @@ $(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
+$(OBJS_S): %.o: $(SRC_DIR)/%.s
+ $(E) '$(STAGE) Assembling $(<:$(SRC_DIR)/%.s=%.s)'
+ $(Q)$(AS_HOST) $(ASFLAGS) -o $@ $<
+
$(BIN_DIR)/$(OPENDUNE): $(OPENDUNE)
$(Q)cp $(OPENDUNE) $(BIN_DIR)/$(OPENDUNE)
View
@@ -0,0 +1,11 @@
+OpenDUNE runing on Atari Falcon :
+
+cross compiling under linux using cross mint :
+http://vincent.riviere.free.fr/soft/m68k-atari-mint/
+
+use :
+./configure --host=m68k-atari-mint --os=TOS
+
+you'll also need vasm (vasmm68k_mot)
+http://sun.hasenbraten.de/vasm/
+
View
@@ -16,6 +16,7 @@ set_default() {
host=""
cc_build=""
cc_host=""
+ as_host=""
strip=""
lipo=""
awk="awk"
@@ -264,10 +265,10 @@ check_params() {
# Check if all params have valid values
- # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, and WINCE
- if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE)$'`" ]; then
+ # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, and WINCE, TOS
+ if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|TOS)$'`" ]; then
log 1 "configure: error: invalid option --os=$os"
- log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE]"
+ log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|TOS]"
exit 1
fi
# cpu_type can be either 32 or 64
@@ -417,6 +418,12 @@ check_params() {
fi
fi
+ if [ "$os" = "TOS" ]; then
+ with_sdl2="0"
+ with_sdl="0"
+ with_asound="0"
+ with_pulse="0"
+ fi
detect_sdl2
detect_sdl
detect_asound
@@ -932,6 +939,14 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWIN"
fi
+ if [ "$os" = "TOS" ]; then
+ CFLAGS="-m68030 $CFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,--traditional-format"
+ as_host="vasmm68k_mot"
+ #asflags="-m68030 -Felf"
+ asflags="-m68030 -Faout"
+ fi
+
if [ -n "$sdl_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL"
# SDL must not add _GNU_SOURCE as it breaks many platforms
@@ -1724,10 +1739,12 @@ make_sed() {
SRC_REPLACE="
s@!!CC_HOST!!@$cc_host@g;
s@!!CC_BUILD!!@$cc_build@g;
+ s@!!AS_HOST!!@$as_host@g;
s@!!STRIP!!@$strip $strip_arg@g;
s@!!LIPO!!@$lipo@g;
s@!!CFLAGS!!@$T_CFLAGS@g;
s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
+ s@!!ASFLAGS!!@$asflags@g;
s@!!LIBS!!@$LIBS@g;
s@!!LDFLAGS!!@$T_LDFLAGS@g;
s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
@@ -1755,6 +1772,7 @@ make_sed() {
s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
s@!!OBJS_C!!@$OBJS_C@g;
+ s@!!OBJS_S!!@$OBJS_S@g;
s@!!SRCS!!@$SRCS@g;
s@!!OS!!@$os@g;
s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
View
@@ -66,6 +66,8 @@ make_cflags_and_ldflags
EXE=""
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "OS2" ] || [ "$os" = "DOS" ] || [ "$os" = "WINCE" ]; then
EXE=".exe"
+elif [ "$os" = "TOS" ]; then
+ EXE=".tos"
fi
OPENDUNE="opendune$EXE"
@@ -119,6 +121,7 @@ AWKCOMMAND='
SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk \"$AWKCOMMAND\" | $PIPE_SORT`"
OBJS_C="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", $0); print $0; }'`"
+OBJS_S="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.s$/ { gsub(\".s$\", \".o\", $0); print $0; }'`"
SRCS="` echo \"$SRCS\" | $awk ' { ORS = \" \" } { print $0; }'`"
# In makefiles, we always use -u for sort
View
@@ -128,16 +128,24 @@ unit.c
#if SDL2
video/video_sdl2.c
#else
- video/video_sdl.c
+ #if TOS
+ video/video_atari.c
+ #else
+ video/video_sdl.c
+ #endif
#endif
#endif
+#if TOS
+video/c2p1x1_8.s
+#else
video/hqx_init.c
video/hq2x_8b.c
video/hq3x_8b.c
video/hq4x_8b.c
video/scalebit.c
video/scale2x.c
video/scale3x.c
+#endif
wsa.c
# Header files
View
@@ -25,7 +25,11 @@
#define DUNE_DATA_DIR "."
#endif
+#ifdef TOS
+#define DUNE2_DATA_PREFIX "DATA\\"
+#else
#define DUNE2_DATA_PREFIX "data/"
+#endif
static char g_dune_data_dir[1024] = DUNE_DATA_DIR;
static char g_personal_data_dir[1024] = ".";
@@ -95,12 +99,21 @@ File_MakeCompleteFilename(char *buf, size_t len, enum SearchDirectory dir, const
int j;
int i = 0;
+#ifdef TOS
+ if (dir == SEARCHDIR_GLOBAL_DATA_DIR || dir == SEARCHDIR_CAMPAIGN_DIR) {
+ /* Note: campaign specific data directory not implemented. */
+ i = snprintf(buf, len, "%s%s", DUNE2_DATA_PREFIX, filename);
+ } else if (dir == SEARCHDIR_PERSONAL_DATA_DIR) {
+ i = snprintf(buf, len, "%s\\%s", g_personal_data_dir, filename);
+ }
+#else
if (dir == SEARCHDIR_GLOBAL_DATA_DIR || dir == SEARCHDIR_CAMPAIGN_DIR) {
/* Note: campaign specific data directory not implemented. */
i = snprintf(buf, len, "%s/%s%s", g_dune_data_dir, DUNE2_DATA_PREFIX, filename);
} else if (dir == SEARCHDIR_PERSONAL_DATA_DIR) {
i = snprintf(buf, len, "%s/%s", g_personal_data_dir, filename);
}
+#endif
buf[len - 1] = '\0';
if (i > (int)len) {
@@ -497,7 +510,10 @@ bool File_Init(void)
PathAppend(buf, TEXT("OpenDUNE"));
strncpy(g_personal_data_dir, buf, sizeof(g_personal_data_dir));
}
-#else /* _WIN32 */
+#elif defined(TOS)
+ (void)homedir;
+ strcpy(g_personal_data_dir, "SAVES");
+#else /* _WIN32 / TOS*/
/* ~/.config/opendune (Linux) ~/Library/Application Support/OpenDUNE (Mac OS X) */
homedir = getenv("HOME");
if (homedir == NULL) {
View
@@ -9,6 +9,11 @@
#include <io.h>
#include <windows.h>
#endif /* _WIN32 */
+#ifdef TOS
+#include <mint/sysbind.h>
+#include <mint/osbind.h>
+#include <mint/ostruct.h>
+#endif /* TOS */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1171,6 +1176,14 @@ static bool OpenDune_Init(int screen_magnification, VideoScaleFilter filter)
return true;
}
+#ifdef TOS
+void exit_handler(void)
+{
+ printf("Press any key to quit.\n");
+ (void)Cnecin();
+}
+#endif /* TOS */
+
#if defined(__APPLE__) && defined(SDL_MAJOR_VERSION) && (SDL_MAJOR_VERSION == 1)
int SDL_main(int argc, char **argv)
#else
@@ -1196,6 +1209,11 @@ int main(int argc, char **argv)
if (out != NULL) _dup2(_fileno(out), _fileno(stdout));
FreeConsole();
#endif
+#ifdef TOS
+ if(atexit(exit_handler) != 0) {
+ Error("atexit() failed\n");
+ }
+#endif
CrashLog_Init();
VARIABLE_NOT_USED(argc);
View
@@ -13,6 +13,11 @@
#endif /* !__USE_POSIX */
#include <signal.h>
#endif /* _WIN32 */
+#ifdef TOS
+#include <mint/sysbind.h>
+#include <mint/osbind.h>
+#include <mint/ostruct.h>
+#endif /* TOS */
#include "types.h"
#include "os/sleep.h"
#include "os/error.h"
@@ -115,7 +120,13 @@ static void Timer_InterruptRun(int arg)
timerLock = false;
}
-#if !defined(_WIN32)
+#if defined(TOS)
+void SleepAndProcessBackgroundTasks(void)
+{
+ Timer_InterruptRun(0);
+}
+
+#elif !defined(_WIN32)
static volatile sig_atomic_t s_timer_count = 0;
static void Timer_Handler(int sig)
@@ -194,6 +205,13 @@ void Timer_Init(void)
#if defined(_WIN32)
s_timerTime = s_timerSpeed / 1000;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &s_timerMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
+#elif defined(TOS)
+ (void)Cconws("Timer_Init()\r\n");
+ /* see http://toshyp.atari.org/en/004009.html#Xbtimer */
+ /* s_timerSpeed * 614400 / 10000 */
+#if 0
+ Xbtimer(0/* Timer A */, 1/* divider = 4 */, s_timerSpeed * 6144 / 10000, Timer_Handler);
+#endif
#else
s_timerTime.it_value.tv_sec = 0;
s_timerTime.it_value.tv_usec = s_timerSpeed;
Oops, something went wrong.

0 comments on commit a2e3ffc

Please sign in to comment.