Connecting to an emulated serial terminal with MAME
When using MAME to emulate an old computer system, you might want to connect to the emulated serial port. A lot of the advice online is good, but relies on using PuTTY. I ended up being able to use telnet on my Mac.
First, start the server:
% ./mame rc2014bp5 -bus:1 micro -bus:1:micro:rs232 null_modem -bitb socket.localhost:1234
As explained in the above linked article, this command line tells MAME to emulate a 5-slot RC2014 with an RC2014 Micro card in the first slot. It then configures the imaginary RS232 port for null modem and connects it using the bit banging device (bitb) to port 1234.
MAME will complain about Unable to load image 'socket.localhost:1234': Connection refused (generic:61). Ignore it.
Then pick it up on the other end:
% telnet localhost 1234
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Z80 BASIC Ver 4.7b
Copyright (C) 1978 by Microsoft
32382 Bytes free
Ok
10 print "hello"
10 print "hello"
20 goto 10
20 goto 10
list
list
10 PRINT "hello"
20 GOTO 10
Ok
I don’t know yet why it’s repeating every line I type, but at the very least this is a working emulated RC2014!
I am actually planning on using this functionality for something completely different (legacy computer to TCP gateway,) but this was a good way to check that MAME was working at all.