Re: DATA command, did I find a bug or a feature

From: Hans Liss <Hans_at_Liss.pp.se>
Date: Thu, 9 Sep 2021 10:50:38 +0200
Message-ID: <de04ca18-2a4e-12da-57f9-bbfc43695179_at_Liss.pp.se>
Nice find! Clearly a feature. :)

I tried looking through the disassembly (VIC-20, but it's the same), and 
without analyzing it in detail, it looked like there was simply no 
validation of what's between commas, or after the last one in the 
statement. It's handed over to floating-point conversion, which looked 
like it initialized the value to 0 and then immediately terminated when 
encountering an empty string.

I wondered first why it doesn't accept "A=", but LET, unlike DATA, does 
expression evaluation, so it may not accept an empty string.

The MS Basic manuals don't mention this, and neither does the first CBM 
BASIC manual I found, which was more or less a verbatim copy of the MS 
one. However, the C64 user's guide says "If two commas have nothing 
between them, the value will be READ as a zero for a number, or an empty 
string" (page 118)

/Hans

On 2021-09-09 10:15, Baltissen, GJPAA (Ruud) wrote:
>
> Hallo allemaal,
>
> I’m busy writing my own OS and BASIC meant to run on my Commodore 
> PC20-III and written in ML. Checking the behavior of DATA and READ on 
> my C64 I ran into this:
>
> 1 data 1,2,
>
> 2 data 3,4
>
> 3 read a,b,c,d
>
> 4 print a,b,c,d
>
> run
>
> 1    2    0    3
>
> Notice the sole comma at the end of line 1. I more or less expected an 
> error during the run because no data can be found after that comma but 
> you can see the result. I thought to be smart and to run this little 
> program on an IBM 5150 but with the same result. Then it struck that 
> CBM BASIC was written by Microsoft as well. And I don’t have other 
> machines (or even an emulator) at hand where I could test this.
>
> My question: did I run into a bug or is this supposed to happen?
>
> With kind regards / met vriendelijke groet, Ruud Baltissen
>
> http://www.baltissen.org <http://www.baltissen.org/>
>
> De informatie in dit e-mailbericht is vertrouwelijk en uitsluitend 
> bestemd voor de
> geadresseerde. Wanneer u dit bericht per abuis ontvangt, verzoeken wij 
> u contact op te
> nemen met de afzender per kerende e-mail. Verder verzoeken wij u in 
> dat geval dit
> e-mailbericht te vernietigen en de inhoud ervan aan niemand openbaar 
> te maken.
> Wij aanvaarden geen aansprakelijkheid voor onjuiste, onvolledige dan 
> wel ontijdige
> overbrenging van de inhoud van een verzonden e-mailbericht, noch voor 
> daarbij
> overgebrachte virussen.
>
> APG Groep N.V. is gevestigd te Heerlen en is ingeschreven in het
> handelsregister van de Kamer van Koophandel Limburg onder nummer 14099617
>
>
> The information contained in this e-mail is confidential and may be 
> privileged.
> It may be read, copied and used only by the intended recipient.
> If you have received it in error, please contact the sender 
> immediately by
> return e-mail; please delete in this case the e-mail and do not 
> disclose its
> contents to any person. We don't accept liability for any errors, 
> omissions,
> delays of receipt or viruses in the contents of this message which 
> arise as a
> result of e-mail transmission.
>
> APG Groep N.V. is registered in the trade register of the Chamber
> of Commerce Limburg, The Netherlands, registration number: 14099617
>
Received on 2021-09-09 11:02:50

Archive generated by hypermail 2.3.0.