From fceb1d7a75e3eaf8bffa6fa84c38c2ab20f85e9b Mon Sep 17 00:00:00 2001 From: oscar-broman Date: Wed, 29 Jan 2014 09:41:30 +0100 Subject: [PATCH] Fix SYSREQ id always being reserved Fixes #11. --- source/compiler/sc2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 9e63396..5abad0c 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -1235,7 +1235,8 @@ static int command(void) if (sym->ident==iFUNCTN || sym->ident==iREFFUNC) { if ((sym->usage & uNATIVE)!=0) { /* reserve a SYSREQ id if called for the first time */ - sym->addr=ntv_funcid++; + if (sc_status==statWRITE && (sym->usage & uREAD)==0 && sym->addr>=0) + sym->addr=ntv_funcid++; outval(sym->addr,FALSE); } else { /* normal function, write its name instead of the address