Saga20101122 - simondotm/stardot-wiki GitHub Wiki

22/11/2010: Parsing Input

Had a weekend too busy to put any real effort in, but I did the parsing routine. This was one of the routines I was dreading as I had to think around a couple of loops with at least 3 different counters (one for offsets in the input, one for offset within the table and a counter for the real word - so as to match synonyms). But, it's done now, it could do with some clean up, but it's in, it works, it handles erroneous messages (with errors) and handles multiple spaces.

The next task is a large one: starting work on conditions and actions - the meat of the interpreter! As there's multiple condition and action codes, I think the best way will to have a table set up so the I can jmp (addr). I just need to make sure I get the stack right for the rts, as there's no indirect jsr instruction.

At the moment I think I'm going to have something similar to:

                         jsr handlecondition ; set up rts return in the stack

                         .... ; handle next instruction

.handlecondition  lda conditionaddrl,x

                         sta bufptr                        

                         lda conditionaddrh,x

                         sta bufptr+1

                         jmp (bufptr)

...

.conditionaddrl equb cond0L,cond1L ...

.conditionaddrh equb cond0H,cond1H ...

I'll also need to implement a random number generator for 0 (AUTO) conditions.

Comments

⚠️ **GitHub.com Fallback** ⚠️