Jump to content
Sign in to follow this  
Michael Parson

New community dev tool uploaded: mkcard

Recommended Posts


View 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.


  • Like 4

Share this post

Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

Please review our Terms of Use