For the most part the Z-80 extends the 8080 instruction set. If we consider just the 8080 instructions themselves there are a few incompatibilities:
Overflow flag. On the 8080 bit 2 of the flags register only reports the parity of the accumulator after an ALU operation. On the Z-80 it reports parity for logical operations and overflow for arithmetic ...
Illegal opcodes were just instructions that hadn't been fully defined by the chip designers – a little like Undefined Behaviour in C, but much more predictable. Many people called these "undocumented instructions", because they functioned just like ordinary instructions, on the particular versions of the particular chips on which they are found. There was no ...
LOADALL is an undocumented instruction available on the 80286, 80386 and some 486 clones. It provides a means to load all the CPU's registers in one operation, including normally-inaccessible registers (descriptor caches).
Its significance is that it allows extended memory to be accessed on a 286 without switching to protected mode.
On a 8086, memory is ...
MOV changes the N, Z and V flags according to the copied data. JMP doesn't do that. It means you can run e.g. arithmetic operations somewhere, then jump to another location for the compare routine.
Also JMP appears to be 1 cycle faster. The handbook says JMP takes 1 to 3 cycles while MOV take 0 to 4 - maybe because it doesn't set the flags.
Besides the flags, and differences in cycle count, the more important difference is that JMP x uses the effective address of x, while MOV x,R7 uses the value at x. In other words, there's one level less of indirection, similar to the LEA and MOV opcodes for the x86.
So JMP R1 faults, and JMP @R1 is equivalent to MOV R1,R7.
This means one can use JMP d(R7) ...
The opcodes in your list are all only 16 bits (plus the extra bytes for address calculation) and you'll notice that they all begin (in hex) with Dx where x >= 8. This is because, to the 8086, any instruction whose first byte has the bit pattern 11011xxx was deemed to be an 8087 coprocessor instruction.
When the 8086 encountered a floating point opcode, it ...
There are no technical reasons, as any order would work and result in the same amount of gates. More likely it originated in the process by which the 8086 was developed. A main goal was to allow easy conversion of 8080 programs, so the development of the 8086 structure started out from a 8080 programming model. 8080 registers were ordered as 16 bit pairs in ...
Very simple: Because there was room for an address and it improves performance a lot. Or as the manual puts it:
It is important, however, for the programmer to realize that the simplest method of programming (using sequential drum location for succeeding instructions) causes the machine to waste a large amount of time waiting and searching.
To start with,...
Early MOS documentation (KIM-1 Programming Manual, Synertek SY6500/MCS6500 Microcomputer Programming manual, etc) states:
The BIT instruction actually combines two instructions from
the PDP-11 and MC6800, that of TST (Test Memory) and (BIT Test).
In addition to the nondestructive feature of the BIT which
allows us to isolate an ...
Setting and clearing carry, the decimal or interrupt flags is useful:
the carry flag because the 6502 offers only add and subtract with carry;
the decimal flag because it changes the mode of the processor; and
the interrupt flag because it masks or unmasks the maskable interrupt.
Conversely, explicitly setting and clearing the other flags mostly isn't ...
It might be better to think about it this way:
On the 80186 and above, a new thing was defined called an "illegal instruction", and this new thing came with a new behavior -- a #UD exception that was generated when one was encountered. Before the 80186/80286, there was no such thing as an illegal instruction, just undocumented ones.
Your question then ...
Some uses for a bitshift operation:
implementing a more efficient multiplication than repeated adding
implementing division algorithms
implementing an algorithm for exponentiation of integers by other integers
bitwise algorithms e.g. "how many one bits in this integer"
fast multiplication and division by powers of 2 including indexing arrays of integer ...
Besides the matter of semantics and personal taste, there’s a much more practical reason: some instructions sets claim to be copyrighted, as the Wikipedia Z80 article states:
Because Intel claimed a copyright on their assembly mnemonics, a new assembly syntax had to be developed for the Z80. This time a more systematic approach was used.
So, I think the ...
The instruction decode is quite simple on the 6502.
If we call the bits in the opcode byte aaabbbcc, then one of the first things that happens is that cc, the two bits you're talking about, gets converted into a 1-of-3 signal which selects the register. This signal is called G, and is computed like this:
A is true if the bits are 01
X is true if the bits ...
An instruction set can be considered as a Huffman coding of an idealised instruction stream. So the question is really asking which CPUs have a good balance of short encodings for common tasks to longer encodings for rare tasks. However, it is not sufficient to just look at the encoding of individual instructions because a RISC instruction generally does ...
It is all about making one of the most important instructions as performant as possible, while keeping everything manageable for tools at the time (plus a little bit of dogma). The branching is thus the most optimized instruction of the whole 6502 design.
In addition, long branches are not really in demand (*1). Of the 116 branches used in the ...
Because "move" is the typical necessary function
It isn't always this way, of course, but especially with earlier CPUs, there were limited destinations for data from a particular operation - e.g., arithmetic results could only be in certain registers. Or in the other direction, certain functions could only operate on a few locations, typically registers or ...
I'm having a hard time picturing a use for this [BIT]
It's mainly an I/O issue.
The 6502 is in many ways designed especially for control/embedded applications and BIT is a part of this. 6500 specific IO-devices are designed to report any service conditions on bit 7 (and 6). For example the 6522 will set bit 7 of the Interrupt Flag Register when an ...
Below are some architectures with odd word sizes:
Apollo Guidance Computer: 15-bit
Autonetics D-37C Minuteman II Guidance Computer: 27-bit
Electrologica X1, Electrologica X8: 27-bit
Calcomp 900: 9-bit
Gemini Guidance Computer: 39-bit
Note that the register size may be a multiple of the word ...
The HALT condition does not (at least on retro CPUs) consume considerably less power than normal execution does.
One very obvious use case is synchronizing program flow with external (hardware) events. The main use case of the HALT instruction is thus "wait for an interrupt".
A prominent example outside embedded systems is synchronizing video ...
There is simply no need for setting Overflow. The same is as well true for Negative/Sign and Zero. No operation will be influenced by any of them, it's only used to signal an overflow during ADC and SBC (well, and BIT for testing bit#6).
In fact, the question is rather, why there is a CLV present, as there is no reason, within the boundaries of the ...
But how instructions like DEC, DEX and DEY works ?
By adding $FF provided by the precharged internal data bus to the register content.
The internal databus is precharged with $FF during PHI2 (*1)
During the next phase it's loaded into the B register (signal DB/ADD)
At the same time the index register is transfered via SB (*/SB) to the A ...
If you go back a lot before the x86, this technique wasn't unusual at all. In fact, writing programs using printable letters and symbols was pretty much the norm for early computers, except that there was a number of encodings for words of varying bit size, and that encoding was not ASCII.
On the IBM 1401 (1959), a program that looked like
Per Zilog's Z80 user manual:
Two BCD digit rotate instructions (RRD and RLD) allow a digit in the accumulator to be rotated with the two digits in a memory location pointed to by register pair HL (See Figure 10). These instructions allow for efficient BCD arithmetic.
Given that DAA exists for addition and subtraction, I'm going to hazard a guess that the ...
A good example would be reading from the floppy drive on the C64. The incoming clock and data signals of the serial bus are (perhaps not accidentally) wired to bits 6 and 7 of port A on CIA#2, appearing at $DD00.
samples both inputs and stores them in the N and V flags. Jumping back conditionally with
waits while the clock is low, as ...
The TRS-80 series is Z80 based, and Z80 uses, like all 8080 offspring (*1,3) a separate address space for I/O. It allows easy decoding for I/O.
Thus memory address 0000h is different from I/O address 00h.
On logical (program) level, access to either address space is selected by the instructions used. Memory instructions always access memory address space ...
The opcodes are already sorted that way. Just a bit less obvious and schoolbook-like, but optimized to allow compact decoding.
It is all about space saving.
Real chip space and (potential) transistors that is. It's well known that the 6500 design was all about cost saving and the most important factor in chip production cost is its size. Smaller chips mean ...
Ken Shirriff has, as so often, a nice table to start with - especially nice to detect the 'undocumented' ones. All opcodes in lower case are 'undocumented'. With sorting his table according to the 'octal' (2-3-3) decoding logic the 8085 uses (*1), the first are nicely grouped where the 8080 only decoded NOP:
(NOP - Not undocumented, but on the 8080 it ...
It's all about getting systematic, easy to memorise mnemonics, which may reflect some underlaying structure, but most important ease practical use. Exact language is not always a handy one - except you're asking a lawyer :)
So why call the instruction "move"?
Oh, the age old copy-vs-move question. A beloved friend :)
There are many different, ...
The TLE instruction is a modification of the TLU instruction.
TLU (Table LookUp) (Opcode 84) compared a word with a series of consecutive words on the drum and finished as soon as an entry was found being equal or higher. It was meant to find a point in a sorted list.
TLE (Table Lookup Equal) (Opcode 63) is a modification of TLU stopping only when equal, ...