diff options
-rw-r--r-- | orc/orcparse.c | 4 | ||||
-rw-r--r-- | tools/orcc.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/orc/orcparse.c b/orc/orcparse.c index 6fb9c08..e27f5c0 100644 --- a/orc/orcparse.c +++ b/orc/orcparse.c @@ -137,6 +137,10 @@ orc_parse (const char *code, OrcProgram ***programs) } else if (strcmp (token[0], ".param") == 0) { int size = strtol (token[1], NULL, 0); orc_program_add_parameter (parser->program, size, token[2]); + } else if (strcmp (token[0], ".const") == 0) { + int size = strtol (token[1], NULL, 0); + int value = strtoul (token[3], NULL, 0); + orc_program_add_constant (parser->program, size, value, token[2]); } else { ORC_ERROR("ERROR: unknown directive: %s", token[0]); } diff --git a/tools/orcc.c b/tools/orcc.c index 60f9d10..92a594a 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -357,8 +357,13 @@ output_code (OrcProgram *p, FILE *output) for(i=0;i<8;i++){ var = &p->vars[ORC_VAR_C1 + i]; if (var->size) { - fprintf(output, " orc_program_add_constant (p, %d, %d, \"%s\");\n", - var->size, var->value, varnames[ORC_VAR_C1 + i]); + if (var->value != 0x80000000) { + fprintf(output, " orc_program_add_constant (p, %d, %u, \"%s\");\n", + var->size, var->value, varnames[ORC_VAR_C1 + i]); + } else { + fprintf(output, " orc_program_add_constant (p, %d, 0x%08x, \"%s\");\n", + var->size, var->value, varnames[ORC_VAR_C1 + i]); + } } } for(i=0;i<8;i++){ |