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

You need an actual VIC.

Moderator: Moderators

User avatar
toby405
Vic 20 Amateur
Posts: 40
Joined: Fri Dec 21, 2012 8:33 pm
Location: USA

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

Postby toby405 » 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.

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.

Return to “Emulation and Cross Development”

Who is online

Users browsing this forum: No registered users and 1 guest