//address pins (note - cartridge interface starts at A1 so A[0] == A1, A[1] == A2 etc) int A[23] = {27,29,31,33,35,37,39,41,44,42,40,38,36,34,32,30,28,43,45,47,49,51,53}; //data pins int D[16] = {23,22,2,16,17,14,24,25,26,21,3,15, 52,50,48,46}; void resetAddressBus(){ for(byte i=0; i<23; i++){ pinMode(A[i], OUTPUT); digitalWrite(A[i], LOW); } } void writeAddress(long addr){ long mask = 1; for(int i=0; i<23; i++){ long test = (mask & addr) >> i; if(test == 1){ digitalWrite(A[i], HIGH); }else{ digitalWrite(A[i], LOW); } mask = mask << 1; } } word readData(){ word d = 0; word mask2 = 0b1; for(int i=0; i<16; i++){ int b = digitalRead(D[i]); if(b == HIGH){ d = d | mask2; } mask2 = mask2 << 1; } return d; } void setup(){ Serial.begin(9600); //Serial.println("setup()"); resetAddressBus(); for(int i=0; i<16; i++){ pinMode(D[i], INPUT); } Serial1.begin(9600); Serial1.print(0xFE, BYTE); Serial1.print(0x01, BYTE); Serial1.print(0xFE, BYTE); Serial1.print(0x80, BYTE); } long a = 0x80; // 0x100 start of 'SEGA' byte lcd[16] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' }; byte lcdcur = 0; void loop(){ //write a to the address bus writeAddress(a); delay(250); //read the data bus word d = readData(); //convert the 16 bit word to two bytes byte d2 = d & 0xFF; byte d1 = (d & 0xFF00) >> 8; if(d1 != 0){ Serial.print(d1); lcd[16-2] = d1; } lcdcur++; if(d2 != 0){ Serial.print(d2); lcd[16-1] = d2; } Serial1.print(0xFE, BYTE); Serial1.print(0x80, BYTE); //write to lcd for(byte i=0; i<16; i++){ Serial1.print(lcd[i]); } //shuffle down two for(byte i=0; i<(16-2); i++){ lcd[i] = lcd[i+2]; } lcdcur++; if(lcdcur == 16){ lcdcur = 0; } a++; //loop back to start when we hit a null if((d1 == 0) || (d2 == 0)){ a = 0x80; } }