How To: Create an SD Card Image

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.
mortarm
Posts: 299
Joined: Tue May 16, 2023 6:21 pm

Re: How To: Create an SD Card Image

Post by mortarm »

Gerry wrote: Wed May 15, 2024 6:05 pm I don't want to burn you out asking a thousand minor questions
Yeah, somebody already beat you to that job. ;)
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: How To: Create an SD Card Image

Post by Gerry »

Good afternoon, I'm still struggling with running an SDcard image on the X16 emulator. Right now I'm trying to run it under Windows 11 but I get errors. I've included an attachment of the image of the error message I'm getting but it's not very descriptive. When I catalog (F7) from the emulator, I'm in some weird windows directory, not the root directory of the sdcard image (which is empty). The SDcard.img file is in the same directory as X16emu.exe and this is version 47. Since my Commander X16 board was shipped with a blank SD card, I've been struggling to make this work. Does it make any difference that this SDcard.img is the blank image from the x16emu zip file? Also the img file is encoded so I can't see the files through Window's File Explorer.

I found the X16 Emulator read me file (x16-emulator/README.md) but it didn't help much Too little information. Once I get this working, I want to build an sdcard.img for both my Windows and Mac PCs (WITH FILES) so I can experiment with DOS commands more. I come from the Apple II world so a lot of these DOS management commands are confusing and I'm trying to understand how things work in this environment. So far, I'm not having not much luck and I'm getting frustrated with great instructions posted here or in documentation but they don't work for me.

What I really need is an explanation of how to access the FAT32 files on the SDcard in the emulator and how the -sdcard and -fsroot switches differ with examples, if possible. Since there's no easy way to make an img file (at least that I understand), my preference is to have my data and program files directly copyable between the PC and SD card.

Thank you for your help,
Gerry
Attachments
SDCardImage.jpg
SDCardImage.jpg (66.19 KiB) Viewed 1987 times
TomXP411
Posts: 1783
Joined: Tue May 19, 2020 8:49 pm

Re: How To: Create an SD Card Image

Post by TomXP411 »

you're having trouble because your default directory is C:\windows\desktop. The path to sdcard.img is relative to your current directory, not the directory where the emulator lives.


Try
C: CD \Commander_X16\Emulation x16emu.exe -sdcard sdcard.img
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: How To: Create an SD Card Image

Post by Gerry »

I'm sorry, I don't follow. The path to the desktop is there because I'm using a batch file on the desktop to launch the emulator. The C:\commander X16\Emulation\x16emu.exe is the full path in the batch file to start the emulator with the sdcard switch. So how do I set the default path when starting the emulator from a batch file?

----------------------

I did a search and Google told me this: When an application is started from a batch file, the default working directory is C:\Windows\System32\ .

And this: The command prompt requires the use of drive letters to assign a working directory, which makes running complex batch files stored on a server UNC share more difficult. While a batch file can be run from a UNC file path, the working directory default is C:\Windows\System32\.

----------------------

I'm going to experiment with your explanation to better understand how this works. I don't normally use the command line and the last time I studied command lines was when I was learning MSDOS commands. So if you can further clarify your explanation I would (and many others) appreciate it. I know I look like a noob but I'm sure I'm not alone in trying to understand using a batch file to start the emulator. Honestly, I'm lazy and don't want to have to manually type in all the command switches every time I want to run the emulator.

Thank you and I appreciate your patience,
Gerry
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: How To: Create an SD Card Image

Post by Gerry »

After a little searching, I modified my batch file:

cd "C:\Commander_X16\Emulation"

x16emu.exe -sdcard sdcard.img

It worked so thank you TomXP411. I've included a screen grab. My next step is to figure out how to do the same thing in the MacOS.

Thanks again,
Gerry
Attachments
SDcardimage2.jpg
SDcardimage2.jpg (77.55 KiB) Viewed 1889 times
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: How To: Create an SD Card Image

Post by Gerry »

Quick question: Obviously, the X16 firmware knows how to 'decode' an .img file as shown in my previous posting. Does the X16 firmware also know how to make a .img file from a regular subdirectory?

Thank you,
Gerry
TomXP411
Posts: 1783
Joined: Tue May 19, 2020 8:49 pm

Re: How To: Create an SD Card Image

Post by TomXP411 »

Gerry wrote: Tue Jun 25, 2024 6:20 pm Quick question: Obviously, the X16 firmware knows how to 'decode' an .img file as shown in my previous posting. Does the X16 firmware also know how to make a .img file from a regular subdirectory?

Thank you,
Gerry
No, because if it did, we would have told you to do it that way.

And honestly, there's no reason to use the SD Card emulation at this point. That was developed back before MooingLemur did so much work to implement all the CMDR-DOS commands in the emulator, so the emulator's file I/O is virtually identical to the SD Card file I/O at this point. There are some small differences, but the differences don't affect any of the documented file I/O commands.

Some people use the SD card image for performance testing, but even that isn't really a valid test, because the emulator is not an SD card, and the performance is still going to be a little bit different than hardware.
TomXP411
Posts: 1783
Joined: Tue May 19, 2020 8:49 pm

Re: How To: Create an SD Card Image

Post by TomXP411 »

Gerry wrote: Tue Jun 25, 2024 6:06 pm After a little searching, I modified my batch file:

cd "C:\Commander_X16\Emulation"

x16emu.exe -sdcard sdcard.img

It worked so thank you TomXP411. I've included a screen grab. My next step is to figure out how to do the same thing in the MacOS.
It's virtually the same, except with slash (/) instead of backslash (\), depending on where you placed the emulator.

My linux script to boot the emu looks something like

cd ~/cx16/emulator/ ./x16emu.exe -fsroot ../fsroot

Based on your setup, you might do something like
cd ~/Commander_X16/Emulation ./x16emu.exe -sdcard sdcard.img
Gerry
Posts: 39
Joined: Sat Feb 17, 2024 8:54 am
Location: Dallas, Tx.

Re: How To: Create an SD Card Image

Post by Gerry »

Yet another question. I've been looking into .img files and according to WinZip they do support this extension but only if it's a full disk image. I've included a screen capture from Corel's website. I also found: ImgBurn still works in Windows 11 - https://www.imgburn.com/. Any feedback as to the best choice? I'm not sure if these programs that support .IMG files are compatible with the with the .IMG files used in the X16.

Thank you,
Gerry
Attachments
WinZip.jpg
WinZip.jpg (73.88 KiB) Viewed 1850 times
TomXP411
Posts: 1783
Joined: Tue May 19, 2020 8:49 pm

Re: How To: Create an SD Card Image

Post by TomXP411 »

The disk image format used by the emulator is just a sector-by-sector recording of the disk, with no metadata. If you have a Windows system, you can use a VHD file as an image file, and you don't need (and should not use) external tools.

While the VHD format does have metadata, the metadata is appended to the end of the file and doesn't affect x16emu, because the emulator just ignores the data footer.

Since VHDs have been proven to work, I strongly recommend using tools that can create and manipulate vanilla VHD files, exactly as described in the original post.

And, again, I do not recommend the use of image files (or VHD files) with the current version of the emulator, because you don't need special tools to work with HostFS, and you can just pop your X16's SD card directly into your PC to run programs on the emulator.

And if you're distributing files for the X16, please do not upload img files. Use Zip files with all the contents contained directly inside the zip.
Post Reply