From 96393257a43ac52f2b911594d106741245dec5f0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 4 Dec 2020 15:20:28 -0500 Subject: - Started work on writing the new version of the assembler. - Did alot of stuff in the emulator. - Did alot of stuff in the SuB Suite. --- lexer/cpu/sux/cpu.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lexer/cpu/sux/cpu.c (limited to 'lexer/cpu/sux/cpu.c') diff --git a/lexer/cpu/sux/cpu.c b/lexer/cpu/sux/cpu.c new file mode 100644 index 0000000..cd6d364 --- /dev/null +++ b/lexer/cpu/sux/cpu.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include + +static char current_ext; + +int is_ext(char c) { + return (c && c != '.' && !isspace(c)); +} + +void cpu_error(int code) { + +} + +char *lex_inst(char *s, int *inst_len, char **ext, int *ext_len, int *ext_count) { + char *inst = s; + int count = *ext_count; + for (; is_ext(*s); s++); + *inst_len = s - inst; + for (; *s++ == '.' && count < MAX_QUALIFIERS;) { + ext[count] = s; + for (; is_ext(*s); s++); + ext_len[count] = s - ext[count]; + (ext_len[count] <= 0) ? (cpu_error(34)) : (count++); + } + *ext_count = count; + current_ext = (count > 0) ? tolower(ext[0][0]) : '\0'; + return s; +} -- cgit v1.2.3-13-gbd6f