Jump to content

mkcard 1.0.2

   (0 reviews)

About This File

Someone asked for help creating new sdcard images to be used with the emulator, so I banged around in vim for a while and dug around in DDG until I found enough hints around using sfdisk and mtools to create a suitable file w/o needing any root permissions.  Due to limits of the FAT32 filesystem, the smallest image you can format with FAT32 is 32 MB.

$ mkcard -f scratch.img -s 32
Checking that no-one is using this disk right now ... OK
	Disk scratch.img: 34 MiB, 35651584 bytes, 69632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
	>>> Created a new DOS disklabel with disk identifier 0x9983f409.
scratch.img1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 33 MiB.
scratch.img2: Done.
	New situation:
Disklabel type: dos
Disk identifier: 0x9983f409
	Device       Boot Start   End Sectors Size Id Type
scratch.img1       2048 69631   67584  33M  c W95 FAT32 (LBA)
	The partition table has been altered.
Syncing disks.

You'll need the mtools and util-linux packages installed to use the script.  Unfortunately, this limits this to be only be usable by Linux users (maybe Windows 10 users with WSL as well, don't know, don't have a Win10 setup to try with), I don't see sfdisk in the macOS ported versions of util-linux packages.

To make things even easier to use these files with mtools, create a ~/.mtoolsrc file with something like:

drive s: file="~/scratch.img" exclusive partition=1
drive x: file="~/basic-progs.img"    exclusive partition=1
drive y: file="~/demos.img"    exclusive partition=1

And now you can use mcopy to copy files to your s:, x: or y: drives.  Just make sure you UPPERCASE the filenames so x16emu will display the filenames as you expect them to look.

What's New in Version 1.0.2   See changelog


1.0.1 Now prevents you from attempting to make a <32MB file, adds 32 MB as the default if not specified.
1.0.2 Checks to see if the file already exists and gives you the option to replace it or exit.





User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

  • Create New...

Important Information

Please review our Terms of Use