mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-14 17:05:08 +01:00
Fix compiler warnings/errors
This commit is contained in:
parent
edc2b2fa15
commit
06243694d4
@ -291,7 +291,7 @@ void writeData3F_2600(uint16_t addr, uint8_t data) {
|
||||
boolean checkE7(uint16_t bank) {
|
||||
writeData_2600(0x1800, 0xFF);
|
||||
readData_2600(0x1FE0 + bank);
|
||||
uint32_t testdata = (readData_2600(0x1000) << 24) | (readData_2600(0x1001) << 16) | (readData_2600(0x1002) << 8) | (readData_2600(0x1003));
|
||||
uint32_t testdata = ((uint32_t)readData_2600(0x1000) << 24) | ((uint32_t)readData_2600(0x1001) << 16) | (readData_2600(0x1002) << 8) | (readData_2600(0x1003));
|
||||
return (testdata == 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,8 @@
|
||||
Uzlopak, sakman55, Tombo89, scrap-a, borti4938, vogelfreiheit, CaitSith2, Modman, Chomemel,
|
||||
philenotfound, karimhadjsalem, nsx0r, ducky92, niklasweber, Lesserkuma, BacteriaMage, qufb,
|
||||
vpelletier, Ancyker, mattiacci, RWeick, ButThouMust, partlyhuman, fakkuyuu, hxlnt, breyell,
|
||||
smesgr9000, joshman196, PsychoFox11, plaidpants, LuigiBlood, InvalidInterrupt
|
||||
smesgr9000, joshman196, PsychoFox11, plaidpants, LuigiBlood, InvalidInterrupt, andy-miles,
|
||||
wfmarques
|
||||
|
||||
And to nocash for figuring out the secrets of the SFC Nintendo Power cartridge.
|
||||
|
||||
|
@ -129,8 +129,7 @@ void jagMenu() {
|
||||
fileBrowser(FS(FSTRING_SELECT_FILE));
|
||||
display_Clear();
|
||||
writeJagEEP();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("Cart has no EEPROM"));
|
||||
display.display();
|
||||
}
|
||||
@ -157,8 +156,7 @@ void jagMenu() {
|
||||
display_Clear();
|
||||
writeJagFLASH();
|
||||
verifyJagFLASH();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("Cart has no FLASH"));
|
||||
display.display();
|
||||
}
|
||||
@ -426,8 +424,7 @@ void setup_Jag() {
|
||||
strcpy(romName, "jagMemorytrack");
|
||||
jagCartSize = 0x20000;
|
||||
jagflaSize = 0x20000;
|
||||
}
|
||||
else
|
||||
} else
|
||||
setCart_Jag();
|
||||
getJagCartInfo();
|
||||
|
||||
@ -448,8 +445,7 @@ void getJagCartInfo() {
|
||||
if (jagMemorytrack) {
|
||||
print_Msg(jagCartSize / 1024);
|
||||
println_Msg(F(" KB"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
print_Msg(jagCartSize / 1024 / 1024);
|
||||
println_Msg(F(" MB"));
|
||||
@ -458,8 +454,7 @@ void getJagCartInfo() {
|
||||
print_Msg(F("EEPROM: "));
|
||||
print_Msg(int_pow(2, jagEepSize) * 128); // 128/256/512/1024/2048 BYTES
|
||||
println_Msg(F(" B"));
|
||||
}
|
||||
else if (jagSaveType == 1) {
|
||||
} else if (jagSaveType == 1) {
|
||||
print_Msg(F("FLASH: "));
|
||||
print_Msg(jagflaSize / 1024);
|
||||
println_Msg(F(" KB"));
|
||||
@ -500,8 +495,7 @@ void shiftOutFAST(byte addr) { //
|
||||
CLOCK_CLEAR;
|
||||
if (addr & (1 << i)) {
|
||||
SER_SET; // 1
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SER_CLEAR; // 0
|
||||
}
|
||||
CLOCK_SET; // shift bit
|
||||
@ -532,7 +526,18 @@ void readJagData(unsigned long myAddress) {
|
||||
PORTH &= ~(1 << 3) & ~(1 << 4);
|
||||
|
||||
// Long delay here or there will be read errors
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read
|
||||
tempDataLO = (((PINK & 0xFF) << 8) | (PINF & 0xFF)); // D0-D15 [ROM U1]
|
||||
@ -542,7 +547,12 @@ void readJagData(unsigned long myAddress) {
|
||||
PORTH |= (1 << 3) | (1 << 4);
|
||||
// Setting CE(PH5) HIGH
|
||||
PORTH |= (1 << 5);
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
SRCLR_CLEAR;
|
||||
}
|
||||
@ -739,8 +749,7 @@ void EepromWriteData(void) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (((UPPER >> 7) & 0x1) == 1) { // Bit is HIGH
|
||||
Eeprom1();
|
||||
}
|
||||
else { // Bit is LOW
|
||||
} else { // Bit is LOW
|
||||
Eeprom0();
|
||||
}
|
||||
// rotate to the next bit
|
||||
@ -749,8 +758,7 @@ void EepromWriteData(void) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (((LOWER >> 7) & 0x1) == 1) { // Bit is HIGH
|
||||
Eeprom1();
|
||||
}
|
||||
else { // Bit is LOW
|
||||
} else { // Bit is LOW
|
||||
Eeprom0();
|
||||
}
|
||||
// rotate to the next bit
|
||||
@ -763,8 +771,7 @@ void jagEepromSetAddress(uint16_t addr) { // 16bit
|
||||
for (int i = 0; i < shiftaddr; i++) {
|
||||
if (((addr >> shiftaddr) & 1) == 1) { // Bit is HIGH
|
||||
Eeprom1();
|
||||
}
|
||||
else { // Bit is LOW
|
||||
} else { // Bit is LOW
|
||||
Eeprom0();
|
||||
}
|
||||
// rotate to the next bit
|
||||
@ -800,7 +807,9 @@ void EepromEWEN(void) { // EWEN 10011xxxx
|
||||
}
|
||||
EEP_CS_CLEAR;
|
||||
_delay_us(2);
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("ERASE ENABLED"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void EepromERAL(void) { // ERASE ALL 10010xxxx
|
||||
@ -827,7 +836,9 @@ void EepromERAL(void) { // ERASE ALL 10010xxxx
|
||||
}
|
||||
EEP_CS_CLEAR;
|
||||
jagEepromStatus();
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("ERASED ALL"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void EepromEWDS(void) { // DISABLE 10000xxxx
|
||||
@ -855,21 +866,24 @@ void EepromEWDS(void) { // DISABLE 10000xxxx
|
||||
}
|
||||
EEP_CS_CLEAR;
|
||||
_delay_us(2);
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("ERASE DISABLED"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void jagEepromStatus(void) { // CHECK READY/BUSY
|
||||
__asm__("nop\n\t""nop\n\t"); // CS LOW for minimum 100ns
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"); // CS LOW for minimum 100ns
|
||||
EEP_CS_SET;
|
||||
boolean status = ((PINA & 0x20) >> 5); // Check DO
|
||||
do {
|
||||
_delay_ms(1);
|
||||
status = ((PINA & 0x20) >> 5);
|
||||
}
|
||||
while (!status); // status == 0 = BUSY
|
||||
} while (!status); // status == 0 = BUSY
|
||||
EEP_CS_CLEAR;
|
||||
}
|
||||
|
||||
#ifdef SERIAL_MONITOR
|
||||
void EepromDisplay() { // FOR SERIAL ONLY
|
||||
word eepEnd = int_pow(2, jagEepSize) * 128;
|
||||
for (word address = 0; address < eepEnd; address += 2) {
|
||||
@ -888,7 +902,7 @@ void EepromDisplay(){ // FOR SERIAL ONLY
|
||||
Serial.println(F(""));
|
||||
Serial.println(F(""));
|
||||
}
|
||||
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
// EEPROM
|
||||
// (0) 93C46 128B STANDARD
|
||||
@ -935,8 +949,7 @@ void readJagEEP() {
|
||||
}
|
||||
myFile.write(sdBuffer, 512);
|
||||
}
|
||||
}
|
||||
else { // 93C46/93C56 - 64/128 WORDS
|
||||
} else { // 93C46/93C56 - 64/128 WORDS
|
||||
for (word currWord = 0; currWord < eepEnd; currWord++) {
|
||||
EepromRead(currWord * 2);
|
||||
sdBuffer[(currWord * 2)] = jagEepBuf[1];
|
||||
@ -966,7 +979,9 @@ void writeJagEEP() {
|
||||
if (myFile.open(filePath, O_READ)) {
|
||||
EepromEWEN(); // ERASE/WRITE ENABLE
|
||||
EepromERAL(); // ERASE ALL
|
||||
#ifdef SERIAL_MONITOR
|
||||
Serial.println(F("WRITING"));
|
||||
#endif
|
||||
word eepEnd = int_pow(2, jagEepSize) * 64; // WORDS
|
||||
if (jagEepSize > 1) { // 93C66/93C76/93C86
|
||||
for (word currWord = 0; currWord < eepEnd; currWord += 256) {
|
||||
@ -977,8 +992,7 @@ void writeJagEEP() {
|
||||
EepromWrite((currWord + i) * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // 93C46/93C56
|
||||
} else { // 93C46/93C56
|
||||
myFile.read(sdBuffer, eepEnd * 2);
|
||||
for (word currWord = 0; currWord < eepEnd; currWord++) {
|
||||
jagEepBuf[0] = sdBuffer[currWord * 2];
|
||||
@ -993,8 +1007,7 @@ void writeJagEEP() {
|
||||
println_Msg(F(""));
|
||||
println_Msg(F("DONE"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("SD ERROR"));
|
||||
println_Msg(F("Press Button to Reset"));
|
||||
display_Update();
|
||||
@ -1074,13 +1087,23 @@ void busyCheck() {
|
||||
PORTH |= (1 << 5);
|
||||
|
||||
// Leave CE high for at least 60ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
|
||||
// Leave CE low for at least 50ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read register
|
||||
readBYTE_FLASH(0x0000);
|
||||
@ -1100,7 +1123,12 @@ byte readBYTE_FLASH(unsigned long myAddress) {
|
||||
LATCH_SET;
|
||||
|
||||
// Arduino running at 16Mhz -> one nop = 62.5ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
@ -1109,7 +1137,18 @@ byte readBYTE_FLASH(unsigned long myAddress) {
|
||||
// Setting OEL(PH4) LOW
|
||||
PORTH &= ~(1 << 4);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read
|
||||
byte tempByte = PINL; // D16..D23
|
||||
@ -1119,7 +1158,12 @@ byte readBYTE_FLASH(unsigned long myAddress) {
|
||||
// Setting OEL(PH4) HIGH
|
||||
PORTH |= (1 << 4);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
return tempByte;
|
||||
}
|
||||
@ -1134,14 +1178,30 @@ byte readBYTE_MEMROM(unsigned long myAddress) {
|
||||
LATCH_SET;
|
||||
|
||||
// Arduino running at 16Mhz -> one nop = 62.5ns
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting CE(PH5) LOW
|
||||
PORTH &= ~(1 << 5);
|
||||
// Setting OEH(PH3) LOW
|
||||
PORTH &= ~(1 << 3);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Read
|
||||
byte tempByte = PINF; // D0..D7
|
||||
@ -1151,7 +1211,12 @@ byte readBYTE_MEMROM(unsigned long myAddress) {
|
||||
// Setting OEH(PH3) HIGH
|
||||
PORTH |= (1 << 3);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
return tempByte;
|
||||
}
|
||||
@ -1167,7 +1232,12 @@ void writeBYTE_FLASH(unsigned long myAddress, byte myData) {
|
||||
|
||||
PORTL = myData;
|
||||
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting OEL(PH4) HIGH
|
||||
PORTH |= (1 << 4);
|
||||
@ -1202,7 +1272,12 @@ void writeSECTOR_FLASH(unsigned long myAddress) {
|
||||
LATCH_SET;
|
||||
|
||||
PORTL = sdBuffer[i];
|
||||
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
|
||||
// Setting OEL(PH4) HIGH
|
||||
// PORTH |= (1 << 4);
|
||||
@ -1210,14 +1285,16 @@ void writeSECTOR_FLASH(unsigned long myAddress) {
|
||||
PORTH &= ~(1 << 5);
|
||||
// Switch WE(PH6) LOW
|
||||
PORTH &= ~(1 << 6);
|
||||
__asm__("nop\n\t""nop\n\t"); // Minimum 90ns
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"); // Minimum 90ns
|
||||
|
||||
// Switch WE(PH6) HIGH
|
||||
PORTH |= (1 << 6);
|
||||
// Setting CE(PH5) HIGH
|
||||
PORTH |= (1 << 5);
|
||||
|
||||
__asm__("nop\n\t""nop\n\t"); // Minimum 100ns
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"); // Minimum 100ns
|
||||
}
|
||||
delay(30);
|
||||
}
|
||||
@ -1283,7 +1360,6 @@ void readJagMEMORY() {
|
||||
|
||||
println_Msg(F("Press Button..."));
|
||||
wait();
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
@ -1384,8 +1460,7 @@ void writeJagFLASH() {
|
||||
myFile.close();
|
||||
println_Msg(F("WRITE COMPLETE"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("SD ERROR"));
|
||||
println_Msg(F("Press Button to Reset"));
|
||||
display_Update();
|
||||
@ -1418,8 +1493,7 @@ unsigned long verifyJagFLASH() {
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
println_Msg(F("SD ERROR"));
|
||||
println_Msg(F("Press Button to Reset"));
|
||||
display_Update();
|
||||
@ -1459,7 +1533,6 @@ void writeConfirm() {
|
||||
wait();
|
||||
resetArduino();
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
//******************************************
|
||||
|
@ -105,7 +105,7 @@ byte ljprosize;
|
||||
byte newljprosize;
|
||||
|
||||
char mnfID[3];
|
||||
char deviceID[5];
|
||||
char deviceID_str[5];
|
||||
boolean ljproflash1found = false;
|
||||
boolean ljproflash2found = false;
|
||||
byte ljproflash1size;
|
||||
@ -346,18 +346,18 @@ void readID_U1() // Parallel Mode
|
||||
CS1_HIGH; // U1 HIGH
|
||||
// Flash ID
|
||||
sprintf(mnfID, "%02X", id0);
|
||||
sprintf(deviceID, "%02X%02X", id1, id2);
|
||||
sprintf(deviceID_str, "%02X%02X", id1, id2);
|
||||
// println_Msg(mnfID);
|
||||
// println_Msg(deviceID);
|
||||
// println_Msg(deviceID_str);
|
||||
// display_Update();
|
||||
if(strcmp(deviceID, "2015") == 0) { // MX25L1605
|
||||
if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
|
||||
ljproflash1found = 1;
|
||||
ljproflash1size = 2;
|
||||
display_Clear();
|
||||
println_Msg(F("U1 MX25L1605 FOUND"));
|
||||
display_Update();
|
||||
}
|
||||
else if (strcmp(deviceID, "2016") == 0) { // MX25L3205
|
||||
else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
|
||||
ljproflash1found = 1;
|
||||
ljproflash1size = 4;
|
||||
display_Clear();
|
||||
@ -380,17 +380,17 @@ void readID_U2() // Parallel Mode
|
||||
CS2_HIGH; // U2 HIGH
|
||||
// Flash ID
|
||||
sprintf(mnfID, "%02X", id0);
|
||||
sprintf(deviceID, "%02X%02X", id1, id2);
|
||||
sprintf(deviceID_str, "%02X%02X", id1, id2);
|
||||
// println_Msg(mnfID);
|
||||
// println_Msg(deviceID);
|
||||
// println_Msg(deviceID_str);
|
||||
// display_Update();
|
||||
if(strcmp(deviceID, "2015") == 0) { // MX25L1605
|
||||
if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
|
||||
ljproflash2found = 1;
|
||||
ljproflash2size = 2;
|
||||
println_Msg(F("U2 MX25L1605 FOUND"));
|
||||
display_Update();
|
||||
}
|
||||
else if (strcmp(deviceID, "2016") == 0) { // MX25L3205
|
||||
else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
|
||||
ljproflash2found = 1;
|
||||
ljproflash2size = 4;
|
||||
println_Msg(F("U2 MX25L3205 FOUND"));
|
||||
|
@ -76,10 +76,10 @@
|
||||
#define NAND_1A_LOW PORTH &= ~(1 << 3)
|
||||
#define NAND_1B_HIGH PORTH |= (1 << 4)
|
||||
#define NAND_1B_LOW PORTH &= ~(1 << 4) // Built-in RAM + I/O
|
||||
#define WE_HIGH PORTH |= (1 << 5)
|
||||
#define WE_LOW PORTH &= ~(1 << 5)
|
||||
#define OE_HIGH PORTH |= (1 << 6)
|
||||
#define OE_LOW PORTH &= ~(1 << 6)
|
||||
#define WE_HIGH_PCW PORTH |= (1 << 5)
|
||||
#define WE_LOW_PCW PORTH &= ~(1 << 5)
|
||||
#define OE_HIGH_PCW PORTH |= (1 << 6)
|
||||
#define OE_LOW_PCW PORTH &= ~(1 << 6)
|
||||
|
||||
#define MODE_READ DDRC = 0 // [INPUT]
|
||||
#define MODE_WRITE DDRC = 0xFF //[OUTPUT]
|
||||
@ -207,8 +207,8 @@ void read_setup_PCW()
|
||||
{
|
||||
NAND_1A_HIGH;
|
||||
NAND_1B_HIGH;
|
||||
OE_HIGH;
|
||||
WE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
WE_HIGH_PCW;
|
||||
LE_LOW;
|
||||
}
|
||||
|
||||
@ -226,11 +226,11 @@ unsigned char read_rom_byte_PCW(unsigned long address)
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t");
|
||||
// Read Data on AD0-AD7
|
||||
OE_LOW;
|
||||
OE_LOW_PCW;
|
||||
DATA_READ;
|
||||
delayMicroseconds(5); // 3+ Microseconds for Problem Carts
|
||||
unsigned char data = PINC;
|
||||
OE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -254,7 +254,7 @@ unsigned char read_ram_byte_1A_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
// Read Data on AD0-AD7
|
||||
OE_LOW;
|
||||
OE_LOW_PCW;
|
||||
DATA_READ;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -263,7 +263,7 @@ unsigned char read_ram_byte_1A_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
unsigned char data = PINC;
|
||||
OE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
NAND_1A_HIGH;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -300,7 +300,7 @@ unsigned char read_ram_byte_1B_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
// Read Data on AD0-AD7
|
||||
OE_LOW;
|
||||
OE_LOW_PCW;
|
||||
DATA_READ;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -309,7 +309,7 @@ unsigned char read_ram_byte_1B_PCW(unsigned long address)
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
unsigned char data = PINC;
|
||||
OE_HIGH;
|
||||
OE_HIGH_PCW;
|
||||
NAND_1B_HIGH;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -333,13 +333,13 @@ void write_ram_byte_1A_PCW(unsigned long address, unsigned char data)
|
||||
PORTC = address & 0xFF; // A0-A7
|
||||
LE_LOW; // Address Latched
|
||||
// Write Data on AD0-AD7 - WE LOW ~240-248ns
|
||||
WE_LOW;
|
||||
WE_LOW_PCW;
|
||||
PORTC = data;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
WE_HIGH;
|
||||
WE_HIGH_PCW;
|
||||
NAND_1A_HIGH;
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ void write_ram_byte_1B_PCW(unsigned long address, unsigned char data)
|
||||
PORTC = address & 0xFF; // A0-A7
|
||||
LE_LOW; // Address Latched
|
||||
// Write Data on AD0-AD7 - WE LOW ~740ns
|
||||
WE_LOW;
|
||||
WE_LOW_PCW;
|
||||
PORTC = data;
|
||||
__asm__("nop\n\t"
|
||||
"nop\n\t"
|
||||
@ -370,7 +370,7 @@ void write_ram_byte_1B_PCW(unsigned long address, unsigned char data)
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t");
|
||||
WE_HIGH;
|
||||
WE_HIGH_PCW;
|
||||
NAND_1B_HIGH;
|
||||
}
|
||||
|
||||
@ -540,13 +540,13 @@ void write_bank_byte_PCW(unsigned char data)
|
||||
PORTC = 0xFF; // A0-A7
|
||||
LE_LOW; // Address Latched
|
||||
// Write Data on AD0-AD7 - WE LOW ~728-736ns
|
||||
WE_LOW;
|
||||
WE_LOW_PCW;
|
||||
PORTC = data;
|
||||
|
||||
for (unsigned int x = 0; x < 40; x++)
|
||||
__asm__("nop\n\t");
|
||||
|
||||
WE_HIGH;
|
||||
WE_HIGH_PCW;
|
||||
NAND_1B_HIGH;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user