by Steven B. Combs, Ph.D. tags: mega65 - nexys4 - pga
The MEGA65 is AVAILABLE! That was the virtual shout during early October 2021. The first 400, of which I snagged one, will ship late December, while another batch of 1000 will ship during Q2 of next year. As of this writing, there are a few available. At around $850 USD, these pre-orders may be out of reach of some early adopters. If that’s the case, there are two ways you can begin your MEGA65 journey while production increases and costs decrease during the next couple of years.
The first option I’ve covered; Run a MEGA65 on your Mac using Xemu (or Linux/PC). This software solution has the advantage of being a free solution and I recommend it for anyone curious about the MEGA65 project. It is a great way to get started; however, if you want to build a hardware solution that costs less than a Dev Kit or original release models, you can purchase a Nexys A7-100T FPGA Trainer Board for ≈$270; or less if you are a student or educator. Once you have this FPGA training board in hand, what’s next? I’ll cover that in this post and show you how to configure and use the board as a MEGA65.
Before you read the rest of this post, look at my companion video below.
** Table of Contents **
In the video below, I show the process to install and use a MEGA65 bitstream on a Digilent Nexys4 FPGA.
Read the blog post below for detailed information.
None as of 2021-11-09.
Below are the links I mention in the video. All Amazon links are affiliate links.
The MEGA65 Developer Guide is part of a series of MEGA65 user guides. With a focus on the tools and techniques programmers need to develop MEGA65 software, Chapter 16 includes instructions to build a MEGA65 using a Nexys Field Programmable Gate Array (FPGA). Prior to the MEGA65 Dev Kit and the MEGA65, bitstream development occurred on FPGA boards. These boards share a Xilinx™ Artix A7 found in the Dev Kit and the MEGA65.
Because of the similarities, bitstream releases are concurrent with the Dev Kit and the MEGA65. You can purchase a Nexys, load a bitstream and files on a SD card, and build your own MEGA65; albeit without a case, floppy drive, and ports. There are other limitations, but if you want a hardware device to play on while you wait for your MEGA65 to arrive, this is an option. Let’s build a MEGA65 by selecting an appropriate FPGA board.
This blog post has significant detail. Below are the summarized steps to the process:
⌥(ALT) key on the keyboard until the MEGA65 Utility Menu Displays.
.ROMfile (rename the file
MEGA65.ROM), SD Card Essentials (extract the
.rarfile), and the
BASIC.D81file from the FileHost.
Those steps outline a high-level summary. Below are the details.
There are three Nexys FPGA boards that support the MEGA65 bitstream (more on bitstreams later):
I’ll demonstrate install on the Nexys4 that I was able to buy from Digilent for ≈$200. Setup for all three versions is identical.
The Nexys4 comes in a plastic case similar to a DVD case but thicker. The case includes the Nexys4 and a micro USB cable. It does not include instructions. Those are available online as I discuss in the section below.
Before using the MEGA65 bitstream on the Nexys4, it is important to understand the input/output (I/O) features of the hardware necessary for this project. These components are as shown in the image below.
I will not cover every hardware feature. See the Nexys A7 Reference Manual, which I used as a reference.
The micro USB port provides two functions: power and a serial connection. This project will use the micro USB port to provide power to the Nexys4 since I don’t have an external power supply. I won’t cover the serial connection; however, this port can connect the Nexys4 to a Mac or PC using M65 Connect or the MEGA65 command-line tools to manage and control the MEGA65.
You can provide power to the board using a micro USB port, a barrel jack, or a battery:
I used the micro USB port with a Kano Kit wall wart. The specifications are below:
Jumper JP3 selects USB as the power source as shown below:
The Nexys4 includes a slide switches, a USB port for HID keyboard/mouse devices, VGA for video out, and a 3.5mm jack for audio.
This project does not require the use of slide switches at the bottom of the board; however, ensure all switches are in the down position, or away from the LED display as shown in the image below:
Finding a USB keyboard that works with the Nexys4 is the hardest part of this project. While researching this project on the MEGA65 Discord, the recommendation was to use the “cheapest,” “dirtiest,” “nastiest” Dell keyboard I could find. Mechanical keyboards do not work, nor do keyboards with track pads or USB hub ports. The following keyboards did NOT work:
My penchant for mechanical keyboards was a detriment to this project. Searching through a recycle bin, I found two Dell keyboards:
The Dell L100, shown below, worked while the KB216t provided the same non-working result of the previous six make and models.
NOTE: Discord user Lydon is asking everyone to share the keyboards that work, or don’t, to compile a list. The process is simple, but you will need a *NIX OS and use the
lsusbcommand. Lydon describes the process in his post.
A VGA port provides video out. You can connect this port to a VGA monitor or a capture device. I used a Black Magic Design ATEM Mini with VGA to HDMI adapter to capture video for the companion blog post as shown in the image below:
A 3.5 mm audio jack provides audio out. This can be a headphone, powered speaker, or capture device. I can use either the ATEM mini or my VGA to HDMI adapter to capture the audio.
Before installation of the MEGA65 bitstream, test the board to make sure it is operational. To use the on-board Nexys4 self-test, and with the Nexys4 off, move the pin on the external configuration jumper (SD/USB) to USB as shown in the image below:
Turn on the Nexys4 and the self-test will display as shown in the image below:
The reference manual lists the self-test functions below:
With operational hardware, the next step is to prepare a microSD that will boot the Nexys4 with the MEGA65 bitstream. The first step is to format the microSD.
Consult your OS for specific instructions, but below an outline of the process on a Mac computer.
The microSD can now ready for a bitstream file.
Copy the bitstream to the root directory of the microSD card. Ensure there are no other files on the microSD card. Later, we will format this same microSD card and add files to create a boot disk. Keep a copy of the bitstream on the computer. You will need it later.
Use the bitstream to boot the Nexys4 with the instructions below:
Turn on the Nexys4 and the MEGA65 on-boarding screen below will display. This screen verifies the MEGA65 is operational.
NOTE: If the screen below appears in a continual loop, try a different microSD.
With an operational MEGA65 Nexys4 bitstream, we can now format the micro SD Card for MEGA65 use.
Use the steps below to boot the
MEGA65 Utility Menu and format the micro SD card:
Release the ALT key when the Utility menu loads as shown below:
2on the keyboard. Type
0to select the micro SD card.
⏎to verify the format option
The microSD card has two partitions; One hidden and used by the MEGA65 to store configuration files, and another that is user accessible to store SD Card Essentials, a .ROM file, and .D81 disk images.
Move to a computer and copy the required files using the steps below:
Download the following files:
MEGA65.ROMfile to the root directory of the microSD card.
BASIC.D81file to the root directory of the microSD card.
The microSD card is now ready to use in the Nexys4.
Everything is prepared to boot the Nexys4 as a MEGA65 using the steps below:
Using the MEGA65 isn’t an intuitive experience. There are several hardware controls the new user needs to know to use the MEGA65. I’ll cover these next.
Using a PC keyboard to emulate a Commodore keyboard can be a frustrating experience. This is one reason that the Dev Kit and MEGA65 provide an exceptional user experience that recreates official 1980s computing. There is something you can do to make the experience better.
If you plan to use this setup long term. I recommend you purchase these 4Keyboard brand Commodore 64 keyboard stickers. I use them on my Combian pi/400 and they serve as a reminder of the keys needed to use colors/PETSCII or other Commodore functions not found on modern keyboards.
Below are important U.S. keyboard mappings you need to get started using the MEGA65 on the Nexys4 since the original Commodore key mappings are not the same as modern keyboard mappings:
|PC Key||MEGA65 Function|
|F1||40/80 Column Mode|
|F5||Forward a Word|
|F7||Back a Word|
|NUM Lock||Activate WASD Joystick Mode|
Useful for the MEGAPhone development, the MEGA65 bitstream includes an on-screen keyboard that is useful for the MEGA65.
Image Courtesy: MEGA65 Blog Post
The virtual keyboard will display keyboard mappings when you use a U.S. keyboard layout. There are two ways to activate the on-screen keyboard:
[ALT]key and turn on the power or press the PROG micro-switch on the Nexys4 board.
3when the Configuration Menu displays.
The virtual keyboard shown in the image below will display.
[MEGA]key (or Windows key on a Dell keyboard) and press
[TAB]. The Matrix Mode Debugger will appear.
Use one of the two commands below to display a semi-transparent virtual keyboard:
s ffd3615 ff+
⏎– display the keyboard at the top of the screen
s ffd3615 ff ff+
⏎– display the keyboard at the center of the screen
[TAB] to exit the Matrix Mode Debugger and you will have an overlay of the keyboard as you type, as shown in the image below:
[TAB]and type the command
s ffd3615 7f+
⏎followed by another
[TAB]. Huge thanks to Paul for this one!
The virtual keyboard, and the Matrix Mode Debugger have display issues. The screen overlaps the right and left side, as shown in the image above. Checking in with Paul again, he shared:
“Yes, this is a known problem. It was designed for 800 wide on the handheld, not 720 of the desktop.”
There are seven onboard micro-switches and we use the three shown below for the MEGA65 implementation:
We won’t use the other buttons, but will use these three to operate the MEGA65.
There is no joystick port on the Nexys4, but the bitstream provides joystick emulation via the keyboard using the steps below:
[NUM LOCK]key on the keyboard
S= ↓, and
D= →. The left shift key or
0on the num pad = fire button.
␣= fire button.
With a bitstream on the Nexys4 and an understanding of how to operate the device, watch the companion video for a demonstration of ways to use the MEGA65 to run your favorite Commodore 64 software or new MEGA65 software from the FileHost.
Help make this content better! Leave your comments, corrections, additions, and thoughts in the comments below. You can email me at firstname.lastname@example.org. Thanks for reading and, please let others know about the blog using the hashtag #retroCombs.
🕹️ retroCombs, OUT!comments powered by Disqus