Amiga: WIP vbcc support

This commit is contained in:
UnknownShadow200 2025-08-24 18:05:28 +10:00
parent afdfa29547
commit 5e4443a1f9
8 changed files with 97 additions and 23 deletions

View File

@ -300,10 +300,10 @@ macclassic_68k:
$(MAKE) -f misc/macclassic/Makefile_68k
macclassic_ppc:
$(MAKE) -f misc/macclassic/Makefile_ppc
amiga_68k:
amiga_gcc:
$(MAKE) -f misc/amiga/Makefile_68k
amiga_ppc:
$(MAKE) -f misc/amiga/Makefile_ppc
amiga:
$(MAKE) -f misc/amiga/Makefile
atari_st:
$(MAKE) -f misc/atari_st/Makefile

42
misc/amiga/Makefile Normal file
View File

@ -0,0 +1,42 @@
TARGET := ClassiCube-amiga
BUILD_DIR := build/amiga
SOURCE_DIRS := src src/amiga
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
#---------------------------------------------------------------------------------
# Code generation
#---------------------------------------------------------------------------------
CC = vc +aos68k
CFLAGS = -rmcfg-amiga-softfloat -O1 -DPLAT_AMIGA
AS = vasmm68k_mot
ASFLAGS = -Fvobj -m68000 -no-fpu
LDFLAGS = $(CFLAGS)
LDLIBS = -lamiga -lmsoft
#---------------------------------------------------------------------------------
# Main targets
#---------------------------------------------------------------------------------
default: $(BUILD_DIR) $(TARGET)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) -final -o $@ $^ $(LDLIBS)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD_DIR)/%.o : src/amiga/%.c
$(CC) $(CFLAGS) -c -o $@ $<

View File

@ -1,20 +1,23 @@
AS=m68k-amigaos-as
CC=m68k-amigaos-gcc
CXX=m68k-amigaos-g++
TARGET := ClassiCube-amiga
BUILD_DIR := build/amiga_68k
SOURCE_DIRS := src src/amiga
CFLAGS :=-O1 -fno-math-errno -DPLAT_AMIGA -DCC_BUILD_NOFPU
TARGET := ClassiCube-68k
BUILD_DIR := build-amiga-68k
SOURCE_DIR := src
LDFLAGS :=
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_ASSEMS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.S, $(C_SOURCES))
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
#---------------------------------------------------------------------------------
# Code generation
#---------------------------------------------------------------------------------
AS := m68k-amigaos-as
CC := m68k-amigaos-gcc
CXX := m68k-amigaos-g++
CFLAGS := -O1 -fno-math-errno -DPLAT_AMIGA -DCC_BUILD_NOFPU
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(C_OBJECTS:%.o=%.d)
DEPFILES := $(OBJS:%.o=%.d)
#---------------------------------------------------------------------------------
@ -32,10 +35,13 @@ $(TARGET).exe: $(C_OBJECTS)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(BUILD_DIR)/%.S
$(BUILD_DIR)/%.o : src/amiga/%.S
$(AS) $< -o $@
$(C_ASSEMS): $(BUILD_DIR)/%.S : $(SOURCE_DIR)/%.c
$(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -S -c $< -o $@
$(BUILD_DIR)/%.S : src/amiga/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -S -c $< -o $@
# Dependency tracking

View File

@ -1,4 +1,4 @@
TARGET := ClassiCube
TARGET := ClassiCube-atari
BUILD_DIR := build/atari_st
SOURCE_DIRS := src src/atari_st
@ -6,6 +6,7 @@ S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
#---------------------------------------------------------------------------------
# Code generation
#---------------------------------------------------------------------------------
@ -18,8 +19,9 @@ ASFLAGS = -Fvobj -m68000 -no-fpu
LDFLAGS = $(CFLAGS)
LDLIBS = -lm
#---------------------------------------------------------------------------------
# targets
# Main targets
#---------------------------------------------------------------------------------
default: $(BUILD_DIR) $(TARGET).tos
@ -29,6 +31,10 @@ $(BUILD_DIR):
$(TARGET).tos: $(OBJS)
$(CC) $(LDFLAGS) -final -o $@ $^ $(LDLIBS)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) -c -o $@ $<

View File

@ -264,9 +264,19 @@ typedef cc_uint8 cc_bool;
#undef CC_BUILD_FREETYPE
#define CC_BUILD_AMIGA
#define CC_BUILD_COOPTHREADED
#define CC_BUILD_TINYMEM
#define CC_BUILD_LOWMEM
#define CC_BUILD_NOMUSIC
#define CC_BUILD_NOSOUNDS
#define CC_BUILD_NOFPU
#undef CC_BUILD_RESOURCES
#undef CC_BUILD_ADVLIGHTING
#undef CC_BUILD_NETWORKING
#undef CC_BUILD_FILESYSTEM
#undef CC_BUILD_COMPRESSION
#define CC_BUILD_MAXSTACK (32 * 1024)
#define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */
#define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_NULL
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_SOFTGPU

View File

@ -98,7 +98,7 @@ float sqrtf(float x) {
}
#elif defined __GNUC__ || defined NXDK
/* Defined in .h using builtins */
#elif defined __TINYC__ || defined CC_BUILD_ATARIOS
#elif defined __TINYC__ || defined CC_BUILD_ATARIOS || defined CC_BUILD_AMIGA
/* Older versions of TinyC don't support fabsf or sqrtf */
/* Those can be used though if compiling with newer TinyC */
/* versions for a very small performance improvement */

View File

@ -31,7 +31,11 @@ const char* Platform_AppNameSuffix = " Amiga";
cc_uint8 Platform_Flags = PLAT_FLAG_SINGLE_PROCESS;
cc_bool Platform_ReadonlyFilesystem;
#ifdef __GNUC__
static const char __attribute__((used)) min_stack[] = "$STACK:102400";
#else
size_t __stack = 65536; // vbcc
#endif
/*########################################################################################################################*
*-----------------------------------------------------Main entrypoint-----------------------------------------------------*
@ -87,9 +91,10 @@ void Platform_Log(const char* msg, int len) {
TimeMS DateTime_CurrentUTC(void) {
ULONG secs, micro;
CurrentTime(&secs, &micro);
//CurrentTime(&secs, &micro);
// TODO epoch adjustment
return secs;
//return secs;
return 0;
}
void DateTime_CurrentLocal(struct cc_datetime* t) {
@ -113,9 +118,14 @@ void Process_Abort2(cc_result result, const char* raw_msg) {
#define US_PER_SEC 1000000ULL
cc_uint64 Stopwatch_Measure(void) {
#ifdef __GNUC__
ULONG secs, micro;
CurrentTime(&secs, &micro);
return secs * US_PER_SEC + micro;
#else
// TODO
return 10;
#endif
}
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {

View File

@ -7,7 +7,7 @@
#include "Errors.h"
#include "Stream.h"
#if !defined CC_BUILD_ATARIOS
#if !defined CC_BUILD_ATARIOS && !defined CC_BUILD_AMIGA
/*########################################################################################################################*
*-------------------------------------------------------Ogg stream--------------------------------------------------------*
*#########################################################################################################################*/