Skip to content

Commit

Permalink
Updated to v1.4
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
midwan committed Feb 1, 2021
1 parent 06e66f7 commit 0a00516
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 9 deletions.
92 changes: 86 additions & 6 deletions .vscode/tasks.json
Expand Up @@ -50,29 +50,109 @@
"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",
"windows": {
"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,"
]
}
},
Expand Down
13 changes: 13 additions & 0 deletions 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
22 changes: 19 additions & 3 deletions src/host-run.c
Expand Up @@ -3,7 +3,13 @@
#include <stdlib.h>
#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 <command> <argument1> <argument2> ...\n", __ver);
return 0;
}

int main(int argc, char *argv[])
{
Expand All @@ -13,7 +19,7 @@ int main(int argc, char *argv[])
if (argc <= 1)
{
printf("Missing argument\n");
return 0;
return print_usage();
}

if (!InitUAEResource())
Expand All @@ -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);
}
23 changes: 23 additions & 0 deletions src/uae_pragmas.h
@@ -1,6 +1,29 @@
#include <proto/exec.h>
#include <proto/dos.h>

/*
* 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;
Expand Down

0 comments on commit 0a00516

Please sign in to comment.