summaryrefslogtreecommitdiffstats
path: root/asm.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-10-04 23:13:37 +0200
committerLouis Burda <quent.burda@gmail.com>2023-10-04 23:13:37 +0200
commit4231d51da9384a00934a82cb9c17815b356a068a (patch)
tree55a3311da5c13949304399b56a26b3d8ec0449f7 /asm.c
parentc27689dfdcd725246731d4f28a5548ff6818f43b (diff)
downloadtis100-4231d51da9384a00934a82cb9c17815b356a068a.tar.gz
tis100-4231d51da9384a00934a82cb9c17815b356a068a.zip
Fix port alphabet
Diffstat (limited to 'asm.c')
-rw-r--r--asm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/asm.c b/asm.c
index e42da16..4ecca1d 100644
--- a/asm.c
+++ b/asm.c
@@ -11,6 +11,7 @@
#define TEXTALPH "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
#define NUMALPH "0123456789"
+#define PORTALPH "abcdefghijklmnopqrstuvwxyz0123456789"
#define NAMEALPH TEXTALPH NUMALPH
#define WHITESPACE " \t\v\r\n,"
@@ -87,9 +88,11 @@ is_int(const char *str)
static int
asm_port_char_to_index(char c)
{
- if (!isalpha(c))
- die("invalid io port char '%c'", c);
- return tolower(c) - 'a';
+ char *p;
+
+ p = strchr(PORTALPH, tolower(c));
+ if (!p) die("invalid io port char '%c'", c);
+ return (int) (p - PORTALPH);
}
static bool