CHR-ROM dumping working for NROM checksum appears to be off need to compare files.

This commit is contained in:
paul eeepc 2016-12-12 10:56:53 -06:00
parent e483406c01
commit a7eaf970b2
5 changed files with 110 additions and 2 deletions

View File

@ -24,8 +24,8 @@ uint8_t dump_page( buffer *buff ) {
buff->last_idx, ~FALSE ); buff->last_idx, ~FALSE );
break; break;
case CHRROM: //$0000 case CHRROM: //$0000
//buff->cur_byte = nes_ppu_page_rd( buff->data, addrH, buff->id, buff->cur_byte = nes_ppu_page_rd_poll( buff->data, addrH, buff->id,
// (buff->last_idx | buff->id) ); buff->last_idx, ~FALSE );
break; break;
case PRGRAM: case PRGRAM:
addrH |= 0x60; //$6000 addrH |= 0x60; //$6000

View File

@ -442,3 +442,51 @@ uint8_t nes_cpu_page_rd_poll( uint8_t *data, uint8_t addrH, uint8_t first, uint8
//return index of last byte read //return index of last byte read
return i; return i;
} }
/* Desc:NES PPU Page Read with optional USB polling
* decode A13 from addrH to set /A13 as expected
* if poll is true calls usbdrv.h usbPoll fuction
* this is needed to keep from timing out when double buffering usb data
* Pre: nes_init() setup of io pins
* num_bytes can't exceed 256B page boundary
* Post:address left on bus
* data bus left clear
* data buffer filled starting at first for len number of bytes
* Rtn: Index of last byte read
*/
uint8_t nes_ppu_page_rd_poll( uint8_t *data, uint8_t addrH, uint8_t first, uint8_t len, uint8_t poll )
{
uint8_t i;
if (addrH < 0x20) { //below $2000 A13 clear, /A13 set
_ADDRH_SET(addrH | PPU_A13N);
} else { //above PPU $1FFF, A13 set, /A13 clear
_ADDRH_SET(addrH);
}
//set CHR /RD and /WR
_CSRD_LO();
//set lower address bits
ADDR_OUT = first; //doing this prior to entry and right after latching
//gives longest delay between address out and latching data
for( i=0; i<=len; i++ ) {
//couple more NOP's waiting for data
if ( poll == FALSE ) {
NOP(); //one prob good enough considering the if/else
NOP();
} else {
usbPoll();
}
//latch data
data[i] = DATA_IN;
//set lower address bits
ADDR_OUT = ++first;
}
//return bus to default
_CSRD_HI();
//return index of last byte read
return i;
}

20
firmware/source/temp Normal file
View File

@ -0,0 +1,20 @@
AVR Memory Usage
----------------
Device: atmega164a
Program: 5486 bytes (33.5% Full)
(.text + .data + .bootloader)
Data: 653 bytes (63.8% Full)
(.data + .bss + .noinit)
AVR Memory Usage
----------------
Device: atmega164a
Program: 5498 bytes (33.6% Full)
(.text + .data + .bootloader)
Data: 653 bytes (63.8% Full)
(.data + .bss + .noinit)

View File

@ -114,8 +114,28 @@ int dump_cart( USBtransfer* transfer, rom_image *rom, cartridge *cart )
//tell buffer manager when to stop //tell buffer manager when to stop
// or not..? just reset buffers and start next memory or quit
//reset buffers and setup to dump CHR-ROM //reset buffers and setup to dump CHR-ROM
check(! reset_buffers( transfer ), "Unable to reset device buffers");
check(! allocate_buffers( transfer, num_buffers, buff_size ), "Unable to allocate buffers");
check(! set_mem_n_part( transfer, buff0, CHRROM, MASKROM ), "Unable to set mem_type and part");
check(! set_mem_n_part( transfer, buff1, CHRROM, MASKROM ), "Unable to set mem_type and part");
check(! set_map_n_mapvar( transfer, buff0, NROM, NILL ), "Unable to set mapper and map_var");
check(! set_map_n_mapvar( transfer, buff1, NROM, NILL ), "Unable to set mapper and map_var");
debug("\n\nsetting operation STARTDUMP");
check(! set_buff_operation( transfer, STARTDUMP ), "Unable to set buffer operation");
for( i=0; i<(8*KByte/buff_size); i++) {
//payload transfer in and append to file
if ( i % 256 == 0 ) debug("payload in #%d", i);
check(! payload_in( transfer, data, buff_size ), "Error with payload IN");
if (i==0) printf("first byte: %x\n", data[0]);
check(! append_to_file( rom, data, buff_size ), "Error with file append");
}
debug("payload done");
//close file in main //close file in main
//reset io at end //reset io at end

20
host/source/temp Normal file
View File

@ -0,0 +1,20 @@
AVR Memory Usage
----------------
Device: atmega164a
Program: 5486 bytes (33.5% Full)
(.text + .data + .bootloader)
Data: 653 bytes (63.8% Full)
(.data + .bss + .noinit)
AVR Memory Usage
----------------
Device: atmega164a
Program: 5498 bytes (33.6% Full)
(.text + .data + .bootloader)
Data: 653 bytes (63.8% Full)
(.data + .bss + .noinit)