On a different note, without leaving ASM, I just got more confident and more adventurous.
When it came to parsings command-line I didn't let myself think, "Oh shit, string utils!", I just started writing them. Turns out you can get quite "nifty" in ASM with strings...
Yes you can. Welcome to the wide, wild world of ASM.
Suggestion: To parse text, rather than using a bunch of string-decomposition functions (
instr(), substr() and friends), consider doing what I do:
Implement a FSA (finite state automaton). Actually very easy to do in any assembly language. Create a state table with pointers to stub routines. Process the text to be parsed character by character. At each row of the table, you jump to the routine corresponding to the character just seen.
* (You can even jump based on classes of characters, like numeric digits.)
Works like a charm, is generally smaller than iterative code, and is very easy to tweak because it's data-driven.
The first requirement here is to draw out the parsing (actually tokenizing) sequence
on paper. The code & data then follow directly from that diagram. It's like magic.
* This part of the scheme is helped immensely by the use of the
REP SCASB x86 instruction, which you lack in your instruction set. You'll have to code this up discretely, but that shouldn't be too hard: just construct a list of characters to be used for comparison (all your tokenizing chars.) and loop over that list until you find a match to the current character (or don't).