From e1dcecf9d221f030c041657c5f69f15236cd3c43 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 6 Sep 2018 11:48:23 +0100 Subject: Made '$' expansion account for bank in 24-bit address mode. --- src/casm.c | 3 ++- src/label.c | 18 +++++++++++++++++- src/label.h | 4 ++++ src/test/bank | 6 ++++++ 4 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/casm.c b/src/casm.c index cd5f116..a22ff34 100644 --- a/src/casm.c +++ b/src/casm.c @@ -59,7 +59,7 @@ */ static const char *casm_usage = -"Version 1.5 development\n" +"Version 1.5\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -176,6 +176,7 @@ CommandStatus SetOption(int opt, int argc, char *argv[], { case OPT_ADDRESS24: options.address24 = ParseTrueFalse(argv[0], FALSE); + LabelSetAddress24(options.address24); break; default: break; diff --git a/src/label.c b/src/label.c index 946a6ea..72e752c 100644 --- a/src/label.c +++ b/src/label.c @@ -56,6 +56,8 @@ static char namespace[MAX_LABEL_SIZE + 1]; static Stack *stack; +static int address24 = FALSE; + /* ---------------------------------------- PRIVATE FUNCTIONS */ @@ -297,7 +299,15 @@ int LabelExpand(const char *expr, int *result) /* Current PC */ case '$': - *result = PC(); + if (address24) + { + *result = Bank() << 16 | PC(); + } + else + { + *result = PC(); + } + return TRUE; default: @@ -570,6 +580,12 @@ void LabelReadBlob(FILE *fp, int offset) } +void LabelSetAddress24(int onoff) +{ + address24 = onoff; +} + + /* vim: ai sw=4 ts=8 expandtab */ diff --git a/src/label.h b/src/label.h index a7cb720..04f01d4 100644 --- a/src/label.h +++ b/src/label.h @@ -126,6 +126,10 @@ void LabelWriteBlob(FILE *fp); */ void LabelReadBlob(FILE *fp, int offset); +/* Set 24-bit address mode +*/ +void LabelSetAddress24(int onoff); + #endif diff --git a/src/test/bank b/src/test/bank index 5b1606b..8610dea 100644 --- a/src/test/bank +++ b/src/test/bank @@ -1,4 +1,8 @@ + option +list + option +list-labels + option +address24 + ; option output-format,spectrum option output-bank,code-%u option output-file,output.tap @@ -13,4 +17,6 @@ defb 2 org $078000 +label: defb 3 +labellen: equ $ - label -- cgit v1.2.3