...
Table of Contents |
---|
Introduction
The MEGA65 can use ethernet for SD card access and starting programs remotely by using the tools mega65_ftp and etherload. The tools are command-line applications, so you should be familiar with using these kinds of programs in a terminal, else you can download the GUI-tool M65Connect from Filehost. This guide also assumes that you know how to install a new core into one of the slots 1-7.
Set up
Before you start make sure:
The PC/Mac and your MEGA65 need to be connected to the same ethernet network.
IPv6 needs to be enabled on the network interface on your PC/Mac (this is default but you may have changed it)
Hardware configuration
The DIP switch #2 on your MEGA65 mainboard needs to be set to ON.
Info |
---|
This step is not necessary for MEGA65 (R6) produced in 2024 and delivered from batch #3. |
Unplug any cables attached to the MEGA65 (power, video, etc.)
Turn the MEGA65 to the back side and open the housing by removing the three lower screws:
Locate the DIP switch on the right side of the mainboard:
Use a small screwdriver or a pen to set DIP switch #2 to ON position. Be aware the DIP switch is up-side-down.
Close the housing, put back the three screws and plug all cables.
...
You need to have a recent development core installed in any of slot 1-7.
Note |
---|
!! Do NOT install development cores into slot 0 !! |
Head tohttps://builder.mega65.org/job/mega65-core/job/development/where you can find all development cores.
Any mega65-core from development branch dated October 10, 2023 or later should work.
Download the correct file for your MEGA65 model:DevKit, batch 1 and 2 owners : mega65r3 core
Batch 3+ owners (MEGA65 received in 2024+) : mega65r5 core
Unzip the core package after download and copy file ETHLOAD.M65 (in /sdcard-files) into the root folder of your SD card.
Install the core in slot 1-7. If you are not familiar with how to install a core read this Article.
Note |
---|
Please be aware that these cores are still experimental and not official stable releases! |
...
Configure a valid MAC address for the ethernet port of your MEGA65.
...
Press the ALT
key during power on and then press key 1
to start the Configuration Tool.
...
Use the Cursor Right
key to head to the NETWORK section.
...
Enter a valid MAC address different to 00:00:00:00:00:00 or use the R
key to create a valid random MAC address.
...
Head to SAVE AS DEFAULTS AND EXIT with Cursor Down
key.
...
Head to OK with Cursor Down
key and press RETURN
key to save the current settings..
Info |
---|
Be aware the MAC address is saved to your SD card, so you may need re-configure this if creating a new SD card. |
...
After all you want to check your ethernet connection is properly working
Hold key
NO SCROLL
while power-cycle the MEGA65.Select the core slot you have previously installed by pressing the correct key
Number
or using theCursor
keys andRETURN
key. The MEGA65 now boots with the selected core.Press the keys
SHIFT
and£
(pound) to enable the ethernet remote control. This is a security measure to only allow remote access to your MEGA65 if explicitly activated by the user via this key combination. By pressing the key combination a special char is printed which you can ignore.
If you have done everything right the power LED will start blinking green/yellow to indicate your MEGA65 can be used with mega65_ftp or etherload. Remote control needs to be re-enabled after a reset or power-off.
Note |
---|
You should avoid to activate remote control if your MEGA65 is operated in a public or unknown network, as it allows others in your network to remote control your MEGA65 and have access to your SD card. |
...
Download MEGA65 Tools
This step is not necessary if you plan to work with M65Connect.
Download the latest version of the development branch mega65-tools to your PC, which you can find on Filehost and contains the required CLI tools etherload and mega65_ftp:
Extract the package and copy the OS related CLI tools
Copy the required files etherload(.exe/.osx) and mega65_ftp(.exe/.osx) where you want to have them.
Info |
---|
If running into issues getting the MacOS binaries to work, please check out this article on Filehost: macOS: Running command line tools when "the developer cannot be verified" ) |
...
The MEGA65 will communicate via a link-local IPv6 address that it automatically generates from its MAC address (EUI-64). In order for your PC/Mac to communicate with the MEGA65, you need to enable IPv6 support on your network interface that is connected to the MEGA65. All modern operating systems have IPv6 enabled by default. Unless you manually disabled it, everything should work.
...
The mega65_ftp tool is a command-line application allowing to upload and download files to/from the SD card of the MEGA65.
...
Table of Contents |
---|
Introduction
The MEGA65 can use ethernet for SD card access and starting programs remotely by using the tools mega65_ftp and etherload. The tools are command-line applications, so you should be familiar with using these kinds of programs in a terminal, else you can download the GUI-tool M65Connect from Filehost. This guide also assumes that you know how to install a new core into one of the slots 1-7.
Set up
Before you start make sure:
The PC/Mac and your MEGA65 need to be connected to the same ethernet network.
IPv6 needs to be enabled on the network interface on your PC/Mac (this is default but you may have changed it)
If you have a MEGA65 (R6) produced/delivered in 2024, you can directly skip to section Test Ethernet Connection below, as your MEGA65 is already configured correctly and has the needed core pre-installed.
Hardware configuration
The DIP switch #2 on your MEGA65 mainboard needs to be set to ON.
Info |
---|
This step is not necessary for MEGA65 (R6) produced in 2024 and delivered from batch #3. |
Unplug any cables attached to the MEGA65 (power, video, etc.)
Turn the MEGA65 to the back side and open the housing by removing the three lower screws:
Locate the DIP switch on the right side of the mainboard:
Use a small screwdriver or a pen to set DIP switch #2 to ON position. Be aware the DIP switch is up-side-down.
Close the housing, put back the three screws and plug all cables.
Download recent core
Info |
---|
This step is not necessary for MEGA65 (R6) produced in 2024 and delivered from batch #3. |
You need to update your MEGA65 to release version 0.96. Have a look into the User's Guide chapter 5 (“Upgrading the MEGA65”) for details on how to get the latest released core and ROM installed.
Set up MAC address
Configure a valid MAC address for the ethernet port of your MEGA65.
Press the
ALT
key during power on and then press key1
to start the Configuration Tool.Use the
Cursor Right
key to head to the NETWORK section.Make sure the MAC address is not 00:00:00:00:00:00. If in doubt what MAC address to enter, press the R key to let the Configuration Tool create a valid random MAC address for you.
Use
Cursor Right
key again to head to DONE section.Head to SAVE AS DEFAULTS AND EXIT with
Cursor Down
key.Head to OK with
Cursor Down
key and pressRETURN
key to save the current settings..
Info |
---|
Be aware the MAC address is saved to your SD card, so you may need re-configure this if creating a new SD card. |
Test ethernet connection
After all you want to check your ethernet connection is properly working. MEGA65 (R6) owners with units produced/delivered in 2024 can directly go to step 3. as their default core in slot 1 will by default work.
If you
- have a MEGA65 (R6) produced/delivered in 2024; or
- installed the 0.96 core in slot 1,
you can just power on your MEGA65 as usual and proceed with step 4.Hold key
NO SCROLL
while powering on the MEGA65.Select the core slot you have previously installed by pressing the correct key
Number
or using theCursor
keys andRETURN
key. The MEGA65 now boots with the selected core.Press the keys
SHIFT
and£
(pound) to enable the ethernet remote control. This is a security measure to only allow remote access to your MEGA65 if explicitly activated by the user via this key combination. By pressing the key combination a special char is printed which you can ignore.
If you have done everything right the power LED will start blinking green/yellow to indicate your MEGA65 can be used with mega65_ftp or etherload. Remote control needs to be re-enabled after a reset or power-off.
Note |
---|
You should avoid to activate remote control if your MEGA65 is operated in a public or unknown network, as it allows others in your network to remote control your MEGA65, modify your ROM and have access to your SD card. |
Working with mega65_ftp and etherload
Download MEGA65 Tools
This step is not necessary if you plan to work with M65Connect.
Download the latest version of the development branch mega65-tools to your PC, which you can find on Filehost and contains the required CLI tools etherload and mega65_ftp:
Extract the package and copy the OS related CLI tools. On macOS, please make sure to not put the binaries in your Downloads or Documents folder (or in any sub-folder of those), as they won’t function correctly due to additional security restrictions macOS applies to executables placed there.
Copy the required files etherload(.exe/.osx) and mega65_ftp(.exe/.osx) where you want to have them.
Info |
---|
If running into issues getting the MacOS binaries to work, please check out this article on Filehost: macOS: Running command line tools when "the developer cannot be verified" |
IPv6
The MEGA65 will communicate via a link-local IPv6 address that it automatically generates from its MAC address (EUI-64). In order for your PC/Mac to communicate with the MEGA65, you need to enable IPv6 support on your network interface that is connected to the MEGA65. All modern operating systems have IPv6 enabled by default. Unless you manually disabled it, everything should work.
Info |
---|
In order for the auto-discovery to work, port UDP port 4510 needs to be enabled in your firewall for IPv6. Windows and MacOS will ask you the first time you start the application whether you want to allow network access of the program. Please confirm this in order to use the auto-discovery feature. |
How to use mega65_ftp
The mega65_ftp tool is a command-line application allowing to upload and download files to/from the SD card of the MEGA65.
Note |
---|
Make sure the remote access to the MEGA65 is activated first via keys |
In order to use mega65_ftp via ethernet, just provide the -e parameter:
mega65_ftp -e
You can now transfer files via put
and get
commands. Enter help
to get a list of available commands.
Commands can also be provided directly on the command-line instead of typing them in interactively. This is useful when using mega65_ftp in scripts to automatically perform a specific upload or download task:
mega65_ftp -e -c "put myimage.d81" -c "quit"
This will upload the file myimage.d81
from the current PC/Mac directory to the SD card.
How to use etherload
The etherload tool is used to upload programs directly into the RAM of the MEGA65 and execute them there. This is especially useful for a cross-development environment.
Note |
---|
Again, please make sure the remote access to the MEGA65 is activated first via keys |
In order to use mega65_ftp via ethernet, just provide the -e parameter:
mega65_ftp -e
You can now transfer files via put
and get
commands. Enter help
to get a list of available commands.
Commands can also be provided directly on the command-line instead of typing them in interactively. This is useful when using mega65_ftp in scripts to automatically perform a specific upload or download task:
mega65_ftp -e -c "put myimage.d81" -c "quit"
This will upload the file myimage.d81
from the current PC/Mac directory to the SD card.
...
The etherload tool is used to upload programs directly into the RAM of the MEGA65 and execute them there. This is especially useful for a cross-development environment.
Note |
---|
Again, please make sure the remote access to the MEGA65 is activated first via Shift-£ - the power LED needs to be blinking green/yellow! |
...
The simplest way of using etherload is to provide a prg file as argument and use the -r
parameter to run it:
etherload -r <file.prg>
The tool will determine which mode the program needs to run in (C64 or MEGA65 mode) and will do an automatic reset to the respective mode before starting the program.
Info |
---|
The etherload program will need to do a reset first to make sure the system is in the right state. This is a fundamental difference to the m65 tool which can do a reset before RUN but does not require it. The m65 tool does not support ethernet functionality, though. |
If your program requires a MOUNT
command first to have a D81 mounted from SD card, you can specify this via the -m
parameter:
etherload -m MYIMAGE.D81 -r <file.prg>
Please make sure the D81 image file is already on the SD card before running this command (for example, by uploading it first via mega65_ftp).
...
The above commands work well for programs that provide BASIC code allowing them to be executed via RUN
. If you want to start a machine language program, you need to provide its starting address in hexadecimal notation:
etherload -j 8000 <file.prg>
In this case, the machine will not be reset first and etherload will do a JMP
to the provided address. The started program needs to configure relevant I/O registers as needed.
Info |
---|
When using the The |
The target address will be determined by the first two bytes in the provided file. If the file does not have its loading address in the first two bytes, it can be provided via the -b
parameter:
etherload -b 8000 -j 8000 <file.prg>
The loading address and the jump address can of course be different addresses.
...
Sometimes it is useful to upload several data files to different specific locations before uploading and starting the program. Think of developing a game that needs to load asset data files on startup: Instead of loading the files each time you start a new revision of your game during development, you can temporarily disable your loading routine and instead use etherload to upload the data directly into memory.
Let’s assume we have two files gfx.dat
and music.dat
that we want to load at addresses $20000 and $8000 before we start the main program. This can be done by calling etherload several times, but using the parameter --halt
for every invocation except the last one. This will instruct etherload to not jump to any address when done but instead wait for further etherload executions to continue loading data.
Code Block |
---|
etherload -b 20000 --halt gfx.dat
etherload -b 8000 --halt music.dat
etherload -j 2016 game.prg |
This will load the game asset files first and then will load the file game.prg and jump to address $2016 to execute it.
Info |
---|
Note that game.prg might be a game with a BASIC header to start it, but we are not using the |
If you want to skip bytes of a file when loading it to memory, you can also use the --offset
parameter. This one will skip the provided number of bytes (in hexadecimal notation) when loading the file. Let’s assume we have the program game.prg
with a start address of $2001, and we only want to load it from address $2100 (which may be its entry point), then we need to skip the first 255 bytes for loading.
etherload -j 2100 --offset ff game.prg
...
If you have a specific ROM file on your PC/Mac that you want to run, you can use the -R parameter:
etherload -R 920384.ROM
This will load the ROM file “920384.ROM” from your PC/Mac, upload it to the memory of the MEGA65, and reset into that new ROM. As this upload and reset is amazingly fast, you can use this to quickly test different revisions of the ROM without having to upload them to SD card and doing a full reset on your MEGA65.
If you want to start a program together with a specific ROM revision, you can combine the -R
parameter with a program file to execute:
etherload -R 920384.ROM -r <file.prg>
...
Etherload and mega65_ftp can start faster if you directly provide the IPv6 address and interface identifier where the MEGA65 is connected to. This is because then the auto-discovery will be skipped, saving up to one second during startup.
You can trigger auto-discovery manually via etherload to find out which IP address and interface identifier to use:
Code Block |
---|
etherload --discover
MEGA65 found at fe80::d5ff:fe16:0%eth0 |
You can then us the string provided for your next launch of etherload or mega65_ftp:
Code Block |
---|
etherload -i fe80::d5ff:fe16:0%eth0 -r <file.prg> |
Code Block |
---|
mega65_ftp -i fe80::d5ff:fe16:0%eth0 |
Info |
---|
Note that the IP address is created out of your MEGA65’s MAC address, so the IP address will change if you update your MAC address. |
...
I installed a development core as required, but pressing keys SHIFT
and £
(pound) has no effect. The power LED does not start blinking.
Please check whether the core is up-to-date and the correct core is actually running. Note that if you exit from configuration, the core from slot 0 is started and not the default core in slot 1! You may need to power-cycle after exiting configuration.
Using a WIFI bridge might cause connection problems. If you try to connect to the MEGA65 over a network there might be several reasons (firewall, settings, etc.) etherload can’t find the MEGA65.
To locate the problem connect the PC to the MEGA65 using a LAN cable and see if it’s working that way.
...
Starting programs remotely
The simplest way of using etherload is to provide a prg file as argument and use the -r
parameter to run it:
etherload -r <file.prg>
The tool will determine which mode the program needs to run in (C64 or MEGA65 mode) and will do an automatic reset to the respective mode before starting the program.
Info |
---|
The etherload program will need to do a reset first to make sure the system is in the right state. This is a fundamental difference to the m65 tool which can do a reset before RUN but does not require it. The m65 tool does not support ethernet functionality, though. |
If your program requires a MOUNT
command first to have a D81 mounted from SD card, you can specify this via the -m
parameter:
etherload -m MYIMAGE.D81 -r <file.prg>
Please make sure the D81 image file is already on the SD card before running this command (for example, by uploading it first via mega65_ftp).
Starting machine language programs
The above commands work well for programs that provide BASIC code allowing them to be executed via RUN
. If you want to start a machine language program, you need to provide its starting address in hexadecimal notation:
etherload -j 8000 <file.prg>
In this case, the machine will not be reset first and etherload will do a JMP
to the provided address. The started program needs to configure relevant I/O registers as needed.
Info |
---|
When using the The |
The target address will be determined by the first two bytes in the provided file. If the file does not have its loading address in the first two bytes, it can be provided via the -b
parameter:
etherload -b 8000 -j 8000 <file.prg>
The loading address and the jump address can of course be different addresses.
Uploading multiple memory segments
Sometimes it is useful to upload several data files to different specific locations before uploading and starting the program. Think of developing a game that needs to load asset data files on startup: Instead of loading the files each time you start a new revision of your game during development, you can temporarily disable your loading routine and instead use etherload to upload the data directly into memory.
Let’s assume we have two files gfx.dat
and music.dat
that we want to load at addresses $20000 and $8000 before we start the main program. This can be done by calling etherload several times, but using the parameter --halt
for every invocation except the last one. This will instruct etherload to not jump to any address when done but instead wait for further etherload executions to continue loading data.
Code Block |
---|
etherload -b 20000 --halt gfx.dat
etherload -b 8000 --halt music.dat
etherload -j 2016 game.prg |
This will load the game asset files first and then will load the file game.prg and jump to address $2016 to execute it.
Info |
---|
Note that game.prg might be a game with a BASIC header to start it, but we are not using the |
If you want to skip bytes of a file when loading it to memory, you can also use the --offset
parameter. This one will skip the provided number of bytes (in hexadecimal notation) when loading the file. Let’s assume we have the program game.prg
with a start address of $2001, and we only want to load it from address $2100 (which may be its entry point), then we need to skip the first 255 bytes for loading.
etherload -j 2100 --offset ff game.prg
Using custom ROM files
If you have a specific ROM file on your PC/Mac that you want to run, you can use the -R parameter:
etherload -R 920384.ROM
This will load the ROM file “920384.ROM” from your PC/Mac, upload it to the memory of the MEGA65, and reset into that new ROM. As this upload and reset is amazingly fast, you can use this to quickly test different revisions of the ROM without having to upload them to SD card and doing a full reset on your MEGA65.
If you want to start a program together with a specific ROM revision, you can combine the -R
parameter with a program file to execute:
etherload -R 920384.ROM -r <file.prg>
Speeding up start-up time
Etherload and mega65_ftp can start faster if you directly provide the IPv6 address and interface identifier where the MEGA65 is connected to. This is because then the auto-discovery will be skipped, saving up to one second during startup.
You can trigger auto-discovery manually via etherload to find out which IP address and interface identifier to use:
Code Block |
---|
etherload --discover
MEGA65 found at fe80::d5ff:fe16:0%eth0 |
You can then us the string provided for your next launch of etherload or mega65_ftp:
Code Block |
---|
etherload -i fe80::d5ff:fe16:0%eth0 -r <file.prg> |
Code Block |
---|
mega65_ftp -i fe80::d5ff:fe16:0%eth0 |
Info |
---|
Note that the IP address is created out of your MEGA65’s MAC address, so the IP address will change if you update your MAC address. |
Troubleshooting
I installed a development core as required, but pressing keys SHIFT
and £
(pound) has no effect. The power LED does not start blinking.
Please check whether the core is up-to-date and the correct core is actually running. Note that if you exit from configuration, the core from slot 0 is started and not the default core in slot 1! You may need to power-cycle after exiting configuration.
Using a WIFI bridge might cause connection problems. If you try to connect to the MEGA65 over a network there might be several reasons (firewall, settings, etc.) etherload can’t find the MEGA65.
To locate the problem connect the PC to the MEGA65 using a LAN cable and see if it’s working that way.
Another reason why the power LED is not blinking by pressing the keys SHIFT
and £
(pound) may be you forgot to set DIP switch #2 to ON or you may have set another switch than 2 to ON. Be aware the DIP switch is up-side-down.
(macOS specific) The power LED is blinking green/yellow, and both MEGA65 and Mac are in the same Ethernet network, but still the tools claim they can’t detect the MEGA65.
This can happen if you placed etherload or mega65_ftp in your Downloads or Documents folder (or in a sub-folder of those). There are additional security measures in place for those folders that will prevent etherload or mega65_ftp from receiving the network packets sent by the MEGA65. Please copy the binaries to another location and start them from there.
When starting mega65_ftp or etherload, I can see the MEGA65 reacts, but then it just hangs without continuing.
...