Assembler in GNU as syntax, objdump-style disassembly, UCASE$ and LCASE$
The monitor's assembler takes GNU as directives (.org, .equ, .byte, .half, .word, .ascii, .string, .space, .align, .balign ...), # comments, 0x/0b numbers, '\n' constants, . for the current address, << >> ^ ~, %hi/%lo and the FP CSR short forms; the old ORG/DB/EQU/0FFH forms remain as aliases. The disassembler prints lower case and 0x hex as objdump does. The monitor is built with -msave-restore and puts .rodata first, to fit its ROM. BASIC gains UCASE$ and LCASE$. Manual, README and tests updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25c8286cf2
commit
fa4752fd7a
16 files changed
+7921
-7615
No files matched your search
+11
-3
@@ -198,7 +198,7 @@ enum {
|
||||
T_DO, T_LOOP, T_WHILE, T_UNTIL, T_EXIT, T_ELSE, T_SELECT, T_CASE,
|
||||
T_OPTION, T_PI, T_ANGLE, T_DEG, T_RAD, T_ASIN, T_ACOS, T_SEC, T_CSC, T_COT,
|
||||
T_SINH, T_COSH, T_TANH, T_ASINH, T_ACOSH, T_ATANH, T_LOG10, T_LOG2, T_CEIL,
|
||||
T_IP, T_FP, T_ROUND, T_TRUNCATE, T_MOD, T_MIN, T_MAX, T_FACT, T_LAST
|
||||
T_IP, T_FP, T_ROUND, T_TRUNCATE, T_MOD, T_MIN, T_MAX, T_FACT, T_UCASES, T_LCASES, T_LAST
|
||||
};
|
||||
_Static_assert(T_LAST <= 0x100, "too many keywords for a byte");
|
||||
|
||||
@@ -213,7 +213,7 @@ static const char *const kw[] = {
|
||||
"DO", "LOOP", "WHILE", "UNTIL", "EXIT", "ELSE", "SELECT", "CASE",
|
||||
"OPTION", "PI", "ANGLE", "DEG", "RAD", "ASIN", "ACOS", "SEC", "CSC", "COT",
|
||||
"SINH", "COSH", "TANH", "ASINH", "ACOSH", "ATANH", "LOG10", "LOG2", "CEIL",
|
||||
"IP", "FP", "ROUND", "TRUNCATE", "MOD", "MIN", "MAX", "FACT"
|
||||
"IP", "FP", "ROUND", "TRUNCATE", "MOD", "MIN", "MAX", "FACT", "UCASE$", "LCASE$"
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------------- memory */
|
||||
@@ -684,7 +684,7 @@ static u8 is_str_start(void)
|
||||
{
|
||||
u8 c = peekc();
|
||||
if (c == '"' || c == T_CHRS || c == T_STRS || c == T_LEFTS || c == T_RIGHTS || c == T_MIDS ||
|
||||
c == T_DATES)
|
||||
c == T_DATES || c == T_UCASES || c == T_LCASES)
|
||||
return 1;
|
||||
return is_alpha(c) && tp[1] == '$';
|
||||
}
|
||||
@@ -1107,6 +1107,14 @@ static void str_prim(char *out)
|
||||
out[0] = to_int(expr());
|
||||
out[1] = 0;
|
||||
break;
|
||||
case T_UCASES: /* only A-Z and a-z change */
|
||||
case T_LCASES: {
|
||||
char *p;
|
||||
sexpr(out);
|
||||
for (p = out; *p; p++)
|
||||
if (c == T_UCASES ? *p >= 'a' && *p <= 'z' : *p >= 'A' && *p <= 'Z') *p ^= 32;
|
||||
break;
|
||||
}
|
||||
case T_STRS: {
|
||||
float v = expr();
|
||||
out[0] = ' ';
|
||||
|
||||
Reference in new issue
Block a user