From 0a0051658f5896ffb65f42c8478bd3242d589305 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Mon, 1 Feb 2021 22:46:13 +0100 Subject: [PATCH] Updated to v1.4 - Added "?" parameter, to show usage - Added version information - Added missing struct in header - Added Makefile for gcc compile - Added VSCode tasks to compile using gcc docker --- .vscode/tasks.json | 92 +++++++++++++++++++++++++++++++++++++++++++--- Makefile | 13 +++++++ src/host-run.c | 22 +++++++++-- src/uae_pragmas.h | 23 ++++++++++++ 4 files changed, 141 insertions(+), 9 deletions(-) create mode 100644 Makefile diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 61a305b..3dd5bb7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -50,6 +50,86 @@ "isDefault": true } }, + { + "label": "Compile with GCC (Docker)", + "type": "shell", + "windows": { + "command": "docker", + "args": [ + "run", + "--rm", + "-v", + "${workspaceFolder}:/work", + "-it", + "amigadev/crosstools:m68k-amigaos", + "make" + ] + } + }, + { + "label": "Clean (Docker)", + "type": "shell", + "windows": { + "command": "docker", + "args": [ + "run", + "--rm", + "-v", + "${workspaceFolder}:/work", + "-it", + "amigadev/crosstools:m68k-amigaos", + "make", + "clean" + ] + } + }, + { + "label": "Compile host-shell with VBCC", + "type": "shell", + "windows": { + "command": "vc", + "args": [ + "+aos68k", + "-c99", + "-O2", + "-lamiga", + "-lauto", + "-o", + "host-shell", + "src/host-shell.c" + ] + }, + "osx": { + "command": "vc", + "args": [ + "+aos68k", + "-c99", + "-O2", + "-lamiga", + "-lauto", + "-o", + "host-shell", + "src/host-shell.c" + ] + }, + "linux": { + "command": "vc", + "args": [ + "+aos68k", + "-c99", + "-O2", + "-lamiga", + "-lauto", + "-o", + "host-shell", + "src/host-shell.c" + ] + }, + "group": { + "kind": "build", + "isDefault": true + } + }, { "label": "Clean", "type": "shell", @@ -57,22 +137,22 @@ "command": "rm", "args": [ "-Path", - "./host-run,", - "./src/host-run.o," + "${workspaceFolder}/host-run,", + "${workspaceFolder}/src/host-run.o," ] }, "osx": { "command": "rm", "args": [ - "./host-run,", - "./src/host-run.o," + "${workspaceFolder}/host-run,", + "${workspaceFolder}/src/host-run.o," ] }, "linux": { "command": "rm", "args": [ - "./host-run,", - "./src/host-run.o," + "${workspaceFolder}/host-run,", + "${workspaceFolder}/src/host-run.o," ] } }, diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..821a2c0 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +# m68k-amigaos-gcc -Isrc -noixemul -fomit-frame-pointer -Os -std=c99 -o host-run src/host-run.c +all: host-run + +CC = m68k-amigaos-gcc +INCLUDES = -Isrc +CFLAGS = -mcpu=68020 -noixemul -Os -fomit-frame-pointer -std=c99 +SOURCE = src/host-run.c + +host-run: $(OBJS) + $(CC) $(CFLAGS) $(INCLUDES) $(SOURCE) -o $@ + +clean: + rm host-run diff --git a/src/host-run.c b/src/host-run.c index 7f3bc4f..ddfef4f 100644 --- a/src/host-run.c +++ b/src/host-run.c @@ -3,7 +3,13 @@ #include #include "uae_pragmas.h" -static const char version[] = "$VER: Host-Run v1.3"; +static const char __ver[40] = "$VER: Host-Run v1.4 (2021-02-01)"; + +int print_usage() +{ + printf("%s\nUsage: host-run ...\n", __ver); + return 0; +} int main(int argc, char *argv[]) { @@ -13,7 +19,7 @@ int main(int argc, char *argv[]) if (argc <= 1) { printf("Missing argument\n"); - return 0; + return print_usage(); } if (!InitUAEResource()) @@ -22,15 +28,25 @@ int main(int argc, char *argv[]) return 2; } + if (strcmp(argv[1], "?") == 0) + { + return print_usage(); + } + for (int i = 1; i < argc; i++) { +#ifdef DEBUG + printf("DEBUG: argv[%d]=%s\n", i, argv[i]); +#endif strcat(command, argv[i]); if (i != argc - 1) strcat(command, " "); } - // printf("DEBUG: %s", command); +#ifdef DEBUG + printf("DEBUG: argc=%d, command=%s\n", argc, command); +#endif ExecuteOnHost((UBYTE *)&command); memset(command, '\0', 255); } \ No newline at end of file diff --git a/src/uae_pragmas.h b/src/uae_pragmas.h index 1539d9b..ace8bd9 100644 --- a/src/uae_pragmas.h +++ b/src/uae_pragmas.h @@ -1,6 +1,29 @@ #include #include +/* + * Configuration structure + */ +struct UAE_CONFIG +{ + ULONG version; + ULONG chipmemsize; + ULONG slowmemsize; + ULONG fastmemsize; + ULONG framerate; + ULONG do_output_sound; + ULONG do_fake_joystick; + ULONG keyboard; + UBYTE disk_in_df0; + UBYTE disk_in_df1; + UBYTE disk_in_df2; + UBYTE disk_in_df3; + char df0_name[256]; + char df1_name[256]; + char df2_name[256]; + char df3_name[256]; +}; + struct uaebase { struct Library uae_lib;