Anyway, here it is all wired up ready to go:
This is the Arduino program I wrote to talk to the Z80:
/* Zilog Z80 Controller */ const int CPU = 0; const int PIN = 1; const int DIR = 2; const int STS = 3; /* low states = true */ int CLK[4] = {06,13,OUTPUT,LOW}; // in int INT[4] = {16,0,OUTPUT,LOW}; // in int NMI[4] = {17,0,OUTPUT,LOW}; // in int HALT[4] = {18,12,INPUT,LOW}; // out int MREQ[4] = {19,11,INPUT,LOW}; // out int IORQ[4] = {20,10,INPUT,LOW}; // out int RD[4] = {21,9,INPUT,LOW}; // out int WR[4] = {22,8,INPUT,LOW}; // out int BUSACK[4] = {23,7,INPUT,LOW}; // out int WAIT[4] = {24,0,OUTPUT,LOW}; // in int BUSRQ[4] = {25,0,OUTPUT,LOW}; // in int RESET[4] = {26,6,OUTPUT,LOW}; // in int M1[4] = {27,5,INPUT,LOW}; // out int RFSH[4] = {28,4,INPUT,LOW}; // out int OLDM1[4] = {27,5,INPUT,LOW}; int T = 0; void setup() { // Define Pins pinMode(CLK[PIN], CLK[DIR]); pinMode(M1[PIN], M1[DIR]); pinMode(RESET[PIN], RESET[DIR]); pinMode(HALT[PIN], HALT[DIR]); pinMode(MREQ[PIN], MREQ[DIR]); pinMode(IORQ[PIN], IORQ[DIR]); pinMode(RD[PIN], RD[DIR]); pinMode(WR[PIN], WR[DIR]); pinMode(BUSACK[PIN], BUSACK[DIR]); pinMode(RFSH[PIN], RFSH[DIR]); // Setup Serial Port Serial.begin(9600); // Reset CPU Serial.println("CPU Reset"); delay(500); RESET[STS]=HIGH; digitalWrite(RESET[PIN],RESET[STS]); delay(2000); RESET[STS]=LOW; digitalWrite(RESET[PIN],RESET[STS]); } void loop() { //Start Clock Period T digitalWrite(CLK[PIN],CLK[STS]); delay(500); // Read Machine Cycle Status M Clock High M1[STS]=digitalRead(M1[PIN]); HALT[STS]=digitalRead(HALT[PIN]); MREQ[STS]=digitalRead(MREQ[PIN]); IORQ[STS]=digitalRead(IORQ[PIN]); RD[STS]=digitalRead(RD[PIN]); WR[STS]=digitalRead(WR[PIN]); BUSACK[STS]=digitalRead(BUSACK[PIN]); RFSH[STS]=digitalRead(RFSH[PIN]); Serial.print(T); Serial.print("="); Serial.print(CLK[STS]); Serial.print(" M1="); Serial.print(M1[STS]); Serial.print(" HALT="); Serial.print(HALT[STS]); Serial.print(" MREQ="); Serial.print(MREQ[STS]); Serial.print(" IORQ="); Serial.print(IORQ[STS]); Serial.print(" RD="); Serial.print(RD[STS]); Serial.print(" WR="); Serial.print(WR[STS]); Serial.print(" RFSH="); Serial.print(RFSH[STS]); Serial.print(" BUSACK="); Serial.print(BUSACK[STS]); Serial.println(); if(M1[STS]==HIGH && OLDM1[STS]==LOW) { Serial.println("----M1 Starts----"); } OLDM1[STS]=M1[STS]; CLK[STS]=!CLK[STS]; T=T+CLK[STS]; }
Can you please post a circuit diagram for this.
ReplyDeletewow
ReplyDelete