29

The Sinclair computers are known for their low cost compared with other computers that were popular in the early 1980s. This is why they had membrane keyboards, or that rubber stuff in the case of the ZX Spectrum, and did not include a CRT as did the Apple II.

As the 6502 was a good deal cheaper than the Z80, and comparably powerful. And though I don't know a great deal about hardware design, it seems that because the 6502 only uses the memory on every other cycle, the development team could have spend less effort contending part of the address space to get the display subsystem to work.

10
  • 1
    You're conflating a number of contributory factors in the Sinclair Research design decision process - the choice of the Z80 for their product line did not have a rationale as simple as cost, though that of course would have been a consideration. Nov 20, 2016 at 19:51
  • 3
    I always thought the Z80 was substantially more powerful than the 6502.
    – JDługosz
    Nov 21, 2016 at 5:34
  • 4
    @JDługosz: There are situations where either can run circles around the other; there are even some where the CDP1802 can actually come out looking almost decent (it's awfully slow, but it has sixteen 16-bit registers). The 6502 excels at accessing tables which are 256 bytes or less since its indexed addressing modes include "free" address arithmetic. I've written wave-table synthesis code for the 6502 which takes 46 cycles of every 76-cycle scan line, and uses 20 different pointers for audio in each group of four scan lines (plus more for video).
    – supercat
    Nov 21, 2016 at 6:45
  • The 6502 was a good deal cheaper than the Z80 when they were introduced, i.e. in '75 and '76 respectively. I'm far from convinced that there was still a significant difference between the cost of the two by the time the ZX80 was released in 1980. I haven't found pricing information for 1980 from anywhere, but I can tell that by 1981, Z80 CPUs were available at retail for $7 each, and Z80A's for $10, while a 6502 was $7.50 (see advert on page 77).
    – Jules
    Jul 31, 2017 at 21:18
  • 1
    @paxdiablo: The routine would save the contents of the registers in response to an interrupt that triggers a few scan lines above where video output would start, and would restore them afterwards, so even though the video routine would use almost all of the registers, nothing else in the system would need to care about that. As with video using the normal chip (CDP1861 I think), the display interrupt handler would keep control until the beam passed the bottom of the displayable region, so nothing else in the system would be able to see what it was doing with registers.
    – supercat
    Mar 6, 2022 at 19:39

2 Answers 2

46

Sinclair didn't always use the Z80 for its computers. The MK14 computer, sold in kit form (like the ZX80 was), used a National Semiconductor INS8060.

The ZX range of home computers have a video display hardware that is very closely tied to the architecture of the Z80.

On the two first models, ZX80 and ZX81, the video display hardware was kept to a minimum, yet allowing a decent resolution of 256x192 pixels and the ability to move the screen memory back and forward in the memory space, although it was not pixel addressable.

To accomplish this, the Z80 played an important role as RAM address generator for the video hardware (resembling in some way what the Motorola 6845 CRTC chip does for other microcomputers).

When it is time to read a TV scanline from memory, the Z80 is directed to "execute" (i.e. fetch instructions) from the memory address where video data is stored. The Z80 does not actually execute the instruction read. Instead, the video hardware peeks the data bus and retrieves whatever data the memory put there for the Z80. Just after that, and before the second clock cycle of the fetch bus cycle is ended, the data bus is forced to 00000000 so the Z80 ends up reading a NOP instruction, which does nothing and goes for the next instruction at the next address.

This way, the video hardware doesn't have to implement an address counter, logic to access memory and logic to perform bus contention, as it is the Z80 which is actually taking part in the video generation process.

The ZX81 is just a ZX80 with all the video hardware encapsulated in a ULA chip, plus some other features such as the "slow circuit", which was an improvement over the ZX80 video circuit, designed to avoid flickering while the user was inputting data.

The ZX Spectrum only shares some visual resemblance with the ZX81 video output, but it is actually a totally different beast. It could have been designed around a different CPU, but Sinclair had already a BASIC interpreter written for the Z80, and so the Spectrum ROM inherited much code from its ancestors, including some routines that shouldn't be in the Spectrum ROM because they made sense only in a ZX81.

Summarizing: the ZX80 and ZX81 relied on the Z80 way of performing a memory bus cycle to use it as a DMA engine. The Spectrum used a Z80 because it shared a lot of ROM code with previous models.

13
  • 1
    @Janka: Jamming a NOP on the 6052 bus would cause it to advance one address every two cycles, but choosing a different opcode would make it advance every cycle. If one has 64 cycles per scan line of which 40 should display something and arranges for the Z flag to be set, one could stuff F0 at even addresses and anything at odd addresses during the displayed part of the frame, and D0+FE during the non-displayed part. If the branch ends up crossing a page boundary, it would run 8 times in the 24 non-display cycles; otherwise it will run 12 times. Either way the timing works out nicely.
    – supercat
    Nov 21, 2016 at 6:57
  • 2
    I've read that it also takes advantage of the Z80's Row Address Strobe feature to help make refreshing dynamic RAM easier. The ZX80 of course didn't have dynamic RAM, so this allowed this feature to be harnessed for other purposes. In this case, the CPU puts a different address (defined by the IX register combined with the R register) onto the address bus, which a multiplexing circuit combines with the data just read from display RAM to produce the address at which to look up the character in question. This register is also used for determining when the end of the scanline has been reached.
    – Muzer
    Nov 21, 2016 at 11:28
  • 1
    (The ZX80/ZX81 to save RAM store the display buffer in terms of characters rather than pixels, and don't even store entire lines if the whole line is not being used, thus there needs to be some timing to figure out when the CPU should start reading in the next line. The refresh register provides this). The source of this info: searle.hostei.com/grant/zx80/zx80ScopePics.html
    – Muzer
    Nov 21, 2016 at 11:29
  • 1
    I believe they also used a Z80 due to it´s low cost by the time the Speccy was released in the market. Dec 4, 2016 at 21:59
  • 1
    In ZX Spectrum, the ability of Z80 to refresh dynamic RAM is also used to the full. Z80 provides refresh for the upper 32k of DRAM (absent in 16k version) and for the video DRAM during retrace times (though I might be wrong with video DRAM).
    – lvd
    Apr 7, 2017 at 9:26
0

I thought they chose the Z80 as a differentiator from the plethora of systems available at the time and, of course, cost. I'm sure this is mentioned in the TV programme Micromen? (A good watch if you've not seen it).

5
  • 4
    This doesn't sound convincing as there were several other Z80-based systems around at the time - although somewhat more expensive. It would be great if you could expand on this a bit.
    – Chenmunka
    Nov 21, 2016 at 16:14
  • They mention in Micro Men that it uses a Z80A, after earlier saying that they'll go with the 6502 because it's the only real choice for their price bracket, but no more than that.
    – Muzer
    Nov 21, 2016 at 16:25
  • 4
    (Micro Men was a great programme but it's hardly useful for technical details like this)
    – Muzer
    Nov 21, 2016 at 16:42
  • @Muzer - Actually it is the proto-Acorn team who state that they will use the 6502 (for those reasons), see MIcromen@20:53, not Sinclair. The Sinclair team imply (without saying why) that a Z80 will be used - by the use of the name ZX80 @22:58 and confirmed @24:55 with the ZX80's board inspection by the Acorn team. Although as you say, it is merely a dramatical representation and should be taken with a pinch of salt. Jun 19, 2018 at 15:02
  • @Greenonline apologies, yes, I did know that but I phrased it very ambiguously! Here "They" meant the Acorn Team and "it" meant the ZX80 (of which the Acorn team were doing a tear-down in that scene)
    – Muzer
    Jun 23, 2018 at 2:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .