Skip to content

Commit

Permalink
Add negative numbers to #emit
Browse files Browse the repository at this point in the history
Now you do not need to specify negative numbers in the hexadecimal system.

Signed-off-by: VVWVV <d0u61ev@gmail.com>
  • Loading branch information
VVWVV committed Jan 6, 2017
1 parent a7b5b82 commit 880fd10
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion source/compiler/sc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,22 @@ static int command(void)
} /* if */
break;
default: {
extern char *sc_tokens[]; /* forward declaration */
if ((char)tok == '-') {
int ttok = lex(&val, &str);
if (ttok == tNUMBER || ttok == tRATIONAL) {
outval(ttok == tNUMBER ? -val : val | 0x80000000,
FALSE);
code_idx += dpargs(1);
break;
} else {
char s2[33] = "-";
strcpy(s2 + 1, str);
error(1, sc_tokens[tSYMBOL - tFIRST], s2);
break;
} /* if */
} /* if */
char s2[20];
extern char *sc_tokens[];/* forward declaration */
if (tok<256)
sprintf(s2,"%c",(char)tok);
else
Expand Down

0 comments on commit 880fd10

Please sign in to comment.