Warning: there may be occasional oddness due to css and blog edits. **KNOWN ISSUE: possible hidden text**

Sunday, March 29, 2026

Apple IIgs on FreeBSD

I was trying to do something with retroarch, installed a whole pile of stuff for it, and then wasn't sure how to proceed, and what little I tried failed.  I am not sure how but I ended up looking into mame and eventually discovered that I could possibly run Apple IIgs software through it.

It took me a lot of trial and error, succeeding to get an emulated Apple IIgs to start, which then failed with a check boot device error, a blue screen with an apple moving from left to right to left.  It took time to understand the mame user interface, and to find an image of a bootable harddrive.  I remembered having a Vulcan hard drive, so I went for that and located the correct file to add that hardware.  Try as I may, I couldn't succeed to boot it.

I found a mame wiki that told me that some hard drive images have the wrong format and file extension and how to adjust one to another.  This is where a possibly quick solution with a little utility turned into an all night process.

chdman createhd -c none -i .[po|hdv] -o .chd -f

In order to obtain chdman I had to rebuild mame with the tools option ticked.  Among all the things this needed as dependencies was rust, and so I tried to install it via pkg.  I realize now that maybe after installing a version of rust with pkg I should have cleaned up the build, maybe I did, but I think I did not.  When I resumed the build, it insisted upon building a newer version of rust, and this takes a very very long time to accomplish.

There are a lot of forum discussions and other random sites that are for mame or that supply files.  After spending so much time trying to get a hard drive image to function, I found a reddit post that told me that one specific hard drive device which I can configure in the slots mame ui option is perhaps the only type which would function (CFFA2).

Once the fresh install of mame with the tools option ticked (the default pkg version does not include this) was built, I could finally adjust one of the hard drive images so that it would work.  I was subsequently able to use a hard drive image, chosen with the file mame ui option, and it booted up nicely.  My next desire was to update the image from using System software 6.0.1 to 6.0.4, so I obtained the disk images and tried.  There was not enough space on the hard drive (32MB) with everything else that was there, for me to update.

I tried using two different hard drive image files at the same time, which could have worked?  Instead I chose to attempt to create a fresh hard drive image.  I was able to look at the hard drive image file I was already using and saw it had details within it, CYLS:257,HEADS:5,SECS:51,BPS:512 which was a good start.  I wanted to have a good size hard drive and remembered that my Vulcan was 100MB which was plenty large enough for my needs in those olden days.

I found a forum post and chose the 100MB one in the list given.

MODEL...........SIZE......CYL.....HDS.......SECT..........LZONE
CP3104..........100 MB....1547....4.........33............1547

The process for creating the new drive was easy and worked although I was very dubious that it was successful regardless of what it told me.

tigersharke@ichigo:~/.mame % chdman createhd -c none -o new_hdd.hdv -chs 1547,4,33 -ss 512
chdman - MAME Compressed Hunks of Data (CHD) manager 0.286 (unknown)
Output CHD:   new_hdd.hdv
Compression:  none
Cylinders:    1547
Heads:        4
Sectors:      33
Bytes/sector: 512
Sectors/hunk: 8
Logical size: 104,552,448

I believed that the drive needed to be a specific format so I converted it but it complained about sector size and failed.

tigersharke@ichigo:~/.mame % chdman createhd -c none -i new_hdd.hdv -o new_hdd.chd -f
chdman - MAME Compressed Hunks of Data (CHD) manager 0.286 (unknown)
Data size 102,278 is not divisible by sector size 512
Fatal error occurred: 1

Because this didn't act right I used a disk geometry calculator online to get a size I liked by providing the cyllinders, heads, sectors, and bytes per sector.  Manipulating the values until I found a set of values that gave a precise 120MB size.

MODEL...........SIZE......CYL.....HDS.......SECT..........LZONE
CP3104..........100 MB....1547....4.........33............1547
                120       1536    5         32  BPS:512

Using the tool again to create another hard drive with these new values worked fine but once more the sector not divisible error happened when I tried to convert it.

 tigersharke@ichigo:~/.mame %  chdman createhd -c none -o new_hdd.hdv -chs 1536,5,32 -ss 512
chdman - MAME Compressed Hunks of Data (CHD) manager 0.286 (unknown)
Output CHD:   new_hdd.hdv
Compression:  none
Cylinders:    1536
Heads:        5
Sectors:      32
Bytes/sector: 512
Sectors/hunk: 8
Logical size: 125,829,120
tigersharke@ichigo:~/.mame % chdman createhd -c none -i new_hdd.hdv -o new_hdd.chd -f
chdman - MAME Compressed Hunks of Data (CHD) manager 0.286 (unknown)
Data size 123,054 is not divisible by sector size 512
Fatal error occurred: 1

I had the size I wanted but it couldn't be converted as I wanted, as I thought it needed to be.  So I kind of gave up and I remade the hard drive image without any other adjustment but the file name and assumed (and hoped) it would work anyway.

tigersharke@ichigo:~/.mame % chdman createhd -c none -o new_hdd.chd -chs 1536,5,32 -ss 512
chdman - MAME Compressed Hunks of Data (CHD) manager 0.286 (unknown)
Output CHD:   new_hdd.chd
Compression:  none
Cylinders:    1536
Heads:        5
Sectors:      32
Bytes/sector: 512
Sectors/hunk: 8
Logical size: 125,829,120
tigersharke@ichigo:~/.mame % cp new_hdd.chd software

The hard drive device allows for two images to be used, so I attached the one with system software in the first place and the new fresh virtual hard drive in the second place.  Somewhat surprising to me, this new virtual hard drive did function, and booting the old image with the system software proved it though right after booting it needed to initialize four hard drives.  I didn't know, could not be sure this was right, so I cancelled each request but then shortly after restarted the machine in mame to do the initializations.

Now that everything is finally working, I have a long process of transferring as many games as I can find onto the hard drive.  I use the updated System 6.0.4 image and one I created that is supposed to be 120MB.  The hard drive I made had to be initialized as three 32MB drives and one 24MB drive, and all totals to 120MB as expected, calculating this helped me decide.  This was easier with the real Vulcan hard drive back in 1989 or something, I named the seperate drives Spock, Sybok, Sarek, and Amanda, probably 25MB each.  Today its just HD2a, HD2b, HD2c, and HD2d.  I am not sure if I will change those.  The boot drive had to keep its name (GSHardDrive) because things installed on it expect that name, and failed to find them when I did try to change it.

When I use mame for the Apple IIgs, I invoke it with mame so as to tell it all the hardware it needs for starting and eventually my games and other software I installed.

mame apple2gs -sl7 "cffa2" -hard1 "software/my_appleIIgs-hdd.chd" -hard2 "software/my_IIgs-hdd-120mb.chd"

The one challenge with using mame, is that the mouse is captured once the emulation begins, and there does not seem to be a way to just temporarily give host control, maybe only solution is to do a saved state and exit.  I need to remember to avoid hitting F3 because that causes the Apple IIgs emulation to have an odd crash.

After looking into the mame general settings > input assignments > user interface, I see that actually the toggle for mouse capture (ui release pointer) defaults to "right alt + right ctrl".  I also see that F3 is involved in both reset and soft reset.  I am not sure how to exclude a key the way F3 (soft reset) is defined as "F3 not left shift not right shift" but pressing delete clears and then delete again restores the default.

I tried to use the "right alt + right ctrl" to release the pointer but this does not seem to work as I believed.  However, I discovered that if I press scrolllock and then escape, as though I were to exit the emulation to shut it down, while the quit prompt is shown, I can move my mouse outside of the mame window.  This does not need the ui release pointer functionality to succeed, so this is how I will solve that issue.

It is preferable to me for the mame window not to be maximized, so that I can resize the containing window to a proportion that looks better since I am on a 4k monitor.  The mame window can be resized if I avoid placing the mouse inside the borders right after I startup mame whether I set for apple2gs with hard drives as I did above or not.  I can certainly resize or move the window if I do an aborted quit using scrolllock then escape.

It is definitely nice to be able to re-live or reminisce about that old computer by using mame.  There may be other methods or other tools which could make this process easier or different.  We have mame on FreeBSD and it works, though it seems finicky or may be a little tricky to get going for any certain hardware, research and persistence will win out.

It works for apple2gs for me now, and as I said earlier, I have a lot of file transfers to do.  Of course I could use the virtual disks but this means virtually inserting them each time instead of clicking an icon from the harddrive.  There are also quite a few Apple II games that I enjoyed in my earliest days, playing cracked versions on school computers, sometimes when the teacher was away.  All of those should be just as accessible and I could use Apple IIe emulation with mame on FreeBSD to play them.

Frequently viewed this week