Powerpak writes to PRG-ROM?

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
batslyadams
Posts: 4
Joined: Tue Jan 12, 2010 9:03 am
Location: Bronx, NY

Powerpak writes to PRG-ROM?

Post by batslyadams »

Hey guys,

I've written up a serial interface for the NES using an ATMEGA328 (standalone or Arduino) - I've ironed out all of the kinks with the serial (tx->NES only) code and it works perfectly. I've written a few ROMs to release with the software/schematics (basic MIDI interface, nametable tool + live upload to HW), but one of major things I wanted to do was a fast PRG upload for debugging. I've swapped the CF card one too many times on that powerpak!
I wrote a small program that uploads up to 2K to PRG-RAM (6000-7FFF) then jumps to $6000 which works just fine if I disable the NMI since I can't change the vector as far as I know.

Anyway,

Is there a way I can write to PRG-ROM when I'm using the powerpak from within the code (i.e STA $8000-$FFFF)?
(I guess I would have a ROM that copied the serial code to RAM - jump there - do the serial upload and then jump back to 8000.)

If not has anyone had any experience writing a powerpak mapper for something like this? Could I change the write enable on the "ROM" or will that interfere in fetching instructions?

Quick example of the nametable editor (uploads to CHR-RAM)
http://www.youtube.com/watch?v=mvH7GuDFQlg
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

Good job! :)

For changing vectors when using PRG-RAM you can of course have your own set of custom vectors somewhere in the PRG-RAM and put a JMP (myvector) in the PRG-ROM and point the actual vector to that.

I don't think it's possible to write to PRG-ROM using any of the official mappers. Since, well, that would make no sense. :) Definitely possible to write a custom mapper to do the trick though. I can maybe help you with writing the custom mapper if I get around to fixing my PowerPak.

This would be really cool if done right. The software could wait for data from PC and automatically run it once upload is complete. User could then press reset or something to re-upload. The PC side could also check for differences in files and not upload parts that haven't changed. By modifying the right files it could even skip the normal PowerPak menus altogether.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

thefox wrote:I don't think it's possible to write to PRG-ROM using any of the official mappers.
FDS hardwires 32 KiB of PRG RAM into $6000-$DFFF, and MMC5 allows mapping 8 KiB banks of PRG RAM $6000, $8000, $A000, and $C000.
The PC side could also check for differences in files and not upload parts that haven't changed.
Like an IPS, right?
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: Powerpak writes to PRG-ROM?

Post by blargg »

batslyadams wrote:one of major things I wanted to do was a fast PRG upload for debugging.
Look into a difference-based approach. I use a PRG upload over serial to the NES, but only at 5.7 KB/sec. This used to take a while for a 32K PRG (even when optimizing out long sections of a repeated byte), but a couple of days ago I had the PC-side uploader keep track of the current PRG contents, and only upload the difference. Vastly sped up the edit-run cycle. As long as you can make your PRG read-only during execution, you can assume it won't change. You could add a checksum at the end just to be sure.

If your code has a few alignment directives sprinkled around (and it probably does, for tables and code you want not to cross a page), this helps the above. It ensures that even if you insert/remove bytes from a routine, it won't shift all the code after it (and thus require re-sending). Hmmm, that would be an interesting addition to this diff-based upload: a "move this block forward/back N bytes" primitive as well...
Post Reply