RACE/flash.h

41 lines
1.4 KiB
C
Raw Normal View History

2020-01-07 11:03:08 +00:00
/*---------------------------------------------------------------------------
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. See also the license.txt file for
* additional informations.
*---------------------------------------------------------------------------
*/
/*
* Flash chip emulation by Flavor
* with ideas from Koyote (who originally got ideas from Flavor :)
* for emulation of NGPC carts
*/
2016-10-14 17:01:29 +00:00
#define NO_COMMAND 0x00
#define COMMAND_BYTE_PROGRAM 0xA0
#define COMMAND_BLOCK_ERASE 0x30
#define COMMAND_CHIP_ERASE 0x10
#define COMMAND_INFO_READ 0x90
2020-01-07 11:03:08 +00:00
/* what command are we currently on (if any) */
extern unsigned char currentCommand;
2016-10-14 17:01:29 +00:00
2019-12-27 16:19:28 +00:00
void flashChipWrite(unsigned int addr, unsigned char data);
2020-01-07 11:03:08 +00:00
void vectFlashWrite(unsigned char chip, unsigned int to,
unsigned char *fromAddr, unsigned int numBytes);
2016-10-14 17:01:29 +00:00
void vectFlashErase(unsigned char chip, unsigned char blockNum);
void vectFlashChipErase(unsigned char chip);
2019-12-27 16:19:28 +00:00
void setFlashSize(unsigned int romSize);
2020-01-07 11:03:08 +00:00
void flashShutdown(void);
2019-12-27 16:19:28 +00:00
unsigned char flashReadInfo(unsigned int addr);
2016-10-14 17:01:29 +00:00
extern unsigned char needToWriteFile;
2020-01-07 11:03:08 +00:00
void writeSaveGameFile(void);
2016-10-14 17:01:29 +00:00
2020-01-07 11:03:08 +00:00
/* we found a dirty one, so write the file */
#define WRITE_SAVEGAME_IF_DIRTY if(needToWriteFile) writeSaveGameFile();
2016-10-14 17:01:29 +00:00