o fix sector calc
This commit is contained in:
parent
7bdc299e61
commit
a4751edf97
@ -20,4 +20,4 @@
|
|||||||
#define SHARED_ADDR 0x3d0000
|
#define SHARED_ADDR 0x3d0000
|
||||||
|
|
||||||
|
|
||||||
#define MMIO_DEBUG
|
#undef MMIO_DEBUG
|
||||||
|
|||||||
@ -93,7 +93,7 @@ void _print_screen(word y, char *buffer){
|
|||||||
*(byte*)0x2118 = *buffer-32;
|
*(byte*)0x2118 = *buffer-32;
|
||||||
x++;
|
x++;
|
||||||
buffer++;
|
buffer++;
|
||||||
//waitForVBlank();
|
waitForVBlank();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void _print_console(const char *buffer){
|
void _print_console(const char *buffer){
|
||||||
|
|||||||
@ -40,22 +40,22 @@ DSTATUS disk_initialize (BYTE drv) {
|
|||||||
|
|
||||||
byte retval;
|
byte retval;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_initialize called drv=%i stat=%i\n",drv,Stat);
|
printfc("SNES::disk_initialize: called drv=%i stat=%i\n",drv,Stat);
|
||||||
#endif
|
#endif
|
||||||
if (drv) return STA_NOINIT; /* Supports only single drive */
|
if (drv) return STA_NOINIT; /* Supports only single drive */
|
||||||
Stat |= STA_NOINIT;
|
Stat |= STA_NOINIT;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_initialize stat=%i\n",Stat);
|
printfc("SNES::disk_initialize: stat=%i\n",Stat);
|
||||||
#endif
|
#endif
|
||||||
*(byte*) MMIO_RETVAL = STA_VOID;
|
*(byte*) MMIO_RETVAL = STA_VOID;
|
||||||
*(byte*) MMIO_CMD = CMD_INIT;
|
*(byte*) MMIO_CMD = CMD_INIT;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_initialize poll retval\n");
|
printfc("SNES::disk_initialize: poll retval\n");
|
||||||
#endif
|
#endif
|
||||||
while((retval = *(byte*) MMIO_RETVAL) == STA_VOID);
|
while((retval = *(byte*) MMIO_RETVAL) == STA_VOID);
|
||||||
Stat &= ~STA_NOINIT; /* When device goes ready, clear STA_NOINIT */
|
Stat &= ~STA_NOINIT; /* When device goes ready, clear STA_NOINIT */
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_initialize done Stat=%i\n",Stat);
|
printfc("SNES::disk_initialize: done Stat=%i\n",Stat);
|
||||||
#endif
|
#endif
|
||||||
return Stat;
|
return Stat;
|
||||||
}
|
}
|
||||||
@ -88,15 +88,15 @@ DRESULT disk_read (
|
|||||||
word i;
|
word i;
|
||||||
|
|
||||||
//#ifdef MMIO_DEBUG
|
//#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read called sector=%li count=%i\n",sector,count);
|
printfc("SNES::disk_read: sector=%li count=%i\n",sector,count);
|
||||||
//#endif
|
//#endif
|
||||||
if (drv || !count) return RES_PARERR;
|
if (drv || !count) return RES_PARERR;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read drv ok\n");
|
printfc("SNES::disk_read: drv ok\n");
|
||||||
#endif
|
#endif
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read sta ok\n");
|
printfc("SNES::disk_read: sta ok\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*(byte*) MMIO_RETVAL = STA_VOID;
|
*(byte*) MMIO_RETVAL = STA_VOID;
|
||||||
@ -110,13 +110,13 @@ DRESULT disk_read (
|
|||||||
*(byte*) MMIO_COUNT = count;
|
*(byte*) MMIO_COUNT = count;
|
||||||
|
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read poll retval\n");
|
printfc("SNES::disk_read: poll retval\n");
|
||||||
#endif
|
#endif
|
||||||
while((retval = *(byte*) MMIO_RETVAL) == STA_VOID);
|
while((retval = *(byte*) MMIO_RETVAL) == STA_VOID);
|
||||||
|
|
||||||
|
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read copy buffer to %lx\n",SHARED_ADDR);
|
printfc("SNES::disk_read: copy buffer to %lx\n",SHARED_ADDR);
|
||||||
#endif
|
#endif
|
||||||
for (i=0;i<(count*512);i++){
|
for (i=0;i<(count*512);i++){
|
||||||
buff[i] = *(byte*)(SHARED_ADDR+i);
|
buff[i] = *(byte*)(SHARED_ADDR+i);
|
||||||
|
|||||||
@ -17,6 +17,6 @@
|
|||||||
#define SHARED_MAX_SIZE 512
|
#define SHARED_MAX_SIZE 512
|
||||||
#define SHARED_ADDR 0x3d0000
|
#define SHARED_ADDR 0x3d0000
|
||||||
|
|
||||||
#undef MMIO_DEBUG
|
#define MMIO_DEBUG
|
||||||
#undef FATFS_DEBUG
|
#define FATFS_DEBUG
|
||||||
#define DISKIO_DEBUG 1
|
#define DISKIO_DEBUG 1
|
||||||
@ -102,7 +102,9 @@ void FATFS::mmio_write(unsigned addr, uint8 data) {
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
if (addr >= MMIO_SECTOR01 && addr <= MMIO_SECTOR04){
|
if (addr >= MMIO_SECTOR01 && addr <= MMIO_SECTOR04){
|
||||||
sector = data << ( (3 - ( addr - MMIO_SECTOR01)) << 3);
|
if (addr == MMIO_SECTOR01)
|
||||||
|
sector = 0;
|
||||||
|
sector |= data << ( (3 - ( addr - MMIO_SECTOR01)) << 3);
|
||||||
#ifdef FATFS_DEBUG
|
#ifdef FATFS_DEBUG
|
||||||
printf("BSNES::mmio_write set sector: byte=%i val=%i sector=%i \n",(3 - ( addr - MMIO_SECTOR01)),data,sector);
|
printf("BSNES::mmio_write set sector: byte=%i val=%i sector=%i \n",(3 - ( addr - MMIO_SECTOR01)),data,sector);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user