diff --git a/Tools/unix/uz80as/expr.c b/Tools/unix/uz80as/expr.c index 2897461f..1de2c7e5 100644 --- a/Tools/unix/uz80as/expr.c +++ b/Tools/unix/uz80as/expr.c @@ -335,6 +335,16 @@ loop: p = q; goto oper; } + } else if ((p[0] == '0') && (p[1] == 'x')) { + p+=2; + q = getpnum(p, 16, &n); + if (q == NULL) { + p--; + ec = EXPR_E_HEX; + goto esyntax; + } + p = q; + goto oper; } else if (isdigit(*p)) { if (last == 'n') goto end; diff --git a/Tools/unix/uz80as/test.asm b/Tools/unix/uz80as/test.asm index bdae9698..28fdff3b 100644 --- a/Tools/unix/uz80as/test.asm +++ b/Tools/unix/uz80as/test.asm @@ -1,3 +1,8 @@ - .org $100 + .org 0x100 beep: .text "\"\"\"" ; comment + .align 4 + .text "foo" + .align 16 + .text "bar" + .db $45,0x67,'7' .end diff --git a/Tools/unix/uz80as/uz80as.c b/Tools/unix/uz80as/uz80as.c index ca2955b7..35c13ac0 100644 --- a/Tools/unix/uz80as/uz80as.c +++ b/Tools/unix/uz80as/uz80as.c @@ -40,6 +40,7 @@ static void output(); +static const char *d_align(const char *); static const char *d_null(const char *); static const char *d_block(const char *); static const char *d_byte(const char *); @@ -72,6 +73,7 @@ static struct direc { const char *name; const char *(*fun)(const char *); } s_directab[] = { + { "ALIGN", d_align }, { "BLOCK", d_block }, { "BYTE", d_byte }, { "CHK", d_chk }, @@ -85,6 +87,7 @@ static struct direc { { "EQU", d_equ }, { "EXPORT", d_export }, { "FILL", d_fill }, + { "GLOBAL", d_export }, { "LIST", d_list }, { "LSFIRST", d_lsfirst }, { "MODULE", d_module }, @@ -94,6 +97,7 @@ static struct direc { { "NOPAGE", d_null }, { "ORG", d_org }, { "PAGE", d_null }, + { "SECTION", d_null }, { "SET", d_set }, { "TEXT", d_text }, { "TITLE", d_title }, @@ -819,6 +823,38 @@ dnlst: return p; } +static const char *d_align(const char *p) +{ + int n, v, er; + const char *q; + enum expr_ecode ecode; + const char *ep, *eps; + + eps = p; + er = 0; + p = expr(p, &n, s_pc, 0, &ecode, &ep); + if (p == NULL) { + exprint(ecode, s_pline, ep); + newerr(); + return NULL; + } + + if (n < 0) { + eprint(_("align is negative (%d)\n"), n); + eprcol(s_pline, eps); + exit(EXIT_FAILURE); + } + + while (s_pc % n) { + genb(0, eps); + } + + if (er) + return NULL; + else + return p; +} + static const char *d_byte(const char *p) { return d_lst(p, 0);