What was the SLL instruction supposed to do?

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: What was the SLL instruction supposed to do?

Post by Ast A. Moore »

djnzx48 wrote: Wed May 09, 2018 7:27 am Amazingly, the discovery of these instructions predates the Spectrum.
Indeed. The Z80 was released in 1976 or thereabouts.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: What was the SLL instruction supposed to do?

Post by djnzx48 »

Yeah, I knew that. It's just that the undocumented instructions didn't seem to be widespread on the Spectrum until years later, and there weren't many articles about them early on, so early discoveries like this must have just been 'forgotten' and had to be rediscovered for a new generation of programmers when the Spectrum came along. It's possible that the Z80 was mainly being used for embedded systems in its early days, so using these undocumented instructions could have been seen as a safety risk if future versions of the chip failed to support them.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: What was the SLL instruction supposed to do?

Post by Ast A. Moore »

djnzx48 wrote: Wed May 09, 2018 8:20 am the Z80 was mainly being used for embedded systems in its early days, so using these undocumented instructions could have been seen as a safety risk if future versions of the chip failed to support them.
True. Although I seem to remember bumping into quite a few of them while disassembling some early Spectrum titles. Granted, SLL is not nearly as widespread as some others.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: What was the SLL instruction supposed to do?

Post by RMartins »

I read in a book somewhere, don't remember exactly where, that the first Z80 chips that were commercially available, didn't have a reliable SLL, and hence the reason, for Z80 not to document it.

How true this is, is up for grabs.
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: What was the SLL instruction supposed to do?

Post by RMartins »

djnzx48 wrote: Wed May 09, 2018 7:27 am ... And here's the July 1981 article that it refers to, which instead of SLL, uses the bizarre notation DUPINC. How about incorporating that into modern assemblers? :lol:
Note the Editors note on that page:
These OpCodes are not tested during production of the Z80 chip by Zilog.
It is possible, in a small number of cases, that any of these opcodes may not work.
Taking into account that Zilog licensed the z80 core to several manufacturers and that there were several non official copies, these opcodes are likely not to work or work differently in Z80 from other manufacturers.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: What was the SLL instruction supposed to do?

Post by djnzx48 »

But if the presence of SLL was merely an implementation detail that wasn't meant to occur in the first place, then what would be the point of testing it?
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: What was the SLL instruction supposed to do?

Post by RMartins »

A CPU is basically a state machine, that given a set of inputs generates some output and changes internal state.

When the documented instructions, do not cover all possible combinations, the curious human mind, will need to find out, what happens in the other cases :)
And the search for undocumented opcodes is born.

Most of these were probably meant as instructions, but some are just a side effect of how the state machine was built.

A good example are the prefixes, which were added, to increase the functionality, for example by swamping the HL register by IX or iY, among other possible examples. So changing just one of the referenced registers in an operation, provides a complete new set of instructions.

Some examples, are redundant, like "SLA A" and "ADD A, A".
On some systems/CPUs, the shift operation doesn't even exist, because it can be implemented with an ADD.
And for better or for worse, the add is more efficient (4T) than shift (6T).
But ADD only works with A register, where Shift works with any of the 8 bit registers.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: What was the SLL instruction supposed to do?

Post by Nomad »

This is where FPGA projects tend to win big is you get all the undocumented features 'free' as everything from the gate logic level is implemented. As long as you exactly replicate what is on the die, you don't need to 'know' what is going on and implement it like with an emulator.

FPGA's are getting cheaper every year, when it hits the widget sweet spot I figure 8-bit fpga widgets are going to appear like roaches flooding the market :lol: It will be awesome.
User avatar
Seven.FFF
Manic Miner
Posts: 736
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: What was the SLL instruction supposed to do?

Post by Seven.FFF »

Except not really, because most FPGA cores model chip behaviour, not structure.

The T80 as used in the Next and Uno ZX core mimics behaviour. The A-Z80 as used in the Uno CPC core is derived from decapping and photographing, and mimics structure. But it takes up a lot more FPGA resources than the T80 does.

https://opencores.org/project/t80
https://opencores.org/project/a-z80

We will get there in a few more years, as entry-level FPGAs get bigger and more sophisticated.

Behaviour modelling designs are a lot closer to software emulators than most FPGA fanbois will admit.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: What was the SLL instruction supposed to do?

Post by Nomad »

True, I never liked behavior simulation projects. It's an emulator hiding inside an fpga :lol: You get all the disadvantages of an emulator.

The next 10-20 years though, gate level re-creations of cpus will be a reality in budget packages. Then comes the interesting question on whom will buy these widgets? because most of the original consumers of 8-bit tech are not going to be in a position to consume...
User avatar
Seven.FFF
Manic Miner
Posts: 736
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: What was the SLL instruction supposed to do?

Post by Seven.FFF »

We will be in our 90s, buying nostalgia-driven recreations of pacemakers and colostomy devices that we used in our 70s!
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
Post Reply