💾 Archived View for vigrey.com › blog › iss-tracker-for-nes captured on 2023-01-29 at 02:48:27. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

International Space Station Tracker for the NES

Sep 15, 2020

IMPORTANT: This blog post assumes you have downloaded the iss-nes code at the iss-nes GitHub repository if you want to play around with this project.

ISS-NES GitHub Repo

International Space Station Tracker for NES

So I made another NES project that was a bit unnecessary to show the NES working as a computer (it is a computer after all, just like the Apple II and Commodore 64, even based on the 6502 just like both of those computers). This time around, I decided it could be fun to track the International Space Station in real-time.

You can see an example of the ISS tracker working in the following youtube video.

ISS for NES - Youtube Video

Wait a Minute... How Is That Possible?

If you are confused as to how the NES can connect to the internet to get ISS tracking data, don't worry, it's not exactly straight forward. At the moment, there are two different methods I'm taking to get this to work. One to make this work on emulators and one to make this work on actual hardware. This post will only describe how to get the ISS tracker to work on an NES emulator. I may do a post later discussing how to make the ISS tracker work on actual NES hardware.

Before I talk about how to get this working on an emulator or hardware, let's talk about the iss-nes GitHub repository quick.

The GitHub Repository (Code and Binaries)

Inside of the iss-nes GitHub repository, you will find a directory called bin. This directory contains the pre-compiled files needed to play this NES ROM successfully on the FCEUX emulator for Windows and the Mesen emulator for Linux and Windows.

Let's take a look at what is in the bin directory or the repository.

cd iss-nes; tree ./bin
bin
|__ iss-nes-TAStm32
|   |__ iss-nes-TAStm32-linux-amd64
|   |__ iss-nes-TAStm32-linux-arm
|   |__ iss-nes-TAStm32-linux-arm64
|   |__ udev
|       |__ rules.d
|           |__ 51-tastm32.rules
|__ lua
|   |__ fceux.lua
|   |__ mesen.lua
|__ nes
    |__ iss-nes.nes

There are 3 main directories in bin, which are iss-nes-TAStm32, lua, and nes. We will only be caring about lua and nes in this blog post.

lua contains lua scripts to use on the Mesen NES emulator and the Windows version of the FCEUX NES emulator to make the NES ROM get ISS tracking data. nes contains the NES ROM file itself.

iss-nes-TAStm32 contains a program that is used to communicate with special hardware called the TAStm32 to make the ISS tracker work on actual NES hardware, but that's for another blog post...

You DO NOT need to download the entire repository to make this work. If you just want to download the NES ROM and the lua script for your emulator, you can do so using the buttons below. The buttons below will lead you to the up-to-date GitHub links for the specific files you will need to make this work on your emulator.

Please note that the Lua Script buttons will open a new tab with the lua script source code rather than opening up a dialog box asking you if you want to save the file. You should be able to right click in the new tab and select "Save Page As" or whatever the equivalent on your web browser is.

NES ROM

Lua Script for FCEUX

Lua Script for Mesen

Running This NES ROM on an Emulator

IMPORTANT: Currently, this only works on Mesen and the Windows version of FCEUX.

Following are 2 steps to get the ISS tracking NES ROM to work on an emulator. Step 2 is split into two different paths, one for if you using the Windows version of FCEUX and one for if you are using Mesen.

Step 1: Open the NES ROM in Mesen or the Windows Version of FCEUX

You can find the iss-nes.nes NES ROM file in the bin/nes directory in the repository or by clicking the NES ROM button a little earlier in this blog post. If you have ever used an NES emulator before, opening this ROM should be pretty straight forward. If not, simply click File > Open in Mesen or File > Open ROM... in the Windows version of FCEUX and select the iss-nes.nes ROM.

Step 2 - FCUEX: Run the Lua Script

"iss-nes.nes" running in FCEUX

With iss-nes.nes running in FCEUX for Windows, it is now time to run the Lua script in FCEUX. First you are going to need to open up the FCEUX Lua Script Window, which you can do my clicking File > Lua > New Lua Script Window..." like what is shown in the image below.

Click "File > Lua > New Lua Script Window..." to open the lua script window

At this point, the Lua Script window should appear. Clicking the Browse... button in the Lua Script window will open up a window that lets you browse to a lua file saved on your computer.

Click "Browse..." to select a lua script file to run

Browse to and select the fceux.lua file and then click the Open button to open fceux.lua.

Select the "fceux.lua" file

After selecting the lua script file, the data on the top of the NES ROM screen should update. With a good and consistent internet connection, the data should only be about a second or less off of real-time, but it is possible with an inconsistent enough internet connection to be a few seconds off.

The Lua script successfully running

Step 2 - Mesen: Run the Lua Script

"iss-nes.nes" running in Mesen

With iss-nes.nes running in Mesen, it is now time to run the Lua script in Mesen. First you are going to need to open up the Mesen Lua Script Window, which you can do my clicking Debug > Script Window" like what is shown in the image below.

Click "Debug > Script Window" to open the lua script window

At this point, the Lua Script window should appear. Selecting File > Open will cause the Lua Script window to open up a window that lets you browse to a lua file saved on your computer.

Click "File > Open" to select a lua script file to run

Browse to and select the mesen.lua file and then click the Open button to open mesen.lua.

Select the "mesen.lua" file

After selecting the lua script file, the data on the top of the NES ROM screen should update. With a good and consistent internet connection, the data should only be about a second or less off of real-time, but it is possible with an inconsistent enough internet connection to be a few seconds off.

The Lua script successfully running

Future Work

I plan on releasing the source code I am using for the TCP server the lua scripts are connecting to in the near future, once I have the source code commented well enough. There is also a chance that I will write a blog post explaining how to get this NES ROM to work on actual NES hardware using an NROM-256 NES cartridge board and the TAStm32 board.

ISS-NES GitHub Repo