Using MAME to Emulate the Apple II+
The articles 6502 Cross Assembly for the Apple II using MacOS and 6502 Cross Assembly using MacOS and Atom, described, as the titles suggest, how to use a modern text emulateor, cross compiler and Apple II emulator for developing software for the Apple II using MacOS. In those articles the emulator described was the Virtual ][ emulator (http://www.virtualii.com/).
Whilst I can heartily recommend this emulator, for me at least, the inability to accurately emulate the Videx Videoterm 80 column display has been a serious problem. To get a true emulation of the Videx card, it seems the only emulator to use on MacOS is the cross platform MAME software.
MAME is quite remarkable in the number of systems it can emulate, as a result some of the concepts can take a little time to get used to, and configurations can take some time to perfect. However, for the purposes of this article and to keep things simple, I will only be looking at emulating an Apple II+.
Install SDL 2
This is a multimedia library that lets MAME display graphics, sounds and read keyboards and game controllers. The steps to follow are as follows.
- Download the SDL 2 Runtime Library for Mac OS X from https://www.libsdl.org/download-2.0.php
- Open the DMG and you should see the SDL file.
- On the Mac, open the /Library/Frameworks folder e.g.:
- Go to the Finder.
- In the menubar click Go > Go to folder...
- Type /Library/Frameworks
- Copy the SDL2 from the DMG to this folder
Install SDL MAME
Download the highest available 64 bit version of SDL MAME for OSX from http://sdlmame.lngn.net. Unzip SDL MAME into a suitable directory. The example here assumes that MAME has been expanded in the project directory. One of the files extracted is named mame64. This is the SDL MAME program.
Before running the mame64 binary, it is necessary to obtain the Apple II+ romset. This is a specific MAME romset, and for the Apple II+ it is called apple2p the Apple //e romset is called apple2e. There are others for the GS, IIc and so on. These will need to be obtained before going further. A good place to start looking is https://www.emuparadise.me.
The romset will be a zip archive file, copy this file as it is (i.e. zipped) into the roms folder within the MAME folder hierachy created when the SDL MAME download was extracted (see above).
The romset includes several peripheral card emulations including the Videx Videoterm.
The following is a command line (executed from within the 'mame' folder) that will launch mame with a Videoterm card in slot 3 and the disk TestDisk.po in floppy 1. Notice that in this case the emulation is being instructed to run at 3 times normal speed (-speed 3) and that the disk image is located in the parent directory.
./mame64 apple2p -noreadconfig -skip_gameinfo -speed 3 -window -nomax -sl3 videoterm -flop1 ../TestDisk.po
The MAME documentation (http://docs.mamedev.org) will explain the remaining switches.
Integrating MAME with the VSCode
Referring to the articles 6502 Cross Assembly for the Apple II using MacOS and 6502 Cross Assembly using MacOS and Atom, all that is required to use MAME instead of Virtual ][ in the build-test task. For example the existing line...
cd mame0195-64bit ./mame64 apple2p -noreadconfig -skip_gameinfo -verbose -uimodekey CAPSLOCK -speed 3 -window -nomax -sl3 videoterm -flop1 ../$1.po