Skip to content

Commit

Permalink
First version
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Jun 26, 2020
1 parent 938335d commit e3d7b42
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "AmigaOS 3.x",
"includePath": [
"${workspaceFolder}/**",
"${VBCC}/targets/m68k-amigaos/include/",
"${VBCC}/NDK39/Include/include_h"
],
"defines": ["__USE_SYSBASE"],
"compilerPath": "${VBCC}/bin/vc",
"cStandard": "c99",
"cppStandard": "c++98",
"intelliSenseMode": "${default}"
}
],
"version": 4
}
111 changes: 111 additions & 0 deletions .vscode/tasks.json
@@ -0,0 +1,111 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Compile with VBCC",
"type": "shell",
"windows": {
"command": "vc",
"args": [
"+aos68k",
"-c99",
"-O2",
"-lamiga",
"-lauto",
"-o",
"host-run",
"src/host-run.c"
]
},
"osx": {
"command": "vc",
"args": [
"+aos68k",
"-c99",
"-O2",
"-lamiga",
"-lauto",
"-o",
"host-run",
"src/host-run.c"
]
},
"linux": {
"command": "vc",
"args": [
"+aos68k",
"-c99",
"-O2",
"-lamiga",
"-lauto",
"-o",
"host-run",
"src/host-run.c"
]
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Clean",
"type": "shell",
"windows": {
"command": "rm",
"args": [
"-Path",
"./host-run,",
"./src/host-run.o,"
]
},
"osx": {
"command": "rm",
"args": [
"./host-run,",
"./src/host-run.o,"
]
},
"linux": {
"command": "rm",
"args": [
"./host-run,",
"./src/host-run.o,"
]
}
},
{
"label": "LHA Pack",
"type": "shell",
"windows": {
"command": "lha",
"args": [
"a",
"host-run.lha",
"host-run",
"README.md"
]
},
"osx": {
"command": "lha",
"args": [
"a",
"host-run.lha",
"host-run",
"README.md"
]
},
"linux": {
"command": "lha",
"args": [
"a",
"host-run.lha",
"host-run",
"README.md"
]
}
}
]
}
36 changes: 36 additions & 0 deletions src/host-run.c
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "uae_pragmas.h"

static const char version[] = "$VER: Host-Run v1.0";

int main(int argc, char *argv[])
{
char command[255];

if (argc <= 1)
{
printf("Missing argument\n");
return 0;
}

if (!InitUAEResource())
{
printf("UAEResource not found!\n");
return 2;
}

for (int i = 1; i < argc; i++)
{
strcat(command, argv[i]);

if (i != argc - 1)
strcat(command, " ");
else
strcat(command, " &\n");
}

// printf("DEBUG: %s", command);
ExecuteOnHost((UBYTE*)&command);
}
108 changes: 108 additions & 0 deletions src/uae_pragmas.h
@@ -0,0 +1,108 @@
#include <proto/exec.h>
#include <proto/dos.h>

struct uaebase
{
struct Library uae_lib;
UWORD uae_version;
UWORD uae_revision;
UWORD uae_subrevision;
UWORD zero;
APTR uae_rombase;
};

static struct uaebase *UAEResource;

static int (*calltrap)(int arg0, ...) = (int (*)(int arg0, ...))0xF0FF60;

static int InitUAEResource(void)
{
UAEResource = (struct uaebase *)OpenResource("uae.resource");
if (UAEResource)
{
calltrap = (int (*)(int arg0, ...))((BYTE *)UAEResource->uae_rombase + 0xFF60);
return 1;
}
return 0;
}

static int GetVersion(void)
{
return calltrap (0);
}
static int GetUaeConfig(struct UAE_CONFIG *a)
{
return calltrap (1, a);
}
static int SetUaeConfig(struct UAE_CONFIG *a)
{
return calltrap (2, a);
}
static int HardReset(void)
{
return calltrap (3);
}
static int Reset(void)
{
return calltrap (4);
}
static int EjectDisk(ULONG drive)
{
return calltrap (5, "", drive);
}
static int InsertDisk(UBYTE *name, ULONG drive)
{
return calltrap (5, name, drive);
}
static int EnableSound(void)
{
return calltrap (6, 2);
}
static int DisableSound(void)
{
return calltrap (6, 1);
}
static int EnableJoystick(void)
{
return calltrap (7, 1);
}
static int DisableJoystick(void)
{
return calltrap (7, 0);
}
static int SetFrameRate(ULONG rate)
{
return calltrap (8, rate);
}
static int ChgCMemSize(ULONG mem)
{
return calltrap (9, mem);
}
static int ChgSMemSize(ULONG mem)
{
return calltrap (10, mem);
}
static int ChgFMemSize(ULONG mem)
{
return calltrap (11, mem);
}
static int ChangeLanguage(ULONG lang)
{
return calltrap (12, lang);
}
static int ExitEmu(void)
{
return calltrap (13);
}
static int GetDisk(ULONG drive, UBYTE *name)
{
return calltrap (14, drive, name);
}
static int DebugFunc(void)
{
return calltrap (15);
}
static int ExecuteOnHost(UBYTE *name)
{
return calltrap (88, name);
}

0 comments on commit e3d7b42

Please sign in to comment.