Browse Source

o played with banks
o add ditz
o add checksize

optixx 15 years ago
parent
commit
09f42acfc8

+ 18 - 0
bugs/issue-33e57a7c3ac89afc2e37880441fe0eeec05e2b3f.yaml

@@ -0,0 +1,18 @@
+--- !ditz.rubyforge.org,2008-03-06/issue 
+title: Test
+desc: Test
+type: :bugfix
+component: snesram
+release: 
+reporter: David <david@optixx.org>
+status: :unstarted
+disposition: 
+creation_time: 2009-04-20 18:13:29.104365 Z
+references: []
+
+id: 33e57a7c3ac89afc2e37880441fe0eeec05e2b3f
+log_events: 
+- - 2009-04-20 18:13:33.543384 Z
+  - David <david@optixx.org>
+  - created
+  - nope

+ 8 - 0
bugs/project.yaml

@@ -0,0 +1,8 @@
+--- !ditz.rubyforge.org,2008-03-06/project 
+name: snesram
+version: "0.5"
+components: 
+- !ditz.rubyforge.org,2008-03-06/component 
+  name: snesram
+releases: []
+

+ 1 - 1
poc/avr_sdcard/Makefile

@@ -182,7 +182,7 @@ AVRDUDE_PROGRAMMER = stk500v2
 
 # com1 = serial port. Use lpt1 to connect to parallel port.
 
-AVRDUDE_PORT = /dev/tty.PL2303-00002006    
+AVRDUDE_PORT = /dev/tty.PL2303-00001124
 
 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
 

+ 2 - 2
poc/avr_sdcard/checksize

@@ -8,8 +8,8 @@
 # Revision: $Id: checksize 83 2006-01-05 22:20:53Z cs $
 
 error=0
-codelimit=8192  # default value
-datalimit=992  # default value; leave 32 bytes for stack
+codelimit=2048  # default value
+datalimit=96    # default value; leave 32 bytes for stack
 
 if [ $# -gt 1 ]; then
 	codelimit="$2"

+ 78 - 12
poc/avr_sdcard/main.c

@@ -39,9 +39,17 @@ extern FILE uart_stdout;
 #define LED_PORT	PORTD
 #define LED_DIR		DDRD
 
-#define FILENAME	"sprite.raw"
+//#define FILENAME	"sprite.raw"
+//#define FILENAME	"ascii.smc"
+#define FILENAME	"rom.smc"
+//#define FILENAME	"supert.smc"
+//#define FILENAME	"vortex.smc"
+//#define FILENAME	"mrdo.smc"
+//#define FILENAME	"hungry.smc"
+
+#define DUMPNAME	"dump256.smc"
 #define BUFFER_SIZE 512
-#define BLOCKS 512
+#define BLOCKS 		512
 #define MEMSIZE 	0x80000
 
 uint8_t read_buffer[BUFFER_SIZE];
@@ -101,6 +109,17 @@ void spi_master_transmit(unsigned char cData)
 	while(!(SPSR & (1<<SPIF)));
 }
 
+
+void sram_set_addr(uint32_t addr)
+{
+	spi_master_transmit((uint8_t)(addr>>16));
+	spi_master_transmit((uint8_t)(addr>>8));
+	spi_master_transmit((uint8_t)(addr>>0));
+
+	LATCH_PORT |= (1<<S_LATCH);
+    LATCH_PORT &= ~(1<<S_LATCH);
+}
+
 uint8_t sram_read(uint32_t addr)
 {
 	uint8_t byte;
@@ -218,6 +237,7 @@ int main(void)
     uint32_t 	fat_size = 0;
     uint32_t 	rom_addr = 0;
     uint32_t 	skip_block = 0;
+    uint8_t 	bank_cnt = 0;
  
     uart_init();
     stdout = &uart_stdout;
@@ -228,19 +248,27 @@ int main(void)
 	spi_init();
 	printf("SPI Init\n");
 
-	
-	//sram_clear(0x000000, 0x400000);
-	//printf("sram_clear\n");
-
+#if 0                 
+	sram_clear(0x000000, 0x80000);
+	printf("sram_clear\n");
+#endif
 	//printf("read 0x0f0f\n");
 	//sram_read(0x0f0f);
 	//printf("write 0x0f0f\n");
 	//sram_write(0x0f0f,0xaa);
-	//while(1);
+	
+#if 0	
+	rom_addr = 0x4aaaa;
+	printf("write %lx\n",rom_addr);
+	sram_set_addr(rom_addr);
+	while(1);
+#endif
+	
+	
 	while ( mmc_init() !=0) {
 		printf("No sdcard...\n");
     }
-    printf("MMC Init sone\n");
+    printf("MMC Init done\n");
     fat_init(read_buffer);
     printf("FAT Init done.\n");
     rom_addr = 0x000000;
@@ -255,9 +283,10 @@ int main(void)
 
         for (uint16_t block_cnt=0; block_cnt<BLOCKS; block_cnt++) {
         	fat_read_file (fat_cluster,read_buffer,block_cnt);
-			if (block_cnt % 16 == 0)
-				printf("Write Ram 0x%lx Skipped %li\n",rom_addr,skip_block);
-			
+			if (block_cnt % 64 == 0){
+				bank_cnt++;
+				printf("Write Ram Bank: 0x%x Addr: 0x%lx Skipped: %li\n",bank_cnt,rom_addr,skip_block);
+			}
 			if (sram_check(read_buffer,512))
 				sram_copy(rom_addr,read_buffer,512);
 			else
@@ -266,14 +295,51 @@ int main(void)
         }
 		printf("Done 0x%lx Skipped %li\n",rom_addr,skip_block);
 	}
+
+#if 0
     printf("Dump Memory\n\r");
     rom_addr = 0x000000;
-    for (uint16_t block_cnt=0; block_cnt<BLOCKS; block_cnt++) {
+    for (uint16_t block_cnt=0; block_cnt < 64; block_cnt++) {
     	sram_read_buffer(rom_addr,read_buffer,512);
     	dump_packet(rom_addr,512,read_buffer);
 		rom_addr += 512;
     }
 	printf("\nDone 0x%lx\n",rom_addr);
+#endif	
+
+#if 0
+	
+    printf("Look for %s\n",DUMPNAME);
+
+	fat_cluster = 0;
+    fat_attrib = 0;
+    fat_size = 0;
+	
+    if (fat_search_file((uint8_t*)DUMPNAME,
+						&fat_cluster,
+						&fat_size,
+						&fat_attrib,
+						read_buffer) == 1) {
+	   
+
+		printf("Found %s\n",DUMPNAME);
+		rom_addr = 0x000000;
+		bank_cnt =0;
+        for (uint16_t block_cnt=0; block_cnt<BLOCKS; block_cnt++) {
+			printf("Write 1");
+	    	sram_read_buffer(rom_addr,read_buffer,512);
+			printf("Write 2");
+			fat_write_file (fat_cluster,read_buffer,block_cnt);
+			if (block_cnt % 64 == 0){
+				bank_cnt++;
+			}
+			printf("Write File Bank: 0x%x Addr: 0x%lx Skipped: %li\n",bank_cnt,rom_addr,skip_block);
+			rom_addr += 512;
+        }
+		printf("Done 0x%lx Skipped %li\n",rom_addr,skip_block);
+	}
+#endif	
+	
 	sram_snes_mode();
 	printf("\nEnter Snes mode\n");
 	while(1);

+ 2 - 2
snes/ascii/Makefile

@@ -10,8 +10,8 @@ OFILES = main.o
 GFXDATA = optixx_logo.bmp
 
 all: $(OFILES) Makefile  
-	$(LD) $(LDFLAGS) linkfile ascii.rom
-	ucon64 -chk -swc ascii.rom 
+	$(LD) $(LDFLAGS) linkfile ascii.smc
+	ucon64 -chk -swc ascii.smc
 
 zsnes: 
 	/Applications/ZSNES.app/Contents/MacOS/ZSNES ascii.swc

+ 11 - 5
snes/ascii/main.asm

@@ -6,8 +6,6 @@
 .INCLUDE "header.inc"
 
 
-
-
 .SECTION "MAIN" 
 
 .define	dp					$0000 
@@ -758,7 +756,6 @@ text_0:
  	.db		"                                "
 
 
-
 .INCLUDE "vsine_1.s"
 
 .INCLUDE "vsine_2.s"
@@ -772,16 +769,25 @@ text_0:
 .INCLUDE "colbar_3.s" 
 
 
+
+.INCLUDE "optixx_logo.s" 
+
+
 .INCLUDE "colbarsine_1.s" 
+.ends
 
 
 
+.bank 1
+
+.SECTION "GFX" 
+
+
 
 
-.INCLUDE "optixx_logo.s" 
 
-.ENDS
 
+.ends
 
 
 ;.BANK $04 SLOT 6