Calling the Matrix Brandy tokeniser

I assumed that Jonathan Harston's list of code snippets for calling the tokeniser, in different BBC BASIC versions, already included one for Brandy. But now I look, it doesn't seem to be there.

It would be very helpful to know the equivalent routine for Matrix Brandy (editing Jonathan's BeebWiki page would be the ideal way of documenting it).

Comments

  • I will have to see if there is a way, however since its native saving format is plain text, tokenising happens when a program is loaded (or entered), and the tokens for each line are stored in memory after the plaintext version of the line, and indeed if an Acorn format or your format file is loaded, it is first detokenised then re-tokenised!
  • Soruk wrote: »
    I will have to see if there is a way, however since its native saving format is plain text, tokenising happens when a program is loaded (or entered
    But presumably tokenising must also happen as a side-effect of EVAL, and that's what all the code snippets at Jonathan's page rely on. The only significant variability between the different versions is how to find where in memory EVAL stores the tokenised version, so it can be extracted.

    Exposing the tokeniser to a BASIC program is a key feature of BBC BASIC. Even way back when I wrote the Z80 version, which as we know was started even before the BBC Micro was on sale, I was aware of that because of the way I made CALL pass the address of EVAL's buffer.

    Given that Brandy was written with a view to providing a very high degree of compatibility with ARM BASIC 5, I'm sure that making the tokeniser accessible was a key design consideration. Maybe the ARM code at Jonathan's page works as it stands.
  • Maybe the ARM code at Jonathan's page works as it stands.
    Sadly it doesn't. The first line:
        SYS "XOS_GenerateError",0,STRING$(255,"*") TO ,A%
    
    produces a "SWI name 'OS_GenerateError' not known" error. If you could implement that in such a way that it returns the address of EVAL's output buffer you might be able to achieve compatibility.

    If Matrix Brandy doesn't expose the tokeniser at all (which I would find surprising) any prospect of me porting my IDE is stymied, even if you were to add structures to make it much easier (please!).