Here is a quick tutorial on an often-asked question about the XRoar emulator:
How do you load/save a program to/from disk/tape?– Folks
Since the XRoar emulator can emulate a floppy drive, there’s no real reason to mess with virtual cassette tapes unless you just want the experience, need the extra memory (disk systems have about 2K less memory), or are using software that does not support floppy disks.
But, if you still want to save your BASIC programs to a virtual cassette, and load it back, here are the steps.
From the manual, please note:
The tape used for writing is considered separate to the read tape (this is an emulator-friendly approach to prevent overwriting your programs, though it would have been possible with two cassette decks).– https://www.6809.org.uk/xroar/doc/xroar.shtml#Cassettes
That is likely the cause of confusion for many/most/all who try to use this the first time.
To save your program to tape, you must first mount (or create new) an Output Tape:
File -> Cassette -> Output Tape…
That will pop up a file explorer, and you can browse to an existing tape image, or select a location and create a new tape like “tape.cas” (where “cas” means cassette).
Once that is there, you can save your program as normal using CSAVE (or CSAVEM for machine language):
10 PRINT "HELLO, TAPE!" 20 GOTO 10 CSAVE "HELLO"
That file is now saved to the virtual tape. On a real cassette system, you would have to rewind the tape before you can load the program back in. But, if you try to use “File -> Cassette -> Rewind Output Tape” you still won’t be able to load. That tape is output only. You would just be rewinding it so you can overwrite whatever is there if you save something new.
Instead, you mount this tape image as an Input Tape:
File -> Cassette -> Input Tape…
You then can browse and select the “tape.cas” you made earlier. Now you can load the program using CLOAD (or CLOADM for machine language) and it will be back in memory:
CLOAD "HELLO" LIST 10 PRINT "HELLO, TAPE!" 20 GOTO 10 OK
To reload, you need to to “File -> Cassette -> Rewind Input Tape”.
It appears you can have the same tape mounted for both Input and Output, but you need to re-mount the input each time you want to see the updated files on the Output tape.
In my test, I mounted an Output tape and then did a CSAVE”HELLO” of the program. After that, I mounted the tape for Input and did a CLOAD to get it back. I then did CSAVE”HELLO2″ and CSAVE”HELLO3″ to add two more copies to the Output tape.
Rewinding the Input tape did not get me those new files, but re-mounting (File -> Cassette -> Input Tape…”) and selecting the same .cas file again did let me load all three.
I’d enjoy XRoar having a “one tape” mode that worked like a real cassette deck. That would probably be much easier for folks to start using.
Here’s a quick video showing the basic process:
XRoar handles floppy disks more like real hardware, but as of version 1.2, it still defaults to having disk images being temporary. If you mount and use a disk image, when you shut down, all your changes are lost. It was intended for casual users who would be mounting disks and running programs, as opposed to folks programming and saving new data. A menu option (or entry in the xroar.conf config file) changes disks images to “write back” and work like normal.
Here are the steps:
First, you need an existing disk image, or you can create one:
File -> Drive 1 -> New Disk…
Browse to where you want the new disk image to be saved, and give it a name like “mydisk.dsk”
Drive 1 (which is 0 to DISK BASIC) is now ready, but just like a real floppy, you must format it before you can use it. Use the disk initialize command to do this:
You should now be able to type “DIR” and see an empty disk. BUT, if you save things to it, those changes will be lost (or maybe not even be able to save, if the disk is write protected and gives you a ?WP ERROR just like a real disk did when you taped over the write protect notch).
Turn on “Write Enable” to make the disk NOT write protected, and turn on “Write Back” to ensure anything you write will actually go back on the disk and not be discarded on exit:
Now you can save and load programs as normal:
10 PRINT "HELLO, DISK!" 20 GOTO 10 SAVE "HELLO" DIR HELLO BAS 0 B 1 OK
As long as Write Enable is checked, the disk won’t be write protected. As long as Write Back is checked, your changes should save when you exit XRoar (or eject the disk).
The next time you startup XRoar, you can use the Ctrl-1 shortcut to mount Drive 1, and just browse to your “mydisk.dsk” image and start using it.
You will still need to check Write Back every time, unless you add that to your xroar.conf config file. You can set that up so it automatically mounts disk images, tape files, etc. as well as setting default machine, memory size, TV mode (simulated, RGB monitor, etc.)
But that’s a topic for another article.
Here is a quick video showing the disk steps:
Until next time…