Identify if BASIC text is variable or constant/formula

By Eugeny_Brychkov

Paragon (1232)

Eugeny_Brychkov's picture

08-10-2016, 01:32

I need to organize input/output from assembler program into same variable. For example, CALLFUNCTION(A,B,C). But it also can be CALLFUNCTION(,,C) or CALLFUNCTION(1,2,3). Is there any safe way to check if text pointed to is variable (e.g. "A") or a constant/formula, without causing syntax error or any other errors?
Skipped variable is tested easily for comma. Checking for input value is easy using FRMEVL, and then seeing accumulator's type. But how do I know that I have variable (which can be used for output) or constant/formula, which can not be used for output?
I would want not to parse BASIC text myself, if there's such call available.

Login or register to post comments

By Sandy Brand

Champion (295)

Sandy Brand's picture

08-10-2016, 12:53

Hmm, haven't done this in a long time myself but I remembered an article about this: MSX Gids 38 - Programmeercursus deel 7 - CALL-statements - Page 36(page 38 in the .PDF) (all in dutch I am afraid).

But I am afraid you have already answered your own question. You will have to parse the BASIC tokens by yourself it seems.

I am sure it can be done. The KUN compiler was able to read/write into BASIC variables in a similar way, for example :)

By Eugeny_Brychkov

Paragon (1232)

Eugeny_Brychkov's picture

08-10-2016, 13:20

Sandy Brand wrote:

But I am afraid you have already answered your own question. You will have to parse the BASIC tokens by yourself it seems.

I want to do it as easy as possible Smile
Thank you got the link.

To achieve what I want appears to be very simple. First call is 64A7 to identify if first char is uppercase alphanumeric, and if it is, call 5EA4 (PTRGET) to get variable's reference. After getting its reference, check next char in BASIC text to be a comma (or closing bracket), if it is, then we have single variable (and can check for its type), if not (or it is wrong type) - then argument can not be used as an output of the function.