mon

This is the starting place for reporting bugs to the team. We will pass bug reports on to the developers after validating the reports.

You can report bugs in hardware, operating system (KERNAL or BASIC ROMs), the emulator, or the Demo library. For bugs specific to downloaded programs, use the download forum.
Post Reply
User avatar
schristis
Posts: 65
Joined: Sat Apr 08, 2023 6:28 am

mon

Post by schristis »

I made 3 variables--- year month day

when I use the month variable, the monitor comes up....

in case it might be worth mentioning lol...
Guybrush
Posts: 63
Joined: Fri Jul 10, 2020 10:38 pm

Re: mon

Post by Guybrush »

You might as well use MO as BASIC 2.0 supports only 2-letter variable names
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: mon

Post by TomXP411 »

Right - Commodore BASIC only supports 2 letter variables. It will accept 3 or more letters, but everything after the second character is ignored.

I would suggest the usual convention of YY, MM, and DD for year, month, and day variable names.

MON is actually the command to start Supermon, so this is correct behavior. Some other surprises are TI, MX, MY, and MB. Those are all system variables and can't be used as general purpose variables.

BASIC on the C64 is kind of unique, in that it doesn't care much about separators. The interpreter pattern-matches the first beginning of a typed word against the BASIC keywords, and if there is any match, it will assume the word is a command. Only after exhausting the list of commands does BASIC assume it's a long variable name.

This is completely unlike other interpreters, which require a space (or certain other separators) between commands and arguments.

So something like FORT actually gets interpreted "FOR T". PRINTER means PRINT the variable ER. And so on.
tim1724
Posts: 7
Joined: Thu Jun 22, 2023 5:50 pm

Re: mon

Post by tim1724 »

TomXP411 wrote: Mon May 01, 2023 8:24 pm BASIC on the C64 is kind of unique, in that it doesn't care much about separators. The interpreter pattern-matches the first beginning of a typed word against the BASIC keywords, and if there is any match, it will assume the word is a command. Only after exhausting the list of commands does BASIC assume it's a long variable name.
This is true of all the 6502 versions of Microsoft BASIC. (e.g., Applesoft BASIC on the Apple II has the same parsing quirks.)

Also it's important to note that the tokenizer will even recognize keywords inside the middle of variable names. So it will interpret "SCORE" as "SC OR E". Thus "SCORE = 3" will generate a syntax error. And this program won't produce the output you'd expect:

Code: Select all

10 SC = 7
20 SCO = 0 : REM SCO and SC are the same (only the first two letters matter)
30 E = 1
40 PRINT SC : REM prints 0
50 PRINT SCORE : REM but SCORE is interpreted as SC OR E so this prints 1
Post Reply