Hello z80 with arduino

hello
i wanna make z80 with arduino mega2560

how to wiring z80 with mega2560


where REFSH and M1 RESET BUSRQ WAIT BUSAK WR RD
AND INT NMI HALT MREQ IORQ in arduino ?
where z80 example site?

Why did you post this in the Portenta section of the forum and what exactly are you trying to do ?

i wanna make retro computer with z80

//
// This sketch uses code on the Z80 to write a greeting to the serial-console.
//
// We let this program run for a few thousand cycles, which should be
// sufficient to allow the text-output, "Hello\n", to complete.
//
// Steve
//

#include <z80retroshield.h>

//
// Our program, as hex.
//
// The source code is located in hello.z80.
//
unsigned char memory[32] =
{
0x3e, 0x48, 0xd3, 0x01, 0x3e, 0x65, 0xd3, 0x01, 0x3e, 0x6c, 0xd3, 0x01,
0xd3, 0x01, 0x3e, 0x6f, 0xd3, 0x01, 0x3e, 0x0a, 0xd3, 0x01, 0xc3, 0x16,
0x00
};
int memory_len = sizeof(memory) / sizeof(memory[0]);

//
// Our helper
//
Z80RetroShield cpu;

//
// RAM I/O function handler.
//
char memory_read(int address)
{
return (memory[address]);
}

//
// I/O function handler.
//
void io_write(int address, char byte)
{
if (address == 1)
Serial.write(byte);
}

//
// Setup routine: Called once.
//
void setup()
{
Serial.begin(115200);

//
// Setup callbacks.
//
// We must setup a memory-read callback, otherwise the program
// won't be fetched and executed.
//
cpu.set_memory_read(memory_read);

//
// Then we setup a callback to be executed every time an "out (x),y"
// instruction is encountered.
//
cpu.set_io_write(io_write);

//
// Configured.
//
Serial.println("Z80 configured; launching program.");

}

//
// Loop function: Called forever.
//
void loop()
{
//
// We stop running after a specific number of cycles
//
// Have we reached that point?
//
static bool done = false;

//
// Count the number of times we've pumped the Z80.
//
static int cycles = 0;

//
// Are we done?  If so return.
//
if (done)
    return;

//
// We stop running after running a specific number of cycles
//
if (cycles > 4096)
{
    Serial.print("Z80 processor stopped ");
    Serial.print(cycles);
    Serial.println(" cycles executed.");
    done = true;
    return;
}

//
// Step the CPU.
//
cpu.Tick();

//
// We've run a tick.
//
cycles++;

}

Why did you post this in the Portenta section of the forum ?

An Arduino does not have most of these pins. Connect to GPIO pins and write code to generate all signals as expected by the Z80. Also write code to emulate required Z80 peripherals (UART...)

then how to wiring


tell me pin number z80 to mega2560

It is up to you to decide which pins to use and to write the code to use them as appropriate

Have you spent any time with the Z80 data sheet? Also the diagram you posted in reply #6, appears to show the wiring that you are asking for.

no i don't read z80 data sheet
what's read z80 data sheet?
i don't see "hello world character"in mega2560


i see this capture png

Do you know what a Z80 is? A data sheet is basically a technical manual.

In that case this project is not going very far

You posted some output from something. What did you actually make?

Z80 on mega2560.

Pfffft. I say Charles Babbage's Analytical Engine on Mega 2560.

hahaha

//
// This sketch uses code on the Z80 to write a greeting to the serial-console.
//
// We let this program run for a few thousand cycles, which should be
// sufficient to allow the text-output, "Hello\n", to complete.
//
// Steve
//

#include <z80retroshield.h>

//
// Our program, as hex.
//
// The source code is located in hello.z80.
//
unsigned char memory[32] =
{
0x3e, 0x48, 0xd3, 0x01, 0x3e, 0x65, 0xd3, 0x01, 0x3e, 0x6c, 0xd3, 0x01,
0xd3, 0x01, 0x3e, 0x6f, 0xd3, 0x01, 0x3e, 0x0a, 0xd3, 0x01, 0xc3, 0x16,
0x00
};
int memory_len = sizeof(memory) / sizeof(memory[0]);

//
// Our helper
//
Z80RetroShield cpu;

//
// RAM I/O function handler.
//
char memory_read(int address)
{
return (memory[address]);
}

//
// I/O function handler.
//
void io_write(int address, char byte)
{
if (address == 1)
Serial.write(byte);
}

//
// Setup routine: Called once.
//
void setup()
{
Serial.begin(115200);

//
// Setup callbacks.
//
// We must setup a memory-read callback, otherwise the program
// won't be fetched and executed.
//
cpu.set_memory_read(memory_read);

//
// Then we setup a callback to be executed every time an "out (x),y"
// instruction is encountered.
//
cpu.set_io_write(io_write);

//
// Configured.
//
Serial.println("Z80 configured; launching program.");

}

//
// Loop function: Called forever.
//
void loop()
{
//
// We stop running after a specific number of cycles
//
// Have we reached that point?
//
static bool done = false;

//
// Count the number of times we've pumped the Z80.
//
static int cycles = 0;

//
// Are we done?  If so return.
//
if (done)
    return;

//
// We stop running after running a specific number of cycles
//
if (cycles > 4096)
{
    Serial.print("Z80 processor stopped ");
    Serial.print(cycles);
    Serial.println(" cycles executed.");
    done = true;
    return;
}

//
// Step the CPU.
//
cpu.Tick();

//
// We've run a tick.
//
cycles++;

}

You show me code. I'm asking you what hardware you are running it on. Please don't just say "Mega2560". I mean all of your hardware.

Also, look at the mess you posted. Please edit that and put it in code tags. Or, provide a link to the original code, since it's obvious by now that you didn't write it.


arduino mega2560 and z80 cpu
two hardware

image

What can you achieve with a Mega+z80 that you cannot achieve with a Mega alone?
Are you trying to learn about z80 asm? TI calculators are great for that purpose.

I think the obvious answer must be, "you have some wiring error". You can find it by comparing each connection with the connection in the documentation. Since you are sitting in front of the prototype, and we are not, only you can find it.