After rewiring some parts of my breadboard, I finally managed reliable read/write

Biggest addition was 10K lift-up resistors on the data bus, this made it far more clear where the segments began and ended
equally further study revealed ADR00 has to be pulled high, and BHEN low for memory writes,
The Address Map as it stands now is:
0-1FF is still interrupt vectors,
200-FBFF is RAM,
FC00 - FDFF is a bus error

(011111100 on PROM)
FE00 - FFFF is the remainder of this chunk of RAM,
40000-4BFFF is system ROM
5FC00 - 5FDFF is RAM (System Registers)
which adds up for all the ROM and makes more sense, but leaves a small 1FF Gap missing from the RAM,
for the power supply, i ended up grabbing one of these from jaycar,
http://www.jaycar.com.au/productView.asp?ID=XC4258works very well for bread-boarding , just approaching too hot to touch at 700mA for long periods of time
So far the memory is looking ok write/read back and decay wise, and i am nutting out the code for testing for overwriting neighboring cells, here is the code as it stands, its a bit of a beast now, with common tasks broken into voids, and a few remaining variables for what i am working on, but it works.
unsigned long DAT = 0;
unsigned long ERRDAT = 0;
boolean flag = 0;
unsigned int RangeStart = 0;
unsigned int RangeStop = 0;
boolean prevfault = 0;
// 2x 74HC595
byte DI_PL = 2; // Parrellel Load
byte DI_CLK = 3; // Shift Clock
byte DI_SI = 4; // Serial Data Input to Arduino
// 3x 74HC165
byte AD_SO = 5; // Serial Address Output From Arduino
byte AD_SCLK = 6; // Shift Clock
byte AD_LCLK = 7; // Output Latch
// 2x 74HC595
byte DO_SO = 8; // Serial Data Output From Arduino
byte DO_SCLK = 9; // Shift Clock
byte DO_LCLK = 10; // Output Latch
byte DO_OE = 11; // Output Enable
// Card I/O
byte MEMR = 15; // Read From Memory Signal
byte MEMW = 12; // Write To RAM Signal
byte CCLK = 14; // ROM Delay Clock, Needs to be pulsed 3 times for valid output
void setup(){
// Parrellel to Serial Data (00:15)
pinMode(DI_PL, OUTPUT); // Parrellel Load
pinMode(DI_CLK, OUTPUT); // Clock
pinMode(DI_SI, INPUT); // Serial In
// Serial To Parrellel Address (00:19)
pinMode(AD_SO, OUTPUT); // Serial Out
pinMode(AD_SCLK, OUTPUT); // Shift Register Clock
pinMode(AD_LCLK,OUTPUT); // Latch Clock
// Serial To Parrellel Data (00:15)
pinMode(DO_SO, OUTPUT); // Serial Out
pinMode(DO_SCLK, OUTPUT); // Shift Register Clocl
pinMode(DO_LCLK, OUTPUT); // Latch Clock
pinMode(DO_OE, OUTPUT); // Output Enable
// Card I/O Signals
pinMode(MEMR, OUTPUT); // Memory Read (Inverted)
pinMode(MEMW, OUTPUT); // Memory Write (Inverted)
pinMode(CCLK, OUTPUT); // Clock for ROM Reading Delay (3+ Clocks for valid output)
// Bus is normally high,
digitalWrite(MEMR, HIGH); // Turns off Card Read
digitalWrite(MEMW, HIGH); // Turns off Card Write
digitalWrite(DO_OE, HIGH); // Disable outputs of data write, to prevent outputs driving outputs
Serial.begin(115200);
}
void loop() {
// Testing for decays
Serial.print("Testing Short Decay 00200-0FBFF FFFF");
Serial.println("");
ShortDecay (0x200,0xFC00,0xFFFF);
Serial.print("Testing Short Decay 0FE00-0FFFF FFFF");
Serial.println("");
ShortDecay (0xFE00,0x10000,0xFFFF);
Serial.print("Testing Short Decay 5FC00-5FDFF FFFF");
Serial.println("");
ShortDecay (0x5FC00,0x5FE00,0xFFFF);
Serial.print("Testing Long Decay 00200-0FBFF FFFF");
Serial.println("");
Verify (0x200,0xFC00,0xFFFF);
Serial.print("Testing Long Decay 0FE00-0FFFF FFFF");
Serial.println("");
Verify (0xFE00,0x10000,0xFFFF);
Serial.print("Testing Long Decay 5FC00-5FDFF FFFF");
Serial.println("");
Verify (0x5FC00,0x5FE00,0xFFFF);
Serial.print("Testing Short Decay 00200-0FBFF AAAA");
Serial.println("");
ShortDecay (0x200,0xFC00,0xAAAA);
Serial.print("Testing Short Decay 0FE00-0FFFF AAAA");
Serial.println("");
ShortDecay (0xFE00,0x10000,0xAAAA);
Serial.print("Testing Short Decay 5FC00-5FDFF AAAA");
Serial.println("");
ShortDecay (0x5FC00,0x5FE00,0xAAAA);
Serial.print("Testing Long Decay 00200-0FBFF AAAA");
Serial.println("");
Verify (0x200,0xFC00,0xAAAA);
Serial.print("Testing Long Decay 0FE00-0FFFF AAAA");
Serial.println("");
Verify (0xFE00,0x10000,0xAAAA);
Serial.print("Testing Long Decay 5FC00-5FDFF AAAA");
Serial.println("");
Verify (0x5FC00,0x5FE00,0xAAAA);
Serial.print("Testing Short Decay 00200-0FBFF 5555");
Serial.println("");
ShortDecay (0x200,0xFC00,0x5555);
Serial.print("Testing Short Decay 0FE00-0FFFF 5555");
Serial.println("");
ShortDecay (0xFE00,0x10000,0x5555);
Serial.print("Testing Short Decay 5FC00-5FDFF 5555");
Serial.println("");
ShortDecay (0x5FC00,0x5FE00,0x5555);
Serial.print("Testing Long Decay 00200-0FBFF 5555");
Serial.println("");
Verify (0x200,0xFC00,0x5555);
Serial.print("Testing Long Decay 0FE00-0FFFF 5555");
Serial.println("");
Verify (0xFE00,0x10000,0x5555);
Serial.print("Testing Long Decay 5FC00-5FDFF 5555");
Serial.println("");
Verify (0x5FC00,0x5FE00,0x5555);
Serial.print("Testing Short Decay 00200-0FBFF 0000");
Serial.println("");
ShortDecay (0x200,0xFC00,0x0);
Serial.print("Testing Short Decay 0FE00-0FFFF 0000");
Serial.println("");
ShortDecay (0xFE00,0x10000,0x0);
Serial.print("Testing Short Decay 5FC00-5FDFF 0000");
Serial.println("");
ShortDecay (0x5FC00,0x5FE00,0x0);
Serial.print("Testing Long Decay 00200-0FBFF 0000");
Serial.println("");
Verify (0x200,0xFC00,0x0);
Serial.print("Testing Long Decay 0FE00-0FFFF 0000");
Serial.println("");
Verify (0xFE00,0x10000,0x0);
Serial.print("Testing Long Decay 5FC00-5FDFF 00000");
Serial.println("");
Verify (0x5FC00,0x5FE00,0x0);
}
void ShortDecay (unsigned long Start, unsigned long Stop, unsigned int Data) { // Writes value, reads it back and compares
prevfault = 0;
for(unsigned long ADDR=Start; ADDR < Stop; ADDR++) { // Write 1 to every location
flag = 0;
Address(ADDR); // Write out the current address
DataOut(Data); // Write out a test value to RAM
RAMIn(); // Read back in value from RAM
if(DAT == !Data) { // Test to see that it matches
flag = 1;
}
if(prevfault == 0 && flag == 1) { // Determine Range of Fault to reduce serial comms usage
prevfault = 1;
RangeStart = ADDR;
}
else if (prevfault == 1 && flag == 0 || prevfault == 1 && ADDR == (Stop-1)) {
RangeStop = ADDR;
prevfault = 0;
PrintRange(RangeStart,RangeStop,0);
RangeStart = 0;
RangeStop = 0;
}
}
}
void Verify (unsigned long Start, unsigned long Stop, unsigned int Data) { // Reads back value and compares
prevfault = 0;
for(unsigned long ADDR=Start; ADDR < Stop; ADDR++) { // Write 1 to every location
flag = 0;
Address(ADDR); // Write out the current address
RAMIn(); // Read back in value from RAM
if(DAT == !Data) { // Test to see that it matches
flag = 1;
}
if(prevfault == 0 && flag == 1) { // Determines range of fault
prevfault = 1;
RangeStart = ADDR;
}
else if (prevfault == 1 && flag == 0 || prevfault == 1 && ADDR == (Stop-1)) {
RangeStop = ADDR;
prevfault = 0;
PrintRange(RangeStart,RangeStop,1);
RangeStart = 0;
RangeStop = 0;
}
}
}
void Print (unsigned long ADDRP, int error) { // Prints the address and read data of an error
if ( ADDRP < 0x10 ) { Serial.print("0000");} // Adds leading 0's
else if ( ADDRP < 0x100 ) { Serial.print("000"); }
else if ( ADDRP < 0x1000 ) { Serial.print("00"); }
else if ( ADDRP < 0x10000) { Serial.print("0"); }
Serial.print(ADDRP, HEX);
Serial.print(" => ");
if ( ERRDAT < 0x10 ) { Serial.print("000"); } // Adds leading 0's
else if ( ERRDAT < 0x100 ) { Serial.print("00"); }
else if ( ERRDAT < 0x1000) { Serial.print("0"); }
Serial.print(ERRDAT, HEX);
if (error == 0) { Serial.print(" Quick Decay"); } // Prints Error Type
else if (error == 1) { Serial.print(" Slow Decay"); }
else if (error == 2) { Serial.print(" Overwrote Near Neighbour"); }
else if (error == 3) { Serial.print(" Overwrote Far Neighbour"); }
Serial.println("");
}
void PrintRange (unsigned long Start, unsigned long Stop, int error) { // Prints the range of an error
if ( Start < 0x10 ) { Serial.print("0000");} // Adds leading 0's
else if ( Start < 0x100 ) { Serial.print("000"); }
else if ( Start < 0x1000 ) { Serial.print("00"); }
else if ( Start < 0x10000) { Serial.print("0"); }
Serial.print(Start, HEX);
Serial.print(" to ");
if ( Stop < 0x10 ) { Serial.print("0000");} // Adds leading 0's
else if ( Stop < 0x100 ) { Serial.print("000"); }
else if ( Stop < 0x1000 ) { Serial.print("00"); }
else if ( Stop < 0x10000) { Serial.print("0"); }
Serial.print(Stop, HEX);
if (error == 0) { Serial.print(" Quick Decay"); } // Prints Error Type
else if (error == 1) { Serial.print(" Slow Decay"); }
else if (error == 2) { Serial.print(" Overwrote Near Neighbour"); }
else if (error == 3) { Serial.print(" Overwrote Far Neighbour"); }
Serial.println("");
}
void Clock(int Pin) { // Rising Edge Clock Function
digitalWrite(Pin, LOW);
digitalWrite(Pin, HIGH);
}
void Address(unsigned long ADR) { // Shift In Address
for(unsigned int A=0; A<21; A++) { // ADDR0 is ignored so data is shifter up 1,
if(bitRead(ADR,(19-A))== 0) { digitalWrite(AD_SO,HIGH); } // Address bus is inverted
else { digitalWrite(AD_SO,LOW); }
Clock(AD_SCLK); // Clock Shift Register
}
Clock(AD_LCLK); // Latch Output of shift register
}
void ROMIn() {
digitalWrite(MEMR, LOW); // Tells the card data will be read
Clock(CCLK); // Enables read output latch on card
Clock(CCLK);
Clock(CCLK);
Clock(CCLK);
Clock(DI_PL); // Load the contents of the bus
for(int D=0; D<16; D++) { // Clock in the data on the bus
bitWrite(DAT, (15-D), !digitalRead(DI_SI));
Clock(DI_CLK);
}
digitalWrite(MEMR, HIGH); // Tell the card its no longer being read from
}
void RAMIn() {
digitalWrite(MEMR, LOW); // Tells the card data will be read
Clock(DI_PL); // Load the contents of the bus
for(int D=0; D<16; D++) { // Clock in the data on the bus
bitWrite(DAT, (15-D), !digitalRead(DI_SI));
Clock(DI_CLK);
}
digitalWrite(MEMR, HIGH); // Tell the card its no longer being read from
}
void DataOut(unsigned long DATA) { // Shift out data
digitalWrite(DO_OE, LOW); // Enable Shift Register Outputs
for(int D=0; D<16; D++) { // One by one clock out 16 bits
if(bitRead(DATA,(15-D)) == 0) { digitalWrite(DO_SO,HIGH); } // Bus is inverted
else { digitalWrite(DO_SO,LOW); }
Clock(DO_SCLK); // Clock the shift Register
}
Clock(DO_LCLK); // Clock The latch
digitalWrite( MEMW, LOW); // Tell the card its being Written to
digitalWrite(MEMW, HIGH); // Tell the card its no longer being written to
digitalWrite(DO_OE, HIGH); // Tristate shift register outputs
}
if anyone can think of other tests i can perform on this board before i call it working, it would be appreciated
