RC2014-8085 Support

Discussion about other targets
Post Reply
User avatar
feilipu
Member
Posts: 10
Joined: Tue Nov 15, 2016 5:02 am

RC2014-8085 Support

Post by feilipu »

z88dk support of the RC2014-8085 Module. The intention is to provide both ACIA ROM and MS Basic RAM subtypes.
But at this stage I've focused on getting the basic85 working. ACIA support can come later.

As z88dk supports 8085 C compilation using the sccz80 compiler and the classic library, whilst the RC2014 target is normally a newlib library target, there was quite a bit of interesting blending of classic and new code to get the crt0 and libraries created and linked properly. But, now the RC2014-8085 is the first 8085 platform in the newlib targets. Woo Hoo!

Having the basic85 subtype means that C and assembly programs can be uploaded to the RC2014 using the MS Basic HLOAD keyword.

In host PC:

Code: Select all

> zcc +rc2014 -subtype=basic85 [ --list -m ] myfile.c -o myhexfile -create-app
Then from MS Basic:

Code: Select all

HLOAD

Code: Select all

> cat >/dev/ttyUSB0 <./myhexfile.ihx
And to run the program from MS Basic:

Code: Select all

? usr(0)
And that's all that's needed.

This is still being tested, and assume that there will be issues. But the first work is now done.

Image

In another note, Paulo has gone to town with synthetic instructions for the 8085 in z88dk-z80asm, to make coding more convenient. Essentially, anything you can do with loading indirectly from (hl), you can now transparently do from (de). The assembler implements the ex de,hl instructions silently to make life easy. This helps when writing assembly for Z80 and 8085, because you don't have to write alternate code paths depending on the CPU. Of course all of the other 8085 side effect free convenience opcodes are available too, like ld bc,hl and ld hl,sp+n.
User avatar
feilipu
Member
Posts: 10
Joined: Tue Nov 15, 2016 5:02 am

Re: RC2014-8085 Support

Post by feilipu »

Since my last post there have been three updates of note.

1. I've added another subtype called acia85, which is designed to used as a ROM load. It provides ACIA drivers, and the necessary page0 and jump vectors specifically for the 8085 CPU. This will be the basis of future ROMs for the RC2014-8085.

2. Since I'm very keen to support the Am9511A APU Module for the RC2014, I needed to provide support for Z80 wait state timing to the 8085 CPU. The 8085 doesn't provide an automatic I/O wait state, and the timing requirements are too tight for any normal peripheral to achieve. So there needed to be a wait state generator added to the 8085 CPU Module. I've designed and tested a new version, and it works great.

Image.

3. Since possibly 1998, and possibly even longer, the 8080, 8085 and Gameboy Z80 CPU support has used non-reentrant primitives, with some of the code being derived from the Amsterdam Compiler Kit.

Dom recently went to the trouble to reorganise all of the primitives (called l_ functions), so that there is a neat inheritance process, with 8085 derived from 8080 and using common primitives. Gameboy uses its own primitives, with common primitives, and Z80 also uses its own primitives inheriting from common too.

With that mechanism in place, initially it was just a process of picking functions where the 8085 undocumented instructions could contribute to better code. But, then I got a bit carried away and also rewrote all the 8080 and gbz80 primitives where necessary to ensure that the whole library was reentrant.

Its been an interesting few weeks, and hopefully these new compiler primitives will be useful for as long as the last set were.

Some notes on the instructions had learning here.

Cheers, Phillip
Post Reply