10

In Leningrad they developed a clone of the ZX Spectrum, replacing the ULA by some TTL logic. Some of my speculations:

  • In the USSR, the analog TV sets used SECAM, not PAL, so I imagine that the timings will be different between the UK Spectrums and the Leningrad.

  • And I imagine that TTL logic is going to have a drastically different speed from a ULA anyway

  • They may have needed to leave some features out to keep the chip count low enough to be affordable.

Confirming or disconfirming my speculations, is anything precisely known about the differences that caused incompatibilities between the Leningrad and the Sinclair machines?

2 Answers 2

14

Leningrad is a primitive and not particularly compatible clone. However, it is pragmatic, so the incompatibilities are not always going to show up. The main differences are due to a completely different way in which timings are implemented in Leningrad, to an extent that I would not personally call Leningrad's circuitry "an ULA clone". I am a coder, so I can give you a list of incompatibilities from the coder's prospective.

  • The sharing of memory accesses by ULA in ZX Spectrum and in Leningrad is done very differently. From the coder's prospective, ZX Spectrum delays slow memory accesses during screen drawing; the detailed specification of how it is done can be found here: http://scratchpad.wikia.com/wiki/Contended_memory In comparison, Leningrad delays the execution of Z80 at all times, during M1 CPU cycles, which manifests itself as, approximately, rounding up the execution times of commands requiring odd number of CPU cycles to even number of cycles. The resulting performance is about the same as in the real Spectrum, but the exact mileage depends on the specific inner loops and is not the same. This can lead to speed differences in games (I am not aware of any specific games exhibiting this incompatibility, but there will be some for sure); it also means that any exactly timed codes for ZX Spectrum cannot possibly work correctly on Leningrad (which means that pretty much every game/demo using multicolour will not work correctly). For example, Shock Megademo will not work correctly (assuming you managed to start it, which is not a given). Any modern game based on Nirvana engine will not work. Beeper engines also rely upon precisely timed loops. Depending on the specific beeper engine, they will usually sound differently and, for some engines, can, at least in theory, go significantly out of tune.

  • In fact, Leningrad was often assembled as a kit, and since availability of the quartz resonators with correct frequency was for some reason limited at the time, there were also variations in the specific timing parameters of the generated video signal. The classic Spectrum 48K always has 224 CPU cycles per scanline; some home-made Leningrads can have 216 or 232 cycles per scanline. Once again, this will affect precisely timed loops.

  • Leningrad does not have the floating bus. Some ZX Spectrum games draw the image behind the raster beam. Since line interrupts are not available, coders of some commercial games implemented waiting loops that use floating bus to identify when the ULA begins drawing the screen. Arkanoid is probably the most famous example of such a game, but it also affects Cobra, Sidewise and Short Circuit. Without the floating bus, these games freeze on Leningrad, just like they freeze on Amstrad models of 128K ZX Spectrum. Russian mags described many hardware hacks implementing so-called port #FF, intended to rectify this issue.

  • Leningrad's frame interrupt does not happen in the right place. On ZX Spectrum frame interrupt happens 64 screen lines before ULA begins drawing the main screen. Because of this time gap, and also because the screen is drawn by ULA from top to bottom, line by line, this suggests a popular rendering strategy "ahead of the beam", where sprites are pre-sorted by their vertical positions, drawn before the ULA renders them on the screen and then all deleted after the beam has passed in preparation for the next frame. Since, once again, line interrupts are not available, this whole setup hinges on spending about the right amount of time drawing sprites, and then about the right amount of time deleting them. On Leningrad the frame interrupt happens at the first scanline below the visible screen. This means that instead of starting drawing 64 lines before the start of visible screen, programs begin drawing 120 lines before the start of visible screen. This usually means that sprite removal begins way too early in relation to their display and many commercial games would work on Leningrad with flickering/disappearing sprites.

  • The Kempston joystick on Leningrad reads 3 top bits as 1s. This must throw some programs off balance. Writing to every port would write to system port #FE, so programs attempting to access external hardware would produce beeper noises and changing border colours.

Basically, in contrast to what the other answer here suggests, Leningrad was one of the worst Russian clones compatibility-wise. What was going for it was its absolute simplicity. The resulting low price mattered a lot at the time when even such a cheap ZX Spectrum clone could cost a monthly salary.

5
  • Your first bullet point reads as though all memory is contended, even ROM. Is that the case? Commented Jul 31, 2018 at 14:41
  • Technically, the memory is not contended at all. The CPU is delayed differently (hardware guys who know M1 delays can explain this I hope). However, yes, this affects any code running on Leningrad, including the code residing in ROM.
    – introspec
    Commented Jul 31, 2018 at 14:56
  • 1
    The Z80 signals M1, machine cycle 1, when fetching an opcode (as distinct from an operand or something that the operation required it to fetch). The fetch part of the M1 cycle is one clock cycle shorter than an ordinary read so holding WAIT for a clock cycle during M1 both (i) allows use of slower RAM (e.g. the original MSX standard mandates it for this reason); and (ii) provides a logically-easy way to apply a bit of a slow down but not a huge one. Unlike a Spectrum, speed becomes a function of the operation stream alone, not of code location or video position.
    – Tommy
    Commented Jul 31, 2018 at 15:06
  • 1
    ... and therefore you can get some sense of the difference a one-cycle delay during M1 makes by playing a lazy Spectrum port on an MSX. But not exactly, because lazy ports tend also to be lazy about the big difference in video hardware (i.e. locally mapped versus beyond some IO ports), and probably throw a whole bunch of speed away on that. I guess you'd want a good Spectrum port that was nevertheless clearly just reusing the original graphics — not touching the MSX's hardware sprites or scrolling via the tilemap, etc.
    – Tommy
    Commented Jul 31, 2018 at 15:08
  • @Wilson, I removed the item about frame interrupt duration, because I cannot find an online confirmation. However, I seem to remember that frame interrupt was formed by an analogue circuit (not only on Leningrad, mind you). The parameters of this circuit were often specified very loosely, so the duration of the frame interrupt could in some cases be few hundred or even few thousand machine cycles. Some software used very short interrupt handlers, and the very long interrupt durations led to re-triggering frame interrupts several times per frame, which can lead to all sorts of trouble.
    – introspec
    Commented Jul 31, 2018 at 15:28
11

In the USSR, the analog TV sets used SECAM, not PAL, so I imagine that the timings will be different between the UK Spectrums and the Leningrad.

SECAM is, like PAL just the colour encoding and on top of the basic B&W TV signal. Basic timing is therefore not touched. It's just about how colours are put on top - which is done in the modulator circuit anyway, as the digital output is RGB plus composite sync for the Leningrad (YUV for the Spectrum).

And I imagine that TTL logic is going to have a drastically different speed from a ULA anyway

Not in a way that it mattered with the Z80 and RAM/ROM beefing incredibly slow compared to TTL or ULA signal timing. For all practical purposes they are equivalents.

They may have needed to leave some features out to keep the chip count low enough to be affordable.

None that I know of. It would have been hard anyway, as the Spectrum doesn't exactly offer a lot of features at all :)) (*1) As tofro mentioned, there was no bus connector (*2), which may count as a missing feature (*3), though, more of a mechanical than an electronic one.

Confirming or disconfirming my speculations, is anything precisely known about the differences that caused incompatibilities between the Leningrad and the Sinclair machines?

Haven't heard of any (*4). Schematics are widely available. For example here. So it's easy to check the workings - maybe against the Spectrum Series 7 project?


*1 - In fact, as Tommy mentions mentioned, many SU/Russian spectrum clones got enhancements like a Kempston joystick interface. For the Leningrad this is true for second revision boards (Leningrad 2). Another, maybe even more appealing, was a breadboard area for free form interface building. Quite handy for a DIY computer. Last but not least, the RGB output (instead of YUV) did enable the use of professional CRTs. So maybe the question might be rather What Improvements Did the Leningrad Offer Compared With the Spectrum

*2 - Other SU/Russian clones, like the quite popular Baltik did feature an expansion port, even using real connectors instead of PCB-edge type.

*3 - Then again there might not have been many western expansion modules available at that time and less supply in edge connectors, as Eastern European designers usually preferred more reliable ways of plugging.

*4 - Except for slight differences in colour due different encoding effects only visible in side by side comparison.

11
  • 1
    I also struggled to think of Spectrum features one could leave out. In fact, it sounds like the Leningrad might have a Kempston joystick port built in? So rather than leaving features out, it adds them!
    – Tommy
    Commented Jul 30, 2018 at 13:31
  • 1
    The main omission on the Leningrad might have been the expansion port - But most ZX Spectrum games worked just fine.
    – tofro
    Commented Jul 30, 2018 at 15:04
  • 3
    The first 100% exact reproduction of the ZX Spectrum ULA was done by Chris Smith and resulted in the Harlequin. In case you're interested in what exactly happens inside the ULA, and the very interesting research he did, read Chris' book, amazon.co.uk/product-reviews/0956507107/… The Leningrad was not as close to the original, but close enough, apparently.
    – tofro
    Commented Jul 30, 2018 at 17:42
  • 1
    BTW The Leningrad I had a joystick port but not a "compatible" one.
    – tofro
    Commented Jul 30, 2018 at 17:43
  • 3
    @Tommy the flash attribute bit always seemed like a waste of gates to me. Independent bright signals for ink and paper would have been more useful; just my opinion of course. Commented Jul 31, 2018 at 7:59

You must log in to answer this question.

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