Creating disk image for the emulator

May 22, 2019
486
250
43
Kari-Gunnar Hultland over on Facebook asked how to create an image file for the emulator.

Here is how to create one on Windows. This will create a disk image that you can then use in the emulator as if it was an SD card.

  • Start Disk Management (Right-Click Start Menu, click Disk Management)
  • Pull down Actions and select Create VHD
  • You'll see a bunch of options in there
    • Enter whatever path and filename you want
    • Select a size of at least 1GB. (If it's too small, you can't use FAT32)
    • Select Fixed Size
  • This will mount the disk image and create a new block in the list at the bottom of the window (probably called Disk 1).
  • Right click Disk 1 in the left column and choose Initialize
  • Select MBR.
  • This should then make the right side say "999 MB/Unallocated"
  • Right click on the right side and select New Simple Volume
    • Tell it to use the full size, click Next
    • Assign a drive letter, click Next
    • Select FAT32 for the file system, Click next
  • Now you should have a new drive letter D: or E:.
  • Open File Explorer and copy something over to this new drive letter. It doesn't matter what.
  • Unmount the drive by going to the list of drives in File Explorer, right-clicking the drive letter icon, and clicking Eject
  • You should now be able to use the -sdcard switch to launch the emulator with the VHD File.
x16emu -sdcard test.vhd

Type DOS "$" to confirm that the SD card is loaded. you should see a directory that looks like this:
1571179062291.png
 
Last edited:
May 22, 2019
486
250
43
Note that the emulator ROM does not yet write to SD, so you cannot write to the SD image. At least that's what it looks like - any attempt to save to the SD card breaks on my system. But I can read files and load programs from SD.
 
  • Like
Reactions: codewar65

codewar65

New Member
Sep 25, 2019
26
13
3
Note that the emulator ROM does not yet write to SD, so you cannot write to the SD image. At least that's what it looks like - any attempt to save to the SD card breaks on my system. But I can read files and load programs from SD.
Found this out earlier today. Using Win32DiskImager to create image that is read-only.

For now, SAVE "<filename>",1 to local filesytem (in your x16emu dir).

It's be nice to have a command line parameter to mount a local path to a drive.
 

frankbuss

New Member
Oct 16, 2019
4
1
3
I created an image in Linux, and I can mount it in Linux and read/write from it, and I can read the directory from the emulator, but I can't load any program for it. When I try to load a program, e.g. LOAD"T.PRG",8, I can see lots of "Reading LBA xxxx" messages on the terminal where I started the emulator, but it never stops loading. Does someone have a sample SD-card image which works with the X16?
 
May 22, 2019
486
250
43
Yeah, it's doing that to me now. I think the image support is still a little broken. I think we'll have to wait until that's cleaned up and full read/write support is implemented.
 

thrawn235

New Member
Oct 12, 2019
7
8
3
@frankbuss
Ive been trying to create an image in linux but the x16 emu just gave me garbage when i tried dos "$"
can you explain how you did it exactly ?
 

frankbuss

New Member
Oct 16, 2019
4
1
3
I wrote a script for it:
Bash:
#!/bin/sh

dd if=/dev/zero of=sd.img bs=1024 count=1048576
losetup -fP ./sd.img
parted -s /dev/loop0 -- mklabel msdos mkpart primary fat32 64s -1s
mkfs.fat /dev/loop0p1
mkdir sdtmp
mount /dev/loop0p1 sdtmp
cp sd/* sdtmp
sync
umount sdtmp
losetup -d /dev/loop0
rm -rf sdtmp
Has to be started as root. This creates a file sd.img of 1 GB size, with the content of all files in the sd directory. Here is the result with a sample program:

http://www.frank-buss.de/x16/sd.zip

But when trying to load it, now I get a different behavior. It says it is loading it, but looks like it didn't load anything, with R33:

sd.png
I can mount it with no problem in Linux with the loopback device and the data is there in the T.PRG file.
 

thrawn235

New Member
Oct 12, 2019
7
8
3
Thanks!
It works fine.

I do wonder what the problem was with my attempt.
Ii did almost exactly the same thing. I just used fdisk instead of parted
 

frankbuss

New Member
Oct 16, 2019
4
1
3
But only the directory loading works. I wonder what's wrong with loading the actual data.