aboutsummaryrefslogtreecommitdiff
path: root/src/t64out.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2021-09-21 21:17:14 +0100
committerIan C <ianc@noddybox.co.uk>2021-09-21 21:17:14 +0100
commit25302a2513307a3a41b76f5e568f0916713c0620 (patch)
tree64e005fc00187b959b74aeb4c0a3b90449df7605 /src/t64out.c
parent4615bf4b669af244f7a2aa71af60cb363b08c472 (diff)
Imported V1.9V1.9
Diffstat (limited to 'src/t64out.c')
-rw-r--r--src/t64out.c55
1 files changed, 50 insertions, 5 deletions
diff --git a/src/t64out.c b/src/t64out.c
index 18bfcba..e97e1ae 100644
--- a/src/t64out.c
+++ b/src/t64out.c
@@ -29,6 +29,7 @@
#include "global.h"
#include "codepage.h"
#include "t64out.h"
+#include "expr.h"
/* ---------------------------------------- MACROS & TYPES
@@ -36,6 +37,30 @@
#define NOT_USED 0
+/* ---------------------------------------- PRIVATE TYPES AND VARS
+*/
+enum option_t
+{
+ OPT_START_ADDR
+};
+
+static const ValueTable option_set[]=
+{
+ {"t64-start", OPT_START_ADDR},
+ {NULL}
+};
+
+typedef struct
+{
+ int start_addr;
+} Options;
+
+static Options options =
+{
+ -1
+};
+
+
/* ---------------------------------------- PRIVATE FUNCTIONS
*/
@@ -103,14 +128,27 @@ static void WriteString(FILE *fp, const char *p, int len,
*/
const ValueTable *T64OutputOptions(void)
{
- return NULL;
+ return option_set;
}
CommandStatus T64OutputSetOption(int opt, int argc, char *argv[],
- int quoted[],
- char *error, size_t error_size)
+ int quoted[], char *err, size_t errsize)
{
- return CMD_NOT_KNOWN;
+ CommandStatus stat = CMD_OK;
+
+ CMD_ARGC_CHECK(1);
+
+ switch(opt)
+ {
+ case OPT_START_ADDR:
+ CMD_EXPR(argv[0], options.start_addr);
+ break;
+
+ default:
+ break;
+ }
+
+ return stat;
}
int T64Output(const char *filename, const char *filename_bank,
@@ -216,7 +254,14 @@ int T64Output(const char *filename, const char *filename_bank,
int a = 0x803;
int next;
- snprintf(sys, sizeof sys, "%u", min);
+ if (options.start_addr == -1)
+ {
+ snprintf(sys, sizeof sys, "%u", min);
+ }
+ else
+ {
+ snprintf(sys, sizeof sys, "%d", options.start_addr);
+ }
a = PokeW(mem, a, 10);
a = PokeB(mem, a, 0x9e);