Skip to content

Commit

Permalink
re-appled adding a custom default function base offset
Browse files Browse the repository at this point in the history
  • Loading branch information
pjshumphreys committed Nov 28, 2021
1 parent a94ab5b commit 970ace0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/sccz80/ccdefs.h
Expand Up @@ -266,6 +266,7 @@ extern int c_cpu;
extern int c_fp_mantissa_bytes;
extern int c_fp_exponent_bias;
extern int c_old_diagnostic_fmt;
extern int c_offset;


#include "misc.h"
Expand Down
2 changes: 1 addition & 1 deletion src/sccz80/declparse.c
Expand Up @@ -1813,7 +1813,7 @@ static void declfunc(Type *functype, enum storage_type storage)

infunc = 1; /* In a function for sure! */

where = 2 + currfn->ctype->funcattrs.params_offset;
where = c_offset + currfn->ctype->funcattrs.params_offset;

/* If we use frame pointer we preserve previous framepointer on entry
* to each function
Expand Down
2 changes: 2 additions & 0 deletions src/sccz80/main.c
Expand Up @@ -40,6 +40,7 @@ int c_standard_escapecodes = 0; /* \n = 10, \r = 13 */
int c_disable_builtins = 0;
int c_cline_directive = 0;
int c_cpu = CPU_Z80;
int c_offset = 2;
int c_old_diagnostic_fmt = 0;
char *c_zcc_opt = "zcc_opt.def";

Expand Down Expand Up @@ -100,6 +101,7 @@ static option sccz80_opts[] = {
{ 0, "disable-builtins", OPT_BOOL|OPT_DOUBLE_DASH, "Disable builtin functions",&c_disable_builtins, NULL, 0},
{ 0, "doublestr", OPT_BOOL, "Store FP constants as strings", &c_double_strings, NULL, 0 },
{ 0, "math-z88", OPT_ASSIGN|OPT_INT, "(deprecated) Make FP constants match z88", &c_maths_mode, NULL, MATHS_Z88 },
{ 0, "base", OPT_INT, "=<num> Base offset for stack locations (default: 2)", &c_offset, NULL, 0},

{ 0, "fp-exponent-bias", OPT_INT, "=<num> FP exponent bias (default: 128)", &c_fp_exponent_bias, NULL, 0 },
{ 0, "fp-mantissa-size", OPT_INT, "=<num> FP mantissa size (default: 5 bytes)", &c_fp_mantissa_bytes, NULL, 0 },
Expand Down

0 comments on commit 970ace0

Please sign in to comment.