Skip to content

Using cassettes under Mame

Brandon Blodget edited this page Aug 23, 2017 · 1 revision

The coco2 emulated under mame is able to read and write to cassette tape. Mame uses the "wav" format to store cassette data. On the command line you can specify a cassette to load via

mame64 coco2 -skip_gameinfo -window -cass $CASS_DIR/bb.wav

If you don't have an already existing "wav" file you can start mame without specifying the -cass option and use the mame menu to create a new cassette. I do this my starting coco2 under mame and pressing "Insert" to switch to PARTIAL emulation mode then press "Tab" to bring up the mame menu. Then File Manager -> cassette -> create -> New Image Name. Using the extention "wav" when naming your cassette file.

Once you have a cassette file specified you can use the "Tape Control" mame menu to control play, record, rewind, fast forward, of the virtual tape recorder. The tape recorder must be playing before loading a file. It must be in record mode before saving a file.

NOTE: mame does not actually save the wave file until you exit mame. You need to exit mame gracefully in order for the cassette WAV file to be saved.

Basic commands for saving and loading files are:

SKIPF "HELLO"     # skip until you find
CLOAD "HELLO"     # load basic program
CSAVE "PROG2"     # save basic program

CLOADM "GAME"     # load machine code program
EXEC              # start it running

ColorForth commands for loading and saving blocks from cassette are:

READ     (n1 -- )    # Read n1 block
READS    (n1/n2 -- ) # Read blocks n1-n2
WRITE    (n1 -- )    # Write block n1
WRITES   (n1/n2 -- ) # Write blocks n1-n2
CLOADS   (n1 -- )    # Reads n1 screens, then loads them

Reduce WAV files size

Mame save the WAV file using the following settings:

Channels       : 1
Sample Rate    : 44100
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

This can result in large WAV files. You can reduce the WAV file size using the unix program "sox".

# print info about the file
soxi bb.wav

# Decrease sampling rate to 9600
# And guard against clipping
# Reduce bits to 8.
sox bb.wav -G -r 9600 -b 8 bb_lowsr.wav

This result in about a 10x smaller file that still works with mame. Here is the info about the resulting file:

Channels       : 1
Sample Rate    : 9600
Precision      : 8-bit
Sample Encoding: 8-bit Signed Integer PCM

The smaller WAV works for reading data but if you save new data on the save cassette then it saves the new data using the higher bit and sampling rate.

Resources

coco2 manual

ColorForth Manual

Clone this wiki locally