Testing serial port code on a Mac with VICE and a local terminal
Posted: Sat Dec 16, 2017 8:54 pm
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.
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:
Then start VICE on the other port:
This will send text to the terminal created by the screen command:
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.
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
The built-in screen command provides an easy way to open a serial terminal on the Mac:
Code: Select all
screen /dev/ttys009 1200
Code: Select all
xvic -rsdev1 /dev/ttys010 -rsuser -rsuserbaud 1200 -rsuserdev 0
Code: Select all
10 OPEN2,2,3,CHR$(8)
20 PRINT#2,"HELLO FROM VIC20"