blob: a996e3aa42620b250900f92f994bcdacb8561a41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "subeditor.h"
int16_t str_cmp(const char *s0, uint16_t i, const char *s1, uint16_t j) {
for (; s0[i] == s1[j]; i++, j++);
return i-j;
}
void tokenize(char *str) {
uint16_t i = 0;
uint16_t skip = 0;
uint8_t done = 0;
while (!done) {
if (!cmd_buf[i]) {
done = 1;
} else {
switch (cmd_buf[i]) {
case '.':
if (skip = str_cmp(cmd_buf, i+1, "org", 0) > 0) {
f = TOK_ORG;
i += skip;
} else if (skip = str_cmp(cmd_buf, i+1, "byte", 0) > 0) {
f = TOK_BYTE;
i+=skip;
}
break;
}
}
}
}
void subasm() {
uint64_t address = 0;
tokenize(cmd_buf);
}
|