|
Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment. |
|
Thread Tools |
22nd May 2023, 10:09 pm | #1 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,115
|
Programming the Z80 without RAM
This resurrection of a 40-year old Morse, Rtty & Ascii converter Z80 project follows a chat with Brian Chiha (of the "Ready? Z80" channel on Youtube) and might be of general interest... Z80 programming with no RAM ! Its in the "Random projects & files" section of http://philg.uk
The original source file was developed almost 40 years ago on my Eaca Colour Genie for which the tapes are long lost - all that remained to be recently rediscovered in my loft, was an actual working PCB and a faded, rolled-up printout - which wasnt the final version. In a burst of nostalgic enthusiasm, I've spent a couple of evenings disassembling the original eprom and with help from the barely legible printout, recreated the complete & final source. It assembles fine with either AZ80 or with Zen which I used on the Colour Genie, and which I've ported to the RC2014 mini/micro. The object code is just under 2k and fits into a 2716 eprom with only a few bytes to spare. The key thing behind this project, and the main driver for resurrecting it, is that it uses no RAM - the PCB has only a Z80, PIO, clock and eprom, it has no read-write memory at all! Of ocurse I wouldnt expect anyone to build this in 2023, but Brian posted a video about programming without RAM and this got us talking, & I thought maybe after all the effort I'd share it. Fortunately I always use plenty of source code comments to give myself a chance of remembering what I did... Cheers Phil |
22nd May 2023, 10:25 pm | #2 |
Octode
Join Date: Mar 2020
Location: Kitchener, Ontario, Canada
Posts: 1,294
|
Re: Programming the Z80 without RAM
I couldn’t be bothered to download the zip to check the code but a 2k assembler program probably needs to use subroutines. So without ram for a stack I guess you can use Jp (hl/ix/iy) for return addresses.
|
22nd May 2023, 10:41 pm | #3 |
Octode
Join Date: Mar 2019
Location: Barry, Vale of Glamorgan, Wales, UK.
Posts: 1,363
|
Re: Programming the Z80 without RAM
Had a quick look through the code - worked out the JP (IY) and then read the article which leads with it - duh. Anyway very reminiscent of SC/MP code with only the pointer registers available. I suppose you could use the alternate set as well (EXX) with EX DE,HL serving to provide more storage and allow use of JP (HL)
|
25th May 2023, 6:55 pm | #4 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,115
|
Re: Programming the Z80 without RAM
More of the same, another old zero RAM project - I found my old Morse Tutor board, still works fine, same eprom-only Z80 hardware as the morse/rtty decoder, fits in a cassette-tape case. Again I've disassembled the eprom to recreate the long-lost Z80 source. "Random projects" page of http://philg.uk
I'd be interested to hear thoughts on the "pseudo-random" number generator - I have no clue where I got this from 40 years ago, very simple but it kinda works ! Take a 16-bit seed, then in a loop multiply it by 257, add 41 and ignoring overflow take the MSB of the result as the "random" number. Loop for the next one. Random-ish? It must have come from a magazine, I would never have worked that out! Last edited by Phil__G; 25th May 2023 at 7:20 pm. |
26th May 2023, 11:18 am | #5 |
Octode
Join Date: Nov 2004
Location: Hebden Bridge, West Yorkshire, UK.
Posts: 1,885
|
Re: Programming the Z80 without RAM
I recently wrote a test rom to exercise a z180 cpu transplanted into a bbc micro https://github.com/dominicbeesley/bl...s/test-mos.asm
The rom needed to exercise memory but not rely upon it for operation. I didn't think to use registers for subroutines...mainly because this rom is a clone of a 6502 rom where that isn't possible. Very sc/mp-ish D |
26th May 2023, 1:59 pm | #6 |
Octode
Join Date: Jul 2009
Location: Carmel, Llannerchymedd, Anglesey, UK.
Posts: 1,506
|
Re: Programming the Z80 without RAM
Back in the 80's, I designed a controller for ML Aviation, used to measure airport runway friction. That used a Z80 with no ram. Did the subroutines as described above. Ended up using every register in one form or another, as it had to do some arithmetic and drive a printer.
|
26th May 2023, 2:17 pm | #7 |
Octode
Join Date: Jul 2009
Location: Carmel, Llannerchymedd, Anglesey, UK.
Posts: 1,506
|
Re: Programming the Z80 without RAM
Just realised - I still have a photo of the ML unit!
|
26th May 2023, 2:31 pm | #8 |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,553
|
Re: Programming the Z80 without RAM
Although it's a clever thing to be able to do it seems a bit extreme to do this just to save having a RAM IC in the system. The workarounds needed to ensure you never have to call subroutines or keep variables in RAM in the normal way could mean you end up having to use a much bigger EPROM than you meant to.
I can obviously understand and appreciate the skill involved in writing, say, system test EPROMs which don't need any of the system RAM to work so that they can run regardless of whether the system RAM is present / absent or faulty. Maybe I'm just lazy. |
26th May 2023, 4:06 pm | #9 | |
Octode
Join Date: Jul 2009
Location: Carmel, Llannerchymedd, Anglesey, UK.
Posts: 1,506
|
Re: Programming the Z80 without RAM
Quote:
|
|
26th May 2023, 4:29 pm | #10 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,115
|
Re: Programming the Z80 without RAM
I made a few of these rom-only boards back then, mine were inspired by the "Minimal Z80" shown in Zilog Applications Manual. Re EPROM size, I'd say the morse/rtty/ASCII reader is a fairly, well, not 'complex' but shall we say 'substantial' project, and it uses the smallest of the common eproms, a 2716
RAM would have made things much, much easier but as with all my stuff, it was done for fun and a bit of a challenge! BTW the ML unit is the first serious no-ram application I've seen! Cheers Phil PS can anyone throw any light on where I might have found that dodgy pseudo-random character generator in the Morse Tutor code? Last edited by Phil__G; 26th May 2023 at 4:38 pm. |
26th May 2023, 6:39 pm | #11 | |
Octode
Join Date: Mar 2020
Location: Kitchener, Ontario, Canada
Posts: 1,294
|
Re: Programming the Z80 without RAM
Quote:
http://forum.6502.org/viewtopic.php?f=2&t=587&start=195 Were there any other input/output devices that included RAM other than the 8154 or 8155? 8155 would be tricky to use with a z80 due to multiplexed address and data. It would probably make more sense to use 8748/9. |
|
27th May 2023, 4:34 am | #12 |
Dekatron
Join Date: Jun 2015
Location: Biggin Hill, London, UK.
Posts: 5,208
|
Re: Programming the Z80 without RAM
I could be ridiculously pedenantic and mention the 8156. Which is an 8155 with an active-high chip select line.
There's also the 6532 RIOT (RAM, I/O, Timer) in the 6502 family |
27th May 2023, 6:45 pm | #13 |
Pentode
Join Date: Nov 2022
Location: Chesham, Buckinghamshire, UK.
Posts: 135
|
Re: Programming the Z80 without RAM
This is one originally published in Talking Electronics I built a while ago as a bit of lock-down project. Was not sure quite what to do with it once finished so set it up to be a clock with a VFD display, even used the 50Hz mains as the time source to keep it really old school.
|
27th May 2023, 8:13 pm | #14 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,115
|
Re: Programming the Z80 without RAM
Brilliant! I love that display David
Talking Electronics has an active FB group Brian did a video on the Microcomp, I'd never heard of it until I got chatting to him recently https://www.youtube.com/watch?v=iamr3gj8vU8 He does a great channel by the way, well subbing ! |
27th May 2023, 10:53 pm | #15 |
Octode
Join Date: Mar 2019
Location: Barry, Vale of Glamorgan, Wales, UK.
Posts: 1,363
|
Re: Programming the Z80 without RAM
Ah I went searching for that as I had seen it sometime ago when I read this thread - love the VFD and use for the machine David.
|
28th May 2023, 7:51 am | #16 |
Dekatron
Join Date: Jun 2015
Location: Biggin Hill, London, UK.
Posts: 5,208
|
Re: Programming the Z80 without RAM
As an aside I have a Marconi TF2828 'digital simulator', a test data generator for digital telephone trunks.
One of the boards in the unit, used only for one of the functions, is a small 8085-based computer system. It contains the processor, 8K EPROM (3 off 2716 and an 8755) and even a 8*8 multiplier IC, but no RAM. And no, the processor bus is not brought off the board to RAM somewhere else. |
28th May 2023, 8:34 am | #17 |
Octode
Join Date: Jan 2003
Location: Ware, Herts. UK.
Posts: 1,082
|
Re: Programming the Z80 without RAM
When I worked at Solid State Logic in the late '80s, a fellow software engineer told me that each of the bar-graph VU / PPM meters for the SL5000 broadcast mixing desk was implemented using a Z80 with no RAM. He told me that full use was made of the poor old Z80's registers; including the interrupt vector (I) register.
John |
28th May 2023, 9:44 am | #18 | |
Octode
Join Date: Jul 2009
Location: Carmel, Llannerchymedd, Anglesey, UK.
Posts: 1,506
|
Re: Programming the Z80 without RAM
Quote:
|
|
29th May 2023, 10:21 am | #19 |
Triode
Join Date: Jan 2005
Location: Bristol, UK.
Posts: 37
|
Re: Programming the Z80 without RAM
A few years ago, I built an RC2014 PCB using parts I already had lying around. As part of that project, I wrote a Z80 machine-code monitor that could test the machine without assuming the RAM was working. So, I could not use CALL and RET instructions because they use the stack, which is in RAM.
I put the source code on GitHub, here: https://github.com/anachrocomputer/RC2014tester Hope it's useful to somebody! |
29th May 2023, 12:22 pm | #20 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,115
|
Re: Programming the Z80 without RAM
This is brilliant, I did wonder whether a couple of slightly weird 40-year-old projects would be of any interest at all, and lo & behold it prompts so many great stories and projects
Thanks everyone! (but keep them coming...) Phil |