Req:information on in-cart flashrom programing

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Req:information on in-cart flashrom programing
by on (#5242)
I grow tired of haveing to pull the flashrom each time I need to reprogram them outhers have mentioned some things about programing them in-circuit information on how to go about that would be helpfull

by on (#5288)
I can give you some NES code that works for 29F flashroms if you want it. I've only tested on AMD flashes so far, but other 29xs look the same. I have a subroutine for erasing a sector, and another for programming a byte. Also some code that detects the chip maker/type. All this code has to be copied into RAM and run there.

by on (#5304)
well I an currentley useing some Pm29F002T-12PC witch is the 29F020 by PMC I was hopeing i could maybe program them via jtag or something without the cartrige pluged into the nes

by on (#5312)
I couldn't find a datasheet for that chip, but if it's pretty much a normal 29F020 then it'll need something to control all the data and address lines. The NES is the obvious way, maybe also a small circuit could be clipped onto the ROM's pins for programming outside the NES.

If you have to remove the cart from the NES anyways it doesn't seem like a whole lot more work to pull the chip. Though yeah, that's a pain. I have it a little easier with flashes since I use a toploader, and when I had to swap chips I connected the flash to my carts with 2 sockets, that makes it really easy to disconnect.

by on (#5315)
alright thanks

would you mind maybe Providing a link or something that goes into greater detail on how to do it with the NES then

btw this is the datasheet I go by it dose not seem to have the 12PC anywhere on there but the pinout the is the same and it seems to be the same thing http://rapidshare.de/files/6091011/PM29F002.pdf.html

by on (#5320)
Here's the erasing and programming code from the Squeedo BIOS.

Of course you also need some way to load the program, I use RS232 (it works ok on the controller port and also through the PIC I use on Squeedo). You also need the /Write signal for PRG from the NES. And well, if there's a mapper at $8000-$FFFF that'll complicate things too.

Code:
sector_erase:
        lda #$AA
        ldy #$55
        ldx #$80

        sta $8555
        sty $82AA
        stx $8555
        sta $8555
        sty $82AA
        lda #$30
        sta $8000
:
        lda $8000
        cmp #$FF
        bne :-
        rts

byte_program:
          stx temp2
          ldx #$AA
          stx $8555
          ldx #$55
          stx $82AA
          ldx #$A0
          stx $8555
          sta (ptr),y    ;(ptr),y
          sta temp_lo

@program_wait:
          lda (ptr),y
          sta count_lo
          lda (ptr),y
          sta count_hi
          and #%01000000
          sta temp3
          lda count_lo
          and #%01000000
          cmp temp3
          beq @program_done
          lda count_hi
          and #%00100000
          and count_lo
          beq @program_wait
          lda (ptr),y
          sta count_lo
          lda (ptr),y
          sta count_hi
          and #%01000000
          sta temp3
          lda count_lo
          and #%01000000
          cmp temp3
          beq @program_done
          lda #$F0
          sta (ptr),y
          ldx temp2
          rts

@program_done:
;              beep
                ldx temp2
                rts