initial import

This commit is contained in:
Markus Fröschle
2019-12-07 18:43:38 +01:00
commit 5ee501eec5
4 changed files with 100 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
depend
*.prg
*.o

44
Makefile Normal file
View File

@@ -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

22
startup.S Normal file
View File

@@ -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

30
strb_inv.c Normal file
View File

@@ -0,0 +1,30 @@
#include <stdio.h>
#include <stdint.h>
#include <osbind.h>
#include <mint/ostruct.h>
#include <mint/sysvars.h>
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();
}