Good evening, I've been working on starting up the Mac X16 emulator from a shortcut on the Mac desktop and finally got it figured out. The "Take Control of the Command Line" book (part of the Take Control online series for Macs) explained how to set up and write scripts and then convert those scripts to 'command' files that can be executed from the desktop.
Anyway, I ran into an issue with the scripts I wrote to start the emulator. Once I launch the emulator from the command line, I want to load and run FM.PRG to display the directory structure and files in the SD.IMG file (duplicates "the SD card on a real X16). But to do that I have edit the AUTOBOOT.X16 file in the root directory. Now my Autoboot file has a lot non-text characters that I believe represents the screen mode and color screen values that you can save to the AutoBoot.X16. I've been reading Starvoid's document on the Autoboot file and he says the non-text bytes is a basic program in tokenized form. So, what I want to do is edit the AutoBoot.X16 file to add more configuration commands when I start (or restart) the X16.
I also have the Commander X16 board and I want to do the same thing to that AutoBoot.X16 file in the root of the SD card. The problem is when I receive my board, the SD card was blank, so I copied over the r47 .img files from the emulator. But, according to Starvoid's article, the SD cards shipped with the boards were all a little bit different.
Anyway, when trying to figure out how edit the Autoboot file, I loaded the file and listed it on the X16. I was able to add basic lines (with line numbers) at the end of the basic program in the Autoboot file but it doesn't actually work. Instead of getting FM.PRG on the screen (it's in the root directory)vIt never runs. Not sure why but it sure is weird. As a quick aside, can the AUTOBOOT.X16 have multiple basic programs in the file?
So, what program should I use to edit AUTOBOOT.X16 or is editing the basic program in the Autoboot file the best approach? Hopefully a document can be developed explaining everything in this file and how to configure and edit this file.
Thank you,
Gerry
Editing Autoboot.X16
Re: Editing Autoboot.X16
I think the r47 .img file included with the emulator is just a blank placeholder, just as a starting reference on what the .img file should look like (if I recall correctly).
Sorry your SD card came blank. Hard to say what happened there, I have seen SD cards get corrupted after shipping.
Assuming you get a copy of the FM.PRG (from forum) onto that SD card, then the steps to make an AUTOBOOT.X16 would be:
1. Boot up X16 with the SD card inserted
2. Type: NEW (optional, but just to ensure everything is cleared out)
3. Type: 10 LOAD "FM.PRG"
4. Type: LIST (optional, just to show your program is in BASIC's memory)
5. Type: SAVE "@:AUTOBOOT.X16"
[ the @: is important, changes to autoboot.x16 won't be saved if the file already exists - in this case there shouldn't be an existing file of that name initially, but pointing this out in case as you make additional changes to this file, one might try to SAVE without the @: prefix and overlook the error messaging saying the filename wasn't saved since it already exists ]
Probably it is better to avoid using the phrase of "editing the autoboot.x16" just since that quickly implies EDIT "AUTOBOOT.X16" which isn't going to work. We can alter it, adjust it, re-program it. I know that's nitpicking, but just that X16EDIT and AUTOBOOT.X16 don't mix (autoboot.x16 was "invented" long before X16EDIT; and now I've come to wonder instead of .PRG why didn't we all borrow the .X16 extension convention for tokenized-runnable programs on this platform?)
If your FM.PRG is in a sub-folder, then be aware that "wedge" commands won't work inside the autoboot.x16. Instead, you have to use the DOS keyword, like:
10 DOS"CD:APPS"
All of the above should apply to the emulator or the hardware. In the emulator, it will automatically use the CWD (current working directory) from when you launch the emulator as the file system (just run the emulator without args and use F7 to list the folder and see what files there - it should be a very familiar listing). So you can make sub-folders and copy FM.PRG into that CWD all the same.
Sorry your SD card came blank. Hard to say what happened there, I have seen SD cards get corrupted after shipping.
Assuming you get a copy of the FM.PRG (from forum) onto that SD card, then the steps to make an AUTOBOOT.X16 would be:
1. Boot up X16 with the SD card inserted
2. Type: NEW (optional, but just to ensure everything is cleared out)
3. Type: 10 LOAD "FM.PRG"
4. Type: LIST (optional, just to show your program is in BASIC's memory)
5. Type: SAVE "@:AUTOBOOT.X16"
[ the @: is important, changes to autoboot.x16 won't be saved if the file already exists - in this case there shouldn't be an existing file of that name initially, but pointing this out in case as you make additional changes to this file, one might try to SAVE without the @: prefix and overlook the error messaging saying the filename wasn't saved since it already exists ]
Probably it is better to avoid using the phrase of "editing the autoboot.x16" just since that quickly implies EDIT "AUTOBOOT.X16" which isn't going to work. We can alter it, adjust it, re-program it. I know that's nitpicking, but just that X16EDIT and AUTOBOOT.X16 don't mix (autoboot.x16 was "invented" long before X16EDIT; and now I've come to wonder instead of .PRG why didn't we all borrow the .X16 extension convention for tokenized-runnable programs on this platform?)
If your FM.PRG is in a sub-folder, then be aware that "wedge" commands won't work inside the autoboot.x16. Instead, you have to use the DOS keyword, like:
10 DOS"CD:APPS"
All of the above should apply to the emulator or the hardware. In the emulator, it will automatically use the CWD (current working directory) from when you launch the emulator as the file system (just run the emulator without args and use F7 to list the folder and see what files there - it should be a very familiar listing). So you can make sub-folders and copy FM.PRG into that CWD all the same.
Re: Editing Autoboot.X16
Thank you for your reply VoidStar, I'm sorry I reversed your handle. I ran into a major snag when figuring out how to launch the X16 emulator on the Mac and the same is true with Windows. It's about your prefix path (CWD). Originally, I was typing in the entire path to run the X16 emulator and it worked but then it couldn't find either the sdcard .img image or the fsroot sdcard_root directory. (BTW, the .img file included with the Mac emulator is populated, it's not empty. In the Windows version of the emulator, the .img file is empty.) I came to realize, with all of your help, that the CWD was pointing back at the root directory of the Mac (or C:\ drive in Windows) hard drive. To fix this I had to issue a change directory command (cd) first to set the CWD location of the emulator in the Mac terminal command file or for the windows .bat file before running the emulator. That got everything working as described in the documentation. So the CWD needs to be set before anything else is is done with the emulator.
As far as the Autoboot.X16 file goes I spent a good part of the day playing around with it to see what happens. The basic confusion I had was when I looked in that file using X16Edit, there were a screenful of non-text characters but when I loaded and listed it using DOS commands only 3 text lines showed up. So I couldn't see what was in this file. Then I noticed when I re-opened a new copy of the emulator, there was no AutoBoot.X16 file in the root directory. That means whatever I did somehow filled the Autoboot file that was in the root directory. So I deleted the AutoBoot.X16 in the root directory, copied the File Manager FM.prg from the APPS directory to the root directory (I did this to keep the CWD pointed at the root directory) and simply wrote a two line basic program:
10 load"FM.PRG
20 RUN
And it worked fine. I am so relieved that this is all making sense now. All this trial and error teaches me and I remember it.
I also want to mention that when I was hopping in and out of the included sdcard applications in subdirectories, I've been running them using the 'local' Autoboot.X16 file as it scripts how to configure the X16 before running the proper PRG file. That's what showed me how important the Autoboot.X16 file is.
Finally, I've been playing with a couple of the switches associated with the emulators. I especially like the -warp switch. Turn that on and suddenly the emulator is running much faster. I ran 8BITDANCE in the DEMO subdirectory and it was so funny to watch Adrain's image dance around the screen like a bunny. On my 11th gen i9 laptop and my m1 MBP they ran at the same speed, about 667% faster on both of them according to the window. It was funny.
Thank you for the help and I hope my sharing the issues I've gone through will help some othe newby trying to figure out how their X16 works.
Thanks again,
Gerry
As far as the Autoboot.X16 file goes I spent a good part of the day playing around with it to see what happens. The basic confusion I had was when I looked in that file using X16Edit, there were a screenful of non-text characters but when I loaded and listed it using DOS commands only 3 text lines showed up. So I couldn't see what was in this file. Then I noticed when I re-opened a new copy of the emulator, there was no AutoBoot.X16 file in the root directory. That means whatever I did somehow filled the Autoboot file that was in the root directory. So I deleted the AutoBoot.X16 in the root directory, copied the File Manager FM.prg from the APPS directory to the root directory (I did this to keep the CWD pointed at the root directory) and simply wrote a two line basic program:
10 load"FM.PRG
20 RUN
And it worked fine. I am so relieved that this is all making sense now. All this trial and error teaches me and I remember it.
I also want to mention that when I was hopping in and out of the included sdcard applications in subdirectories, I've been running them using the 'local' Autoboot.X16 file as it scripts how to configure the X16 before running the proper PRG file. That's what showed me how important the Autoboot.X16 file is.
Finally, I've been playing with a couple of the switches associated with the emulators. I especially like the -warp switch. Turn that on and suddenly the emulator is running much faster. I ran 8BITDANCE in the DEMO subdirectory and it was so funny to watch Adrain's image dance around the screen like a bunny. On my 11th gen i9 laptop and my m1 MBP they ran at the same speed, about 667% faster on both of them according to the window. It was funny.
Thank you for the help and I hope my sharing the issues I've gone through will help some othe newby trying to figure out how their X16 works.
Thanks again,
Gerry
Re: Editing Autoboot.X16
Glad you got it going!!
I didn't realize about the .img for the Mac version being different, that's curious.
I didn't realize about the .img for the Mac version being different, that's curious.
Re: Editing Autoboot.X16
Here's the answer why my modifications at the end of the basic program in AutoBoot.X16 didn't run. The last line of the original program was the basic command 'NEW'. That's used to clear working memory so it wipes out the AutoBoot.X16 program being executed from working memory. My additions after NEW are deleted and never executed.
So it was an oversight on my part and I've been duly chastised.
Gerry
So it was an oversight on my part and I've been duly chastised.
Gerry
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Editing Autoboot.X16
FWIW not directly related but seems like a good place to mention. The AUTOBOOT.X16 I wrote to display a BMX file and play a WAV on system startup. : viewtopic.php?t=7837Gerry wrote: ↑Mon Jul 22, 2024 10:38 pm Here's the answer why my modifications at the end of the basic program in AutoBoot.X16 didn't run. The last line of the original program was the basic command 'NEW'. That's used to clear working memory so it wipes out the AutoBoot.X16 program being executed from working memory. My additions after NEW are deleted and never executed.
So it was an oversight on my part and I've been duly chastised.
Gerry
I wrote this to allow "CHAINING" of AUTOBOOT's After showing the "SPLASH" screen & SOUND, it looks for first AUTOBOOT.ORG and then AUTOBOOT.OLD .. (If AUTOBOOT.ORG exists it WILL NOT get to AUTOBOOT.OLD, it's one or the other) and then loads that as an "EXECUTABLE". If neither exist it then restores the original screen mode and does BANNER then NEW