Page 1 of 1

Testing serial port code on a Mac with VICE and a local terminal

Posted: Sat Dec 16, 2017 8:54 pm
by toby405
I'm working on learning ASM serial communications and I need a convenient way to test from VICE 3.1 running in my Mac OS X Sierra environment. I came up with this method which lets programs running in VICE talk to a terminal without actually having a terminal plugged in via USB, or using VMs or whatever. Hope this helps the next person. If someone has a better way of doing it please post.

Code: Select all

brew install socat
socat -d -d pty,raw,echo=0,ispeed=1200,ospeed=1200 pty,raw,echo=0,ispeed=1200,ospeed=1200
This will create two serial ports "back to back" so you can attach a terminal to one (or whatever you need to connect to) and VICE to the other and they can communicate using VICE's support for the userport RS232 interface. Use the port names created by socat in the next commands.

The built-in screen command provides an easy way to open a serial terminal on the Mac:

Code: Select all

screen /dev/ttys009 1200
Then start VICE on the other port:

Code: Select all

xvic -rsdev1 /dev/ttys010 -rsuser -rsuserbaud 1200 -rsuserdev 0
This will send text to the terminal created by the screen command:

Code: Select all

10 OPEN2,2,3,CHR$(8)
20 PRINT#2,"HELLO FROM VIC20"
Any text typed into the terminal can then be read from the serial port in VICE. When you're finished, if you aren't familiar with screen, use Ctrl-A :quit to get out of it.

Re: Testing serial port code on a Mac with VICE and a local terminal

Posted: Thu Apr 26, 2018 5:58 pm
by trevoz
Excellent! Thanks for sharing - I had been wondering how I'd do this on my 2012 Mac Mini.