I've been keen to actually be using an RC2014 that is plugged into my teletype.
At the end of the last log I had two-way communication with a terminal emulator (through which I'm still loading the software into RAM and starting it) and it was handling multiple lines of text.
The problem here is that if I plug in the target computer and start everything up, then I don't have my software on the teletype. Attempting to first load the program into RAM, then unplug from the modern computer and plug in the target computer, results in a lot of garbage being sent to the printer, I think because serial lines are floating when nothing's attached. I've been advised that I could add pullup resistors to my serial module to prevent this. This may be a useful enhancement as I get closer to being finished, because it'll allow me to 'hot swap' computers.
Putting the software onto ROM was something I would have to do sooner or later anyway.

I was nervous about this. Of course it means that the development loop becomes longer but it also means some reconfiguring. When your whole program is going into RAM, you can have variables where you like and they work. With the program in ROM, any variables have to be in an area of RAM. I'm not using self-modifying code, but that's out too (unless you copy the code to RAM first).
I haven't done this very often. There were things that I had thought of - such as having to set the stack pointer on startup. It turns out that there were multiple things that I hadn't thought of. One is that it isn't enough to reference a variable in RAM, you have to explicitly initialise its value because that RAM will be uninitialised on startup. It's good practice to do this but you don't always bother, especially if you expect to load the software into RAM each time you're going to run it.
With the program almost working, I still wasn't receving serial data. Adding a bit of diagnostic code told me that my interrupt handler wasn't being called.
When you boot into an OS, or even a monitor like SCM, you get so much for free, which you have to implement yourself if you put your own program into ROM.
The problem was with the 'reset 38h' vector near the start of memory, which the Z80 uses when a maskable interrupt happens. SCM has a jump table for this and other reset vectors, redirecting to locations high in RAM, which I was still trying to use.
I've been into this before and understood how interrupt mode 1 works on the Z80 - I use it with my MIDI module to handle the incoming MIDI. But I'd forgotten it all and re-used my own code.
One quick refresher course later, and some more work on the code:

and now we have two-way communication with the computer, in this case my RC2014 Picasso running SCM.


It's not perfect. There are some dropped characters. I don't know why. And it's not stable. But this feels like a bigger step forward.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.