128 Basic and keywords within quotes

Post Reply
SabreWulf
Posts: 17
Joined: Mon Jul 26, 2021 6:31 pm

128 Basic and keywords within quotes

Post by SabreWulf »

Example:
10 LET z$="10101010"
20 PRINT VAL ("BIN "+z$)

In 48 basic, the BIN is enter-able as a keyword. I can't see a way for 128 basic to recognise BIN within quotes as anything other than "B" + "I" + "N". The result in 128 basic is the equivalent of typing 'B' 'I' 'N' in 48 basic: i.e. variable not found; rather than evaluating BIN z$.

Unsurprisingly, writing it in 128 basic and transferring the listing to 48 basic with 'spectrum' retains the 'B' 'I' 'N' as three separate characters - rather than then tokenising it.

Is there any way of entering line 20 in 128 basic and it working as intended? I can see that the single character entry wouldn't be able to parse it as a keyword if it can't be made aware that it's a keyword.
SabreWulf
Posts: 17
Joined: Mon Jul 26, 2021 6:31 pm

Re: 128 Basic and keywords within quotes

Post by SabreWulf »

Double post deleted.
Last edited by SabreWulf on Fri Mar 10, 2023 3:32 pm, edited 1 time in total.
SabreWulf
Posts: 17
Joined: Mon Jul 26, 2021 6:31 pm

Re: 128 Basic and keywords within quotes

Post by SabreWulf »

Answering my own question, a solution is:

20 PRINT VAL (CHR$ 196 + z$)

To save anyone looking that up, CHR$ 196 is, unsurprisingly, the BIN keyword.

I hadn't realised that 128 basic parsing would require workarounds like this. Anyway, onward and upward.

Any other solutions would still be appreciated.
User avatar
1024MAK
Posts: 4433
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: 128 Basic and keywords within quotes

Post by 1024MAK »

Hmm, I thought this subject sounded familiar, see also here.

Mark
Post Reply