Well, that's how you'd do it as a c coder, but since assembler has no inbuilt strcmp function you'd need to craft your own, and define memory blocks to store the messages, and guard against overflows and so on. My design's a little more like you'd design a state machine in C, and since it seems possible to do it fairly simply and cheaply as I've outlined, I wouldn't go to the expense of string handling personally. If you wanted more complicated stuff later, it might be worth writing all that code, but I believe in delaying such complexity until you absolutely need it. I suspect you'll only actually need full string handling capacility if you ever try to implement a command that comes after other parameters.
Yes, if you want ^q$ as the quit command, you only need a single loop to loop over characters that aren't q first, or aren't newline (aka \n, \a, \d, OxA, O
, #10 or #13 - but on Linux, \d, 0
or 0x13 aren't part of the line ending code IIRC). First, check if you get a q, then check if you get a newline. If in either case you don't you'll need to go into a loop that keeps checking characters until you get a newline, to indicate a new command.
The loops aren't that complicated. Each time it goes round one of your loops, it accepts a single character in. I'm not sure if linux passes the key strokes in as you type them, or a whole line of them once you hit enter (I suspect the latter though), but as you're only accepting them one at a time, you only get one each turn of the loop.
You could accept two characters at a time, and check if the first is q and the second is a newline, but without prototyping it out I can't say whether that would introduce further corner cases to think about.