Using the -PRG Switch in the X16 Emulator

Tutorials and help articles.

(Posts require approval. See pinned post.)
Forum rules
Post guides, tutorials, and other instructional content here.

This topic area requires approval, so please be patient while we review content to make sure it fits the expectations for this topic area.

Tech support questions should be asked in Hardware or Software support.
Post Reply
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Using the -PRG Switch in the X16 Emulator

Post by Gerry »

Hello All, I am continuing to play-- err work with the X16 Emulators to make sure I understand them. In the X16 startup batch file, I'm using the following commands:

cd C:\Commander_X16\Emulation
x16emu.exe -fsroot sdcard_root -ram 2048 -scale 2 -widescreen -rtc

The last two lines of AutoBoot.X16 in the root directory are:
10 LOAD"FM.PRG
20 RUN

Note: FM.ORG is in the root directory.

This does exactly what I want in that the UFM program is loaded and run on startup. After reviewing the startup commands available for the X16 emulator, I ran across two switches that I'm play-- errr testing. They are the -PRG and the -RUN commands. For those of you familiar with these switches, I'm sure you already know where I'm going.

So here's the changes I made to the batch file to do the same thing without involving Autoboot.X16.

cd C:\Commander_X16\Emulation
x16emu.exe -fsroot sdcard_root -ram 2048 -scale 2 -widescreen -rtc -prg FM.PRG -RUN

I deleted the AutoBoot.X16 file in the root directory.

Now when I start up the batch file, the terminal window shows for a moment and then disappears and the X16 emulator fails to start. I moved the new switches further up in the startup string but no change. I delete the -prg switch but left the -RUN switch and the X16 emulator starts but, obviously, just has the banner and ready displayed. If I remove the -RUN switch but leave the -PRG switch in the startup string the emulator again fails to start. Could it be an issue with -PRG switch?

Okay, what am I doing wrong?

Thank you,
Gerry
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: Using the -PRG Switch in the X16 Emulator

Post by JimmyDansbo »

I am almost certain that the -prg switch expects the program to be on the host filesystem and not in the sdcard image.
If you copy FM.PRG to the directory of the emulator, I think it will work.

Unfortunately that means that you need to remember to update FM.PRG on hostfs if it is updated in the sdcard image.

Now that I write it out, it seems like a bug. I have just learned to live with it :-O Maybe someone should report it as a bug on github...
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: Using the -PRG Switch in the X16 Emulator

Post by Gerry »

I copied the FM.PRG file to the same directory as x16emu.exe and tried running the FM.PRG program from the x16emu.exe command line using the -PRG and -run switches with the same results. The terminal window popped open for a moment and then closed. It appeared to be displaying the x16emu.exe startup options while closing. So it appears to be a bug unless these switches need to placed somewhere more specific in the command line.

BTW, this is under Windows 11.

Thank you,
Gerry
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: Using the -PRG Switch in the X16 Emulator

Post by JimmyDansbo »

According to your posts, the emulator is located in:
C:\Commander_X16\Emulation

This is the directory where the FM.PRG file should reside since your batch file changes directory into there before running the emulator.
It seems that the -prg option only considers files that are in the current working directory, regardless of -sdcard or -fsroot options.

I suggest you try running your batch from a cmd window to see what kind of error message you get.
On linux, I get an error stating that the file can not be opened, if I try to open a file that is not in the directory I am currently in.
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: Using the -PRG Switch in the X16 Emulator

Post by oodler »

Idk if it matters on Windows, but the switches are lower case. Also, the PRG file needs to be in your present working directory, for example this is what I am running fine (on Mac):

Code: Select all

../x16emu_macos_intel-r47/x16emu -prg ./iso-test.prg -run -scale 2
You can see the emu exe is in another directory, but the PRG is in my present working directory.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: Using the -PRG Switch in the X16 Emulator

Post by TomXP411 »

Can't you use a fully qualified path with the -prg optin? I've never had to have the PRG in the same file when using that to auto-start a program.

Something like -prg D:\projects\myprog.prg should also work.
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: Using the -PRG Switch in the X16 Emulator

Post by Gerry »

Found the issue. Long story short, I was starting my X16emu emulator using PowerShell. My windows 11 defaults to PowerShell when writing a (D:\ drive based) batch file and it required a full path for the working directory in the D:\ drive, but not for the C:\ drive. The first thing I did in the Batch file was set the working directory (shown below) but when specifying the X16emu.exe and -prg switch path, PowerShell would not use the working path. Only when I included the full path did it work as expected. I built another batch file under the Command prompt and it worked fine with using the working path. What's interesting is that under Windows 10, building batch files defaults to the command prompt for both local drives C:\ and D:\. In my Windows 11 PC, drive C:\ uses the specified working directory in the command prompt but the D:\ drive starts up in PowerShell and requires the full path. Here's what I built under the PoweShell:

Note: There are only 3 batch commands, two change directory commands and the command to start the emulator. It's three lines long.

cd D:\
cd D:\Commander_X16\Emulator\X16emu_win64-r47
D:\Commander_X16\Emulator\X16emu_win64-r47\X16emu.exe -fsroot D:\Commander_X16\Emulator\X16emu_win64-r47\sdcard_root -ram 2048 -rtc -scale 2 -prg D:\Commander_X16\Emulator\X16emu_win-r47\sdcard_root\launcher.prg -run

I'm interested in seeing what others discover.

BUT, this raised a new issue. When launching the Launcher.prg along with starting the emulator, it works fine. But when I tried to launch Launcher.prg in my real X16 using autoboot.x16 it failed. I've included screenshots. My autoboot.x16 has two lines: 100 load"launcher.prg, 110 run (I copied launcher.prg to the root directory in the sd card. Picture IMG_2564.jpeg shows the screen after a fresh Commander X16 boot.

Any ideas why?

Thank you,
Gerry
Attachments
IMG_2567.jpeg
IMG_2567.jpeg (614.74 KiB) Viewed 1950 times
IMG_2566.jpeg
IMG_2566.jpeg (622.44 KiB) Viewed 1950 times
IMG_2565.jpeg
IMG_2565.jpeg (653.58 KiB) Viewed 1950 times
IMG_2564.jpeg
IMG_2564.jpeg (686.4 KiB) Viewed 1950 times
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: Using the -PRG Switch in the X16 Emulator

Post by Ed Minchau »

Why are the filenames listed like that? The file system doesn't do lowercase letters.
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: Using the -PRG Switch in the X16 Emulator

Post by Gerry »

That's a good point. As you can see in my previous post, the first screen cap shows all the batch commands used in the PowerShell to boot the emulator. All I'm doing is running the Launcher.prg app. So i'm assuming the lower-case file listing is built by the app. Also, checking the APP directory in SDCARD_ROOT shows only the Launcher app with no support files. So, I assume that there must be a switch to control the Launcher app. i need to find the docs for the Launcher app.

Anyone know where they are?

Gerry
Post Reply