EgonOlsen71 / basicv2

A Commodore (CBM) BASIC V2 interpreter/compiler written in Java
https://egonolsen71.github.io/basicv2/
The Unlicense
84 stars 15 forks source link

Console Support: add control codes for lower/upper case #52

Closed viteisele closed 1 year ago

viteisele commented 1 year ago

Two important control codes are missing in Console Support, which are used in many basic programs for commodore (PET, VC20, C64, ...):

chr$(14): switch to lower case chr$(142): switch to upper case

So it make sense to add these control codes to Console Support, although Console Support should not replace an emulator.

EgonOlsen71 commented 1 year ago

This should actually work. I think I introduced a bug in one of the uploaded versions that I later fixed again. Maybe you pulled a buggy inbetween version. Please try again with the latest release.

viteisele commented 1 year ago

How it works :-)

I was confused by the output of C64Screen and BasicShell. Probably they don't use Console Support. I'm right ?

EgonOlsen71 commented 1 year ago

With BasicShell, you mean the actual BasicShell application? The one that I was taking about before not the Console output?

viteisele commented 1 year ago

Is this the BasicShell Application ? java -Xmx768m -cp basicv2.jar:dist/basicv2.jar com.sixtyfour.basicshell.BasicShell

EgonOlsen71 commented 1 year ago

Yes, that's the one. So we are talking about that one!?

viteisele commented 1 year ago

Yes, here the control codes are not working. And there is no message that ConsoleSupport is registered. I assume that C64Screen uses this BasicShell.

The other GUI, started e. g. with run_gui.cmd, is working fine. There is a message that ConsoleSupport is registered.

EgonOlsen71 commented 1 year ago

The BasicShell is a skinned Java text area component while the console is basically an image into which the output is being rendered, which is much more flexible. The text area approach isn't really suitable to do what the console does, especially regarding inputting and displaying text. You can't switch casing of the whole thing like you can with the console, because it can only map keyboard input 1-to-1 to the used font while the console does some translations between the input and the font to behave closely to what a C64 would display. The main problem here being that PETSCII and ASCII are reversed in terms of lower/upper case. The console can adapt to that, the text area can't. Long story short: I can't really support these control codes in any reasonable way in the shell, I'm afraid. You can use the console output from inside the shell by using the dedicated CONSOLE command, like so:

10 CONSOLE 1
20 POKE 53281,1
30 POKE 646,0
40 PRINT "HELLO"

However, the lower/upper-case usage is reversed due to the issues mentioned above, so it's not really a good option in most cases.

viteisele commented 1 year ago

Thanks for your explainations. I haven't enough knowledge about the used components for fully understanding it, but now I know where there a graphics symbols shown by LIST, when I loaded a textfile with a basic program before.

Perhaps you can update the documentation for Console Support, so that all users knows all beautiful new features.