From 5ee501eec5820830d396ff1b7d27d4f937fd806e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sat, 7 Dec 2019 18:43:38 +0100 Subject: [PATCH] initial import --- .gitignore | 4 ++++ Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ startup.S | 22 ++++++++++++++++++++++ strb_inv.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 startup.S create mode 100644 strb_inv.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3ffa79d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +depend +*.prg +*.o + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4b04e7f --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +# + +TOOLCHAIN_PREFIX=m68k-atari-mint- +CC=$(TOOLCHAIN_PREFIX)gcc + +UNAME := $(shell uname) +ifeq ($(UNAME),Linux) +PREFIX=m68k-atari-mint +HATARI=hatari +else +PREFIX=/opt/cross-mint/m68k-atari-mint +HATARI=/usr/local/bin/hatari +endif + +CFLAGS= \ + -Os\ + -fomit-frame-pointer\ + -mcpu=547x\ + -Wall\ + -mshort\ + -nostdlib + +APP=strb_inv.prg + +all: $(APP) + +SOURCES=startup.S strb_inv.c + +OBJECTS=$(SOURCES:.c=.o) + +$(APP): $(OBJECTS) depend + $(CC) $(CFLAGS) $(OBJECTS) -o $(APP) -lgcc + m68k-atari-mint-strip $(APP) + +.PHONY clean: + - rm -rf *.o depend strb_inv.prg + +depend: $(SOURCES) + $(CC) $(CFLAGS) $(INCLUDE) -M $(SOURCES) strb_inv.c > depend + + +ifneq (clean,$(MAKECMDGOALS)) +-include depend +endif diff --git a/startup.S b/startup.S new file mode 100644 index 0000000..0dfe99c --- /dev/null +++ b/startup.S @@ -0,0 +1,22 @@ + .extern _main + .globl _program_length + + .equ BASEPAGE_SIZE,0x100 + + .text + +start: + move.l 4(sp),a5 | address to basepage + move.l 0x0c(a5),d0 | length of text segment + add.l 0x14(a5),d0 | length of data segment + add.l 0x1c(a5),d0 | length of bss segment + add.l #BASEPAGE_SIZE,d0 | length of stackpointer+basepage + move.l d0,_program_length | save program length so _main() can access it + + jsr _main | make sure we never return here + + .bss + +_program_length: + ds.l 1 + diff --git a/strb_inv.c b/strb_inv.c new file mode 100644 index 0000000..338c7d8 --- /dev/null +++ b/strb_inv.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include + + +void __main(void) +{ + ; +} + +volatile long *acp_config = (volatile long *) 0xff040000; + +void inv_strb(void) +{ + (void) Cconws("ACP_CONFIG(0)="); + (void) Cconws(*acp_config & 1 ? "1" : "0"); + (void) Cconws("\r\n"); + *acp_config ^= 1; + (void) Cconws("ACP_CONFIG(0)="); + (void) Cconws(*acp_config & 1 ? "1" : "0"); + (void) Cconws("\r\n"); +} + +int main(int argc, char *argv[]) +{ + Supexec(inv_strb); + Pterm0(); +}