View Single Post
Old 2nd Jun 2019, 6:58 am   #4
JohnBHanson
Heptode
 
Join Date: Aug 2009
Location: Worthing, Sussex, UK.
Posts: 662
Default Re: Fun with Z80 Assembler

The Z80 an even work as a crt controller as well! - look at the ZX80. Uses the refresh register to count the line length!. A design that really does use the minimum chip count.

But in terms of programming I liked the conditional return instructions (eg ret nz) etc. I wrote a routine called marked that saved hl/de/bc registers of the calling routine and also arranged for the
ret from the calling routine to restore the registers (By inserting a different address in the stack
thus:-

Code:
SUBR:   call MARK ; save registers
             ....some code
            ret nz        ;conditional return and restore registers
            ...more code
            ret            ;unconditional return and restore registers
of course can do the same in other architectures - but with the Z80 conditional returns it adds extra value to these instructions (otherwise they would have to be conditional jumps to pop instructions.

I agree IX/IY instructions are also slow as well.

The IO chips are ok, do have some odd features. The SIO is sensitive to the order of initialisation and the PIO needs an M1 cycle to come out of reset, in addition the IO chips keep an eye on the instruction stream to look out for the RETI instruction. This is a cludge should be done with a different bus state. This also make hard to use with my bus extender (Which allows IO peripherals to be used with my emulator) - I have not cracked that one yet so I cannot use real IO cards that use a Z80 PIO with my Z80 emululator.

Still Z80 was affordable and I have had so much fun with it. I never had the opportunity to use the 6809.
JohnBHanson is offline