Now I've studied more.
I only have multigame carts which have 20 instead of 17 ADR lines. No problem as I need 3 shifting devices anyway.
This PCB rev has a slightly different pinout. But the slot still must be compatible to all carts.
I think I can use 2 Gameboy slots but I want to know the dumping speed with the given schematics as I don't kow how long I can keep the 2 slots attached stable.
I made a project with fritzing. Someone told it wouldn't work.
And I also wrote a code (someone told it should work) but I'm not sure about many things. Questions are in the code.
Can someone please have a look?
// Gameking cart reader ino sketch by Gamekin. Mostly snippets from other sources
//1 game carts have 17 Adress lines (128 K), 4in1 carts 20. So need to read up to 1 MB
//Some pin functions are unknown or unsure. So can only use CE, not OE. And use 3V.
//No RAM no EEPROMs just 1 ROM glob top. 3x74HC595, so I think I have to read 3 Bytes each loop.
#include "pins_arduino.h"
//taken from Atariromreader unknown if needed
//Pin connected to ST_CP of 74HC595
int latchPin = 10; //Latch, SS ? might be changed, but ProMini has limited pins
//Pin connected to SH_CP of 74HC595
int clockPin = 13; //SCK
////Pin connected to DS of 74HC595
int dataPin = 11; // MOSI
int d0Pin = 2; //necessary ? most don't have this, but I have wired this
int d1Pin = 3;
int d2Pin = 4;
int d3Pin = 5;
int d4Pin = 6;
int d5Pin = 7;
int d6Pin = 8;
int d7Pin = 9;
//Arduino ProMini has internal pull-up resistors, also for data lines. Unsure if I should use them.
//digitalWrite(d0Pin, HIGH); d0-7, digitalWrite(irqPin, HIGH); would activate them
//a buffer for bytes to burn
#define ROM_SIZE 1048576
// in bytes
// byte buffer[ROM_SIZE]; -used by other sketch. Overflow in array dimension error with this value
int data = 0; //Used in counting up to the ROM's maximum byte
byte myByte = 0x00; // Used later as D0-D7 byte
//unknown if need more definitions like irqPin. What about CE (at the 74HC595) and SRCLR?
void setup(){
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT); // ---one code says INPUT, but maybe later
}
void data_bus_input() {
pinMode(d0Pin, INPUT);
pinMode(d1Pin, INPUT);
pinMode(d2Pin, INPUT);
pinMode(d3Pin, INPUT);
pinMode(d4Pin, INPUT);
pinMode(d5Pin, INPUT);
pinMode(d6Pin, INPUT);
pinMode(d7Pin, INPUT);
}
//switch IO lines of databus to OUTPUT state
void data_bus_output() {
pinMode(d0Pin, OUTPUT);
pinMode(d1Pin, OUTPUT);
pinMode(d2Pin, OUTPUT);
pinMode(d3Pin, OUTPUT);
pinMode(d4Pin, OUTPUT);
pinMode(d5Pin, OUTPUT);
pinMode(d6Pin, OUTPUT);
pinMode(d7Pin, OUTPUT);
}
//set databus to input and read a complete byte from the bus
//be sure to set data_bus to input before
byte read_data_bus(){
Serial.begin(9600); //unsure if speed can be higher, unknown if FTDI drivers needs other than serial, unsure if serial.begin before pinmode
}
void loop() {
while (Serial.available() <=0){
delay (200);
}
//for (int i=0; i<24; i++){ // 3x8 bits ?? first attempt from other sketch
//void shiftOut24bit(int clockPin, int latchPin, int dataPin, unsigned long value) { //taken from sgcexplorer
//digitalWrite(latchPin, LOW);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x00FF0000) >> 16);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x0000FF00) >> 8);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x000000FF));
//digitalWrite(latchPin, HIGH);
digitalWrite(latchPin, LOW); //make shift reg listen
if (data < ROM_SIZE) { //Do I need to open a file and filename before?
shiftOut(dataPin, clockPin, MSBFIRST, (data >> 16)); //read 3 Bytes and shift. binary output
shiftOut(dataPin, clockPin, MSBFIRST, data >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, data);
digitalWrite(latchPin, HIGH);
delay(5);
myByte = d7Pin //originally called myDigitalRead (9), data pin 9-2
| d6Pin <<1
| d5Pin <<2
| d4Pin <<3
| d3Pin <<4
| d2Pin <<5
| d1Pin <<6
| d0Pin <<7;
Serial.write(myByte);
data++;
delay (5);
//digitalWrite(latchPin, LOW);
}
}