I found a program, srecord, which turns HEX or BIN files into C arrays (man page for srec_cat). I was able to write a test program for the Z80 and convert the program to a C array. I then compiled it into the PSoC and had the PSoC download the SRAM after it completed the power on RAM test and before it called the Front Panel routine (see previous post with video). The command line for srecord is:
srec_cat loop.o -binary -o code.c -C-Array
The program downloaded to the card and I could step through the code (using the INCAD - Increment Address) button the Front Panel and compare it to the list file generated from the Compiler. I was able to also hit the run button on the front panel and execute the code.
The command line to compile the code was:
zcc +z80 -m -g -s -SO3 -startup=1 -clib=sdcc_iy -lm -create-app --list IO_Test_01.c
The code I am running is:
/* simple code that tests I/O */
#include <z80.h>
#pragma output REGISTER_SP = 0x4000
void main(void)
{
unsigned char data;
data = z80_inp(0x10);
z80_outp(0x10,data);
while(1);
}
I haven't verified if the code is running as expected.
I did expect the code to hang on an I/O read or write but it seems to be continually running, My command line could be set up wrong for the compiler - not sure yet.
Perhaps a simpler piece of assembly code? I/O operations aren't difficult but they are at least a few line of code to set up registers, etc.
Just need some time and got sidetracked by my Not Quite Useless Raspberry Pi Replacement project.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.