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

Shell Window Add-On #2

Closed nietoperz809 closed 7 years ago

nietoperz809 commented 7 years ago

Look here: https://github.com/nietoperz809/OlsenBasic/tree/master/src/main/java/com/sixtyfour/basicshell Add this package to your code and run the ShellFrame Class.

It works almost like an original C64-Editor :)

EgonOlsen71 commented 7 years ago

Nice work! I noticed a small issue with stopping the program. Something like

10 goto 10

can be stopped just fine now. But if I add some output, like

10 print"hello":goto10

then the stop event never comes, i.e. the button click won't be recognized.

EgonOlsen71 commented 7 years ago

Another issue:

10 input a

works fine, but something like

10 input"test";a

doesn't, because the actual input will be "est?123" in that case.

nietoperz809 commented 7 years ago

in ShellInputProvider readString() String s = shellFrame.getString(); s = s.substring(s.lastIndexOf('?')+1); should fix this.

EgonOlsen71 commented 7 years ago

Yes, it does. I used indexOf() instead, because lastIndexOf() would prevent you from using a question mark in your actual input string, but anyway...

EgonOlsen71 commented 7 years ago

I've added the current state to the repository now.

EgonOlsen71 commented 7 years ago

I've modified your code slightly to look more C64 like and I sadly had to remove the Java8 related stuff, because I have to stay compatible with 6/7 because of...reasons. I also renamed the actual shell class to make it more clear what it actually is (IMHO).

The issue mentioned above (not being able to stop programs with heavy output) has been fixed by delaying the text area update slightly when a program is running. It doesn't seem like the best solution to me, but it works fine for now (tm).

Again, this is very nice work. Thanks for coding this and for making it available! I really appreciate it.

nietoperz809 commented 7 years ago

Thanks, Egon. I also like your CBM-Basic very much. Great work! Btw, regarding the Input problem with the question mark: I hope that I now have the final fix. Please see my repo.

EgonOlsen71 commented 7 years ago

I see. I ported that change as well as some others like the dir command and the tooltip. I also tried to port the BlockCaret, but it totally screwed up rendering then a little more was visible on screen and I moved the cursor.

nietoperz809 commented 7 years ago

OK, it now has the blinking block caret from a groovy text editor. look in my repo ...

nietoperz809 commented 7 years ago

Apropos caret: the new code has a caret listener to get the line number. This is much faster than the old iterative getLinePos() function that counts the rows. :)

EgonOlsen71 commented 7 years ago

Ported both changes into my repo, works much better now...:-)

nietoperz809 commented 7 years ago

Hi Egon, take a look at my new version. For a quick overview run the executable in out/artifacts/OlsenBasic_jar It has a nice C64 font, copy/paste-support, and so on. Font source is: http://www.commodoreserver.com/BlogEntryView.asp?EID=C1BE965E77A14734875AD8018497C154

EgonOlsen71 commented 7 years ago

Nice! I've ported most of your changes to my repo as well. My immediate mode implementation is still different and so are the colors and such, but anyway... I've also added some simple truncation to the text area, so that 10print"hello":goto10 doesn't bring the system to a halt.

nietoperz809 commented 7 years ago

Hi, I made another C64 shell that is able to display colors. It has a C64 character ROM and simulates color RAM like a real sixtyfour it is also much faster (doesn't need a Swing TextArea anymore) --> https://github.com/nietoperz809/C64Screen

Try out the jar or build it yourself. :)

10 FOR S = 0 TO 15 20 POKE 646,S 21 FOR N=0 TO 39 40 PRINT CHR$ (128); 41 NEXT N 50 PRINT 70 NEXT S

nietoperz809 commented 7 years ago

Btw, run-stop is CTRL-C

EgonOlsen71 commented 7 years ago

Looks very nice and feel quite authentic. I'll stick with my fork of your first implementation for now, though. Using a TextArea has it's drawbacks, but it has its advantages as well.