From 25302a2513307a3a41b76f5e568f0916713c0620 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 21 Sep 2021 21:17:14 +0100 Subject: Imported V1.9 --- src/t64out.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to 'src/t64out.c') 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); -- cgit v1.2.3