News for hackers. Stuff that matters.
Re:How the Z80's registers are implemented by VLM on Sunday October 05, 2014 @01:48PM (#8412866)
If you think swapping via register renaming is creative, you'd really like barrel shifters.

http://en.wikipedia.org/wiki/Barrel_shifter

The easiest way to shift bits isn't "adder like" with carry propagation across data lines (sorta), although that could be done. The easiest way is just to phase distort the bus (sorta) so what you called bit X is now bit X-4 for all bits on the bus, and use a 2x1 mux to select which, and cascade rollers in binary (you don't need a roller for all integer numbers if you can cascade them 16, 8, 2, 1 position only activating some rolls). If you can rotate, you can shift by adding one more stage at the end that does bit oriented ops to clear MSBs or LSBs. Also if your roller is capable of rolling all bits on the bus, you don't need two rollers one in each direction. Latency does add up of course, all those cascaded ops.

Also I saw in the notes the Rodney Zaks z80 book being referenced. I learned assembly from that book, back when it was new. I enjoyed that book. I also looked at the PDF scan of someone's beat up copy... remember when textbooks were only $10.95 each?

Re:How the Z80's registers are implemented by kator on Sunday October 05, 2014 @06:53PM (#8413709)
I still have my original copy of Zaks' book in my collection. I obtained it in 1981 from a friend. I did so much z80 assembly on the TRS-80 that I could "see" instructions in a hex dump before asking zbug to disassemble them.

The z80 was quite the chip for its time and I enjoy reading these articles has they look back into the deeper inner workings of the chip.

One could master the z80, I'm not sure many modern processors could be mastered at that level by a single programmer. They seem to have gotten so complicated that they're beyond comprehension in a single person's mind. I could be wrong but that's the general feeling I get. Sure you can be really good at them and maybe an expert in many applications of a modern complex processor but I doubt many people have a singular understanding of everything each chip has to offer.

Or maybe I'm just getting old.. :-)

Re:How the Z80's registers are implemented by userbinator on Sunday October 05, 2014 @08:48PM (#8413925)
The 8086, which is based on the Z80, is not that much more complicated (even the opcode structure is similar, being an octal format), and same goes for the 80186. Things started becoming a bit more complex with the '286 and its protected mode, and then the '386+ with 32-bit and its various protected-mode enhancements really made it harder for a single person to master fully, but I think it was still mostly possible; the really hairy stuff started with 64-bit mode and all the extensions (e.g. virtualisation) that have been made to that since.

On the non-x86 side, modern ARM SoCs like the ones used in smartphones are not all that much simpler despite a less complex CPU core - they're still thousands of pages of documentation in total.

Re:How the Z80's registers are implemented by teh_klev on Sunday October 05, 2014 @08:22PM (#8413880)
Blimey, I'd forgotten all about Rodney Zaks. I had a copy of his "Programming the 6502" book back in the early and mid 80's when I used to hack out BBC Micro sideways ROM odds and sods. What a blast from the past.
Re:How the Z80's registers are implemented by TheLoneWolfling on Monday October 06, 2014 @09:08AM (#8415633)
Meh, at least it's sublinear latency with the number of bits. (I'm assuming, based on the description. Unless there's something I'm missing, you've got log2(d) stages of O(1) latency.)

The nasty operations are the ones that are linear (or worse!).