Wednesday, September 10, 2014

Remotely view and interact (awkwardly) with the C65GS!

[UPDATE: Fixed IP address]
[UPDATE: Keyboard input through VNC now works!  Keyboard layout is mostly positional for a MacBookPro.  F1=F1/F2, F2=F3/F4 etc, F6-F8 get some displaced keys and F9 gets RESTORE.  Hold RESTORE for about 3 seconds to reset the machine.]

A while back I mentioned that I wanted to make it possible to log in remotely and play with the C65GS.  My reasons are many, including fun your you, but also so that people can get involved in writing and testing software for the C65GS.

We are now at the first mile-stone for this. It is all a bit rough still, but if you are keen, you can now interact with my C65GS when it is plugged into the internet, typically night time my time.

I have pulled together all the pieces so that you can minimally interact with the C65GS.  VNC is used to view the screen, and there is a serial monitor interface that lets you poke around in memory, write to the screen, dump memory etc.  Real keyboard input through VNC is on my TODO list, but isn't there yet -- but keep trying it when you log in incase I have implemented it since your last visit. Keyboard input now works as well.

I have managed to fix a number of problems with the remote head, such that the display is fairly stable, and mostly updates accurately, albeit taking a few frames to update all rasters if there is a lot on the screen.  It is still prone to getting out of sync when there are busy lines, especially in 80 column mode or horizontal resolutions above 320 pixels.

You can see what it looks like now here, or if the C65GS happens to be plugged in and running, then you can point a VNC client to, and see it running live.  (RealVNC is an easy option for Mac and Windows, and Linux, if you don't already have a VNC client installed.  Mac's Screen Sharing VNC client does not work, however.)

The VNC display doesn't accept keyboard input, so you just get to stare at whatever I have running on it, although I intend to fix this in the near future so you can interact with the machine.

Some handy hints:
Hold F9 down for about 3 seconds to reset the machine.  It will boot to C65 mode unless you hold down the C= key (Command key if you are on a mac).
GO64 will get you from C65 mode into C64 mode.
SYS49152 in C64 mode will give you a crude menu to select a D81 disk image to mount from the SD card storage.  Saving to disk doesn't work (yet).
SYS58552 in C64 mode will take you back to C65 mode, without un-mounting the last disk image.

The serial monitor interface is also available by telnetting to port 4510.  This gives you an interactive serial console to the C65GS.

Note that multiple people can connect at the same time, and potentially type at the same time, so be careful.  Also, please keep all content G-rated, since it will be visible to anyone else connecting.  Similarly if you write stuff that becomes visible on the C65GS display via VNC, keep it G-rated there too, please.

You can then hit enter to see the current registers etc.

Type h and hit enter to get some (slightly misleading and out of date) help.

m displays 16 bytes of memory, and M displays 512 bytes of memory.  You can provide an optional 28-bit address to these commands, as they work on the entire address space.

d and D work like m and M, except that they take 16-bit addresses and show what the CPU can see at the specified addresses.

For commands that take an address, the address must IMMEDIATELY follow the letter, e.g., "d1000", not "d 1000", or else you will get a syntax error.

s sets bytes in memory using a 28-bit address, while S sets bytes in the current address space of the CPU using a 16-bit address.

f fills memory.

There are also commands to put the CPU into single step mode (t1), let the CPU run free again (t0), or display the registers after every instruction until you hit enter again (tc).  In single-step mode, hitting enter will run the next instruction, which in all likelihood will be the IRQ entry point, unless you have IRQs disabled.  I will improve this behaviour in time.


  1. Hi Paul,

    just tried, but connection times out.

    I'll try later when the C65GS is online :)

    1. Yes, sorry about that. It is only on intermittently at the moment. I hope to transition it to 24/7 operation once I compile the necessary utilities to run on the right machine. Just keep trying, and aim for night time in Australia at the moment.

    2. I guess I am bit late to check this out :( Is it expected to work now? I can get icmp echo replies (aka "ping") but for connecting it merely pass back a "no route to host" message.

    3. Hello,
      It isn't running at the moment, so you won't be able to see it. That said, I am working on a simple emulator for the MEGA65, which will make things much easier.


  2. This is a really neat feature :) Will you be leaving this facility enabled in the final product, so that end-users can also vnc into their mega65's remotely? Or are things a bit too tight for space in the fpga now and it might have to be stripped out to make space for other stuff?

    1. Indeed it is :) That said, we haven't tried using it for a while, so I can't confirm if it still works on the latest bitstreams. We may need to pull it from future builds if things get too tight, however, we are not at that point just yet.