Jump to content
  • 0

The most Basics of Basic


Zombley
 Share

Question

Hello all!

Newcomer here. I used to love Basic programming on the C64, but that was over 30 years ago. I have unfinished business (old programs to port/finish), and new games to create and would love to make them for the x16, but I have really beginner questions (starting over again). Maybe it will help other newbs as well.

1) I know I could start by typing directly into the emulator, but can someone talk me through a better process? I've seen mention of using text editors (like notepad++), but what's the workflow to get from there into the x16 emulator? Copy paste?

2) IIRC, in c-64, each line was limited to 80 cols (chars)? Same here?

3) Anything else real basic about this Basic?

I guess that's it for now. If it means anything I'll be starting with some text adventures, so no gfx yet.

  • Like 3
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
On 11/23/2021 at 8:34 PM, Zombley said:

1) I know I could start by typing directly into the emulator, but can someone talk me through a better process? I've seen mention of using text editors (like notepad++), but what's the workflow to get from there into the x16 emulator? Copy paste?

You can copy from your text editor (I'm using Sublime Text on Windows) and paste it into a running emulator session, which will simply behave as though you are typing it very fast. I'd say with 0 errors, but it obviously won't correct any errors in your text editor, but it should make a perfect copy of your text into a tokenized ready to run BASIC program.

Alternatively, the emulator has several useful command line options. Especially useful to answer this question are "-bas filename.txt" to load your BASIC program text into the emulator and "-run" to auto run the program after emulator startup and program load have finished.

On 11/23/2021 at 8:34 PM, Zombley said:

2) IIRC, in c-64, each line was limited to 80 cols (chars)? Same here?

Yes, still 80 in Commander X16 BASIC.

On 11/23/2021 at 8:34 PM, Zombley said:

3) Anything else real basic about this Basic?

I guess that's it for now. If it means anything I'll be starting with some text adventures, so no gfx yet.

Nothing that come to mind, but others might have useful suggestions.

  • Like 1
Link to comment
Share on other sites

  • 0

The documentation for the X16 indicates that BASIC programs for the C64 are 100% compatible, so long as PEEK and POKE commands aren't used. So you could start there, using some existing programs to get comfortable with it.

Here is how to use the run command from Notepad++ on the file you are working on (in Windows).

  • Download and install Notepad++
  • Download the X16 emulator x16emu_win-r38.zip file
  • Open Windows Explorer, go to C:\Program Files(x86), right click > New > Folder, and name it x16emu
  • In Explorer go to your Downloads folder, double click on x16emu_win-r38.zip to open so you can see the files
  • CLT+A to select all the files, then CTL+C to copy them (no indication of success on this), then go back to C:\Program Files(x86)\x16emu and CTL+P to paste the files
  • Open Notepad++, create a new program (type in all caps!) and save the file to your Documents folder
  • Press F5 to open the Run dialog and paste the following into it run the currently active file

"C:\Program Files (x86)\x16emu\x16emu.exe" -run -bas "$(FULL_CURRENT_PATH)"

  • Press the Save... button to open the save command dialog box
  • Type Commander X16 Emulator in the Name box
  • Check the ALT box
  • Select X from the drop down that says None by default
  • Press OK to return to the Run dialog box
  • Press the Run button

From now on you can run your program by simply pressing ALT+X in Notepad++.

npp-x16emu.thumb.png.e319814231b7e7590ddec83ab03f870a.png

I attached a screenshot of the settings used to make Notepad++ look similar to the X16's BASIC interpreter. The settings are in Settings > Style Configurator...

One important thing to note is that Notepad++ can't handle special character commands in strings for use with the PRINT statement, such as changing the color of the font, etc. Lower case letters will print their associated "shifted" PETSCII characters, but I don't think the Commodore key based characters can be done in Notepad++ (or any other ASCII/ISO based text editor). Perhaps someone else could tell us!

Edited by Tatwi
seems I forgot the copy in copy and paste
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 0

Welcome to the X16 and I myself have spent quite a lot of time working on squeezing much out of the BASIC and I am very impressed with capabilities Commander X16 offers without having to resort to Assembly.

I wrote number of tutorials and games written in BASIC and those might be good way for you to start, copy & paste some snippets or whole programs, experiment and post your progress. This community is great and very helpful if one gets stuck.

Link to the blog (Under BASIC tab):

https://www.8bitcoding.com/p/commander-x16.html

And on this forum:

 

I personally write most of BASIC programs right inside Emulator just occasionally copy source code to Visual Studio Code for quick lookup or cleaning.

And most importantly, have fun!

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 0
On 11/24/2021 at 2:53 PM, Tatwi said:

One important thing to note is that Notepad++ can't handle special character commands in strings for use with the PRINT statement, such as changing the color of the font, etc. Lower case letters will print their associated "shifted" PETSCII characters, but I don't think the Commodore key based characters can be done in Notepad++ (or any other ASCII/ISO based text editor). Perhaps someone else could tell us!

Hi

I am not 100% either, but I have a tip that can be done instead.

use PRINT CHR$( <code> ) instead.

 

Example:

10 PRINT "HELLO"
20 PRINT CHR$(147) 
30 PRINT CHR$(18) ; "HELLO" ; CHR$(146)

LINE 20 prints the code for clearing screen

LINE 30 prints the code for Reverse ON and Reverse Off, to get inverted "Hello world"


Petscii tables with control characters can be found online, like: https://sta.c64.org/cbm64pet.html

 

Edited by CursorKeys
Link to comment
Share on other sites

  • 0
On 11/28/2021 at 3:52 AM, CursorKeys said:

Hi

I am not 100% either, but I have a tip that can be done instead.

use PRINT CHR$( <code> ) instead.

Example:

10 PRINT "HELLO"
20 PRINT CHR$(147) 
30 PRINT CHR$(18) ; "HELLO" ; CHR$(146)

LINE 20 prints the code for clearing screen

LINE 30 prints the code for Reverse ON and Reverse Off, to get inverted "Hello world"

Petscii tables with control characters can be found online, like: https://sta.c64.org/cbm64pet.html

Don't forget that you can use the COLOR command to control foreground and background text colors, too. It's a bit more versatile than reverse video.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use