zzo38 wrote:blargg wrote:I just realized that this might be a perfect place to slip in a serial bootloader. PL2303-based USB-TTL-serial adapters are $2 shipped on eBay and can be wired directly to the controller port.
Which bits of which port? I suggest bit3 and/or bit4 of the second port; this way it is compatible with both NES and Famicom. The bootloader program could also include a BIOS of functions (and an ASCII character set loaded by default in CHR RAM) also used by the main menu; then loaded programs can optionally use this feature.
I had it using $4017 bits 4, 2, 1, 0. If I remember correctly (I cannot access all my notes at the moment), bit 0 so you can use a normal NES controller cable, bit 1 if you replace Famicom controller input (or maybe they put input in either), bit 2 is either so you can wire serial to NES internal bus (memblers was going to do this) and possibly on Famicom, and bit 4 is for having two controllers connected and using a modified extension cable for the second port, and maybe also for Famicom. The main danger from more than the minim necessary bits is other hardware that drives them them low when idle.
The bootloader is very minimal, receiving a 256-byte user program to zero-page and checksumming it. Everything else can be done by uploading the appropriate program.
As for invocation, it should be something simple to do with minimal effort. Holding a button on the controller while powering up/resetting is about as minimal as it gets for manual invocation. It should check the controller shortly after reset to avoid having to hold the buttons for more than a moment. It should also check that only the decided-on buttons are held, and no others, to avoid possibility of false triggering if no controller, other controller type, whatever.
Here's what I've got for the bootloader spec and serial cable at the moment, but I haven't looked over it in a while so it may contain minor errors:
Bootloader
Serial cable
I've been using the specified bootloader for a few years, and an earlier variant for many years before that, and it's performed quite well.