Page 1 of 1

Loading a .bas or .bas.txt file

Posted: Sat Feb 03, 2024 10:40 pm
by FuzzySilk
Hi. I did a search so if this is listed somewhere forgive me, I could not find it. I’m trying to load a .bas.txt file and it goes through the motions and says ready but everything is locked up. I’ve tried on files that are on the sd card, files I’ve put on there. Nothing works. I have no problem loading the .prg files for the programs. There has to be a way to load .bas files so you can work on them on the machine.

LOAD “FILENAME.BAS.TXT”,8

I was able to write a Hello World program and Save it and the Load that but I can’t get any other basic text file to load, it just hangs. Any help is appreciated. Thanks.

Re: Loading a .bas or .bas.txt file

Posted: Sun Feb 04, 2024 9:01 am
by TomXP411
You have to play some tricks to get ASCII text files to load in the emulator.

The simple way to do it is to open your text file in an editor, like Notepad++, and copy the whole document to the clipboard.

Then on the emulator, clear the screen and make sure the cursor is on the top line, then press Control+V. Release the Control key quickly, before the screen starts scrolling.

That's useful for loading small programs. For larger programs, you'll want to use the -bas command line option in the emulator.

Instead of starting the emulator by double-clicking it, open a command window and run the emulator with

x16emu -bas filename.bas

This will automatically "type in" the program to the emulator. Then you can just save the program normally with
SAVE "FILENAME"

Re: Loading a .bas or .bas.txt file

Posted: Sun Feb 04, 2024 1:42 pm
by FuzzySilk
Thanks for the info. I’ll give that a try on the emulator but what about the actual hard ware? How do I pull it up, I can’t do the x16emu -bas filename.bas there.

Re: Loading a .bas or .bas.txt file

Posted: Sun Feb 04, 2024 10:46 pm
by TomXP411
FuzzySilk wrote: Sun Feb 04, 2024 1:42 pm Thanks for the info. I’ll give that a try on the emulator but what about the actual hard ware? How do I pull it up, I can’t do the x16emu -bas filename.bas there.
The simple way is to use the emulator and save the PRG to your SD card.

However, there is a trick using BLOAD and the new EXEC command:
10 BLOAD "FILE.BAS", 8, 1, $A000 20 POKE PEEK(781) + 256 * PEEK(782), 0 30 EXEC $A000, 1 40 NEW
Change FILE.BAS to the name of your ASCII file, then run this command
EXEC executes a line of text as if it was BASIC code, making it straightforward to convert ASCII text to BASIC code.

Do not forget to save this program first, since NEW clears the program out before tokenizing the new file.

Re: Loading a .bas or .bas.txt file

Posted: Wed Feb 07, 2024 12:00 am
by FuzzySilk
TomXP411 wrote: Sun Feb 04, 2024 10:46 pm
FuzzySilk wrote: Sun Feb 04, 2024 1:42 pm Thanks for the info. I’ll give that a try on the emulator but what about the actual hard ware? How do I pull it up, I can’t do the x16emu -bas filename.bas there.
The simple way is to use the emulator and save the PRG to your SD card.

However, there is a trick using BLOAD and the new EXEC command:
10 BLOAD "FILE.BAS", 8, 1, $A000 20 POKE PEEK(781) + 256 * PEEK(782), 0 30 EXEC $A000, 1 40 NEW
Change FILE.BAS to the name of your ASCII file, then run this command
EXEC executes a line of text as if it was BASIC code, making it straightforward to convert ASCII text to BASIC code.

Do not forget to save this program first, since NEW clears the program out before tokenizing the new file.
Thanks I’ll give this a try.