commanderx16 / x16-rom

Other
153 stars 43 forks source link

Feature Request: Logical KERNAL lines > 80c (to be able to enter BASIC lines > 80c) #34

Open Robert-Lloyd3 opened 4 years ago

Robert-Lloyd3 commented 4 years ago

Tested in r30 and r31.

Repro steps:

  1. Start the emulator with no additional parameters.
  2. Start typing:

10 PRINT "HELLO WORLD!" 15 REM BE SURE TO INCLUDE THE PERIOD IN THE NEXT PRINT STATEMENT. 20 PRINT "NOW IS THE TIME FOR ALL GOOD MEN TO COME TO THE AID OF THEIR COUNTRY." 30 PRINT "LINE 20 WAS IGNORED, AND NO ERROR MESSAGE WAS PRODUCED." LIST

  1. The editor will only display lines 10, 15, and 30.

Programming in BASIC should support input greater than 79 characters. You should be able to write PRINT statements that output plain text to the full width of an 80 column display mode.

Please fix. Thanks.

mist64 commented 4 years ago

This is not really a bug, but consistent with all Commodore computers, which specify BASIC lines as up to 80 characters. If you overflow 80 characters, you will keep typing into the next logical line, and pressing RETURN will only commit the characters in this next logical line.

I could see this as a feature request though. It may be useful to have longer BASIC lines.

Kroc commented 4 years ago

This change could be reserved for some potential future BASIC v3 where line-numbers are not required.

greg-king5 commented 4 years ago

Actually, BASIC on the C128 has 160 character lines (two physical lines on the 80-column VDC screen).

RevCurtisP commented 4 years ago

The C64 BASIC line buffer is only 89 characters (left over from the VIC 20, which allowed up to 4 lines of 22 characters). To allow more characters, the the buffer would have to be moved to another location in RAM.

Robert-Lloyd3 commented 4 years ago

I thought I had thoroughly read X16-Docs, but as @mist64 has commented...

https://github.com/commanderx16/x16-docs/blob/master/Commander%20X16%20Programmer's%20Reference%20Guide.md#commodore-64-compatibility

The Commander X16 BASIC interpreter is 100% backwards-compatible with the Commodore 64 one. This includes the following features:

  • All statements and functions
  • Strings, arrays, integers, floats
  • Max. 80 character BASIC lines
  • Printing "quote mode" control characters like cursor control and color codes, e.g.: ...

As someone taking a more serious look at C64's BASIC for the first time, this is only a mild annoyance. There are work-arounds for this. I understand that the availability of Kernal ROM is tight.

@RevCurtisP said:

To allow more characters, the the buffer would have to be moved to another location in RAM.

Returning an error message may be simpler (If there's still room in the Kernal ROM after everything else gets completed). I'm hoping that wouldn't necessitate moving RAM locations. It would give feedback to people who are new to C64 BASIC that they would need to refactor their intended line of code to get their program to RUN.

mist64 commented 4 years ago

Returning an error message wouldn't work with the current model of the screen editor. After reaching the end of a (logical) line, the cursor moves to the beginning of the next line. Pressing return will make the editor return all characters in the new line to the BASIC system. Detecting an error would mean that typing beyond the end of a (logical) line would have to be the error case, but since the editor can be used in many contexts, not just BASIC direct mode, this wouldn't fit the general model.

That said, BASIC could activate a special mode while in direct mode so that typing at the last column of a line would behave differently, e.g. it could remain at the last column, or return an error code to the BASIC caller. I'm not too happy with this idea though.

Robert-Lloyd3 commented 4 years ago

I'm all for setting and communicating expectations without being intrusive about it. A short error tone would be nice. I understand that a lot of other different things will be using the editor functionality as well, and adding that feedback as a special case would be difficult. There doesn't seem to be a lot of bang-for-the-buck in the effort that could be spent addressing this.

The C64 BASIC editor didn't have those niceties, but you learned the behavior and adapted to it. It's not an issue once you understand it. I understand the behavior a lot better now that I've been working within the emulator for a while.

I feel that broken functionality and functional improvements that are more likely to make a impact on creating code would be a higher priority.

mobluse commented 3 years ago

It would be easier to port programs from Applesoft BASIC for Apple II (255 characters) or C128 BASIC (160 characters) if the X16 BASIC lines where equally long or longer as those BASICs.

"Due to the size of the input buffer, a single line of the program is limited to 255 characters. [Applesoft will start beeping when you get to 248 characters]." -- https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html

mist64 commented 2 years ago

(This is actually a KERNAL feature, not a BASIC feature. BASIC already supports lines up to 255 characters: If you load a program with lines > 80c, it will work. Lines > 80c just can't be entered, because of the 80c restriction of the KERNAL EDITOR.)