This is a driver for NES and SNES controllers for 6502-based computers.
The demo code is written for the Commodore 64. Note that for computers faster than 1 MHz, you might have to add delays before each GPIO access.
See the comments in the code for more info. Also see https://www.pagetable.com/?p=1365.
Author: Michael Steil, mist64@mac.com, Public Domain