Difference between revisions of "User:CoBB"
From WikiTI
(→Z80 instruction set) |
(→Z80 instruction set) |
||
Line 7: | Line 7: | ||
! Instruction !! Opcode !! Time !! S !! Z !! X !! H !! Y !! P !! N !! C !! Effect | ! Instruction !! Opcode !! Time !! S !! Z !! X !! H !! Y !! P !! N !! C !! Effect | ||
|- | |- | ||
− | | | + | | adc a,R || <tt>10001rrr</tt> || 4 || + || + || + || + || + || V || 0 || + || a += R + cf |
|- | |- | ||
− | | | + | | adc a,N || <tt>11001110 nnnnnnnn</tt> || 7 || + || + || + || + || + || V || 0 || + || a += N + cf |
|- | |- | ||
− | | | + | | adc a,(hl) || <tt>10001110</tt> || 7 || + || + || + || + || + || V || 0 || + || a += (hl) + cf |
|- | |- | ||
− | | | + | | adc a,(ix+D) || <tt>11011101 10001110 dddddddd</tt> || 19 || + || + || + || + || + || V || 0 || + || a += (ix+D) + cf |
|- | |- | ||
− | | push P || <tt> | + | | adc a,(iy+D) || <tt>11111101 10001110 dddddddd</tt> || 19 || + || + || + || + || + || V || 0 || + || a += (iy+D) + cf |
+ | |- | ||
+ | | adc hl,Q || <tt>11101101 01qq1010</tt> || 15 || + || + || + || + || + || V || 0 || + || hl += Q + cf | ||
+ | |- | ||
+ | | add a,R || <tt>10000rrr</tt> || 4 || + || + || + || + || + || V || 0 || + || a += R | ||
+ | |- | ||
+ | | add a,N || <tt>11000110 nnnnnnnn</tt> || 7 || + || + || + || + || + || V || 0 || + || a += N | ||
+ | |- | ||
+ | | add a,(hl) || <tt>10000110</tt> || 7 || + || + || + || + || + || V || 0 || + || a += (hl) | ||
+ | |- | ||
+ | | add a,(ix+D) || <tt>11011101 10000110 dddddddd</tt> || 19 || + || + || + || + || + || V || 0 || + || a += (ix+D) | ||
+ | |- | ||
+ | | add a,(iy+D) || <tt>11111101 10000110 dddddddd</tt> || 19 || + || + || + || + || + || V || 0 || + || a += (iy+D) | ||
+ | |- | ||
+ | | add hl,Q || <tt>00qq1001</tt> || 11 || - || - || + || + || + || - || 0 || + || hl += Q + cf | ||
+ | |- | ||
+ | | add ix,Q || <tt>11011101 00qq1001</tt> || 15 || - || - || + || + || + || - || 0 || + || ix += Q + cf | ||
+ | |- | ||
+ | | add iy,Q || <tt>11111101 00qq1001</tt> || 15 || - || - || + || + || + || - || 0 || + || iy += Q + cf | ||
+ | |- | ||
+ | | call A || <tt>11001101 alalalal ahahahah</tt> || 17 || - || - || - || - || - || - || - || - || sp -= 2, (sp) := pc, pc := A | ||
+ | |- | ||
+ | | ccf || <tt>00111111</tt> || 4 || - || - || A || X || A || - || 0 || X || hf := cf, cf := ~cf | ||
+ | |- | ||
+ | | ld R1,R2 || <tt>01rrrsss</tt> || 4 || - || - || - || - || - || - || - || - || R1 := R2 | ||
+ | |- | ||
+ | | pop P || <tt>11pp0001</tt> || 10 || - || - || - || - || - || - || - || - || P := (sp), sp += 2 | ||
+ | |- | ||
+ | | push P || <tt>11pp0101</tt> || 11 || - || - || - || - || - || - || - || - || sp -= 2, (sp) := P | ||
|- | |- | ||
| ret || <tt>11001001</tt> || 10 || - || - || - || - || - || - || - || - || pc := (sp), sp += 2 | | ret || <tt>11001001</tt> || 10 || - || - || - || - || - || - || - || - || pc := (sp), sp += 2 | ||
Line 24: | Line 52: | ||
! Notation !! Meaning !! Respective opcode bits | ! Notation !! Meaning !! Respective opcode bits | ||
|- | |- | ||
− | | A || 16-bit address || | + | | A || 16-bit address || alalalal ahahahah |
+ | |- | ||
+ | | D || 8-bit signed relative offset || dddddddd | ||
+ | |- | ||
+ | | N || 8-bit immediate || nnnnnnnn | ||
|- | |- | ||
− | | P || 16-bit register pair: bc, de, hl, af || 00, 01, 10, 11 | + | | P || 16-bit register pair: bc, de, hl, af || pp = 00, 01, 10, 11 |
|- | |- | ||
− | | Q || 16-bit register: bc, de, hl, sp || 00, 01, 10, 11 | + | | Q || 16-bit register: bc, de, hl, sp || qq = 00, 01, 10, 11 |
|- | |- | ||
− | | R || 8-bit general purpose register: a, b, c, d, e, h, l || 111, 000, 001, 010, 011, 100, 101 | + | | R || 8-bit general purpose register: a, b, c, d, e, h, l || rrr (or sss) = 111, 000, 001, 010, 011, 100, 101 |
|} | |} | ||
=== Flags === | === Flags === | ||
* - = no change | * - = no change | ||
+ | * + = change by definition: | ||
+ | ** S = sign, bit 7 of the result byte (accumulator or high byte for 16-bit operations) | ||
+ | ** Z = zero, set if the result is zero (8 or 16-bit value) | ||
+ | ** X = undocumented, bit 5 of the result byte | ||
+ | ** H = half-carry, the carry of the low nibble of the result byte | ||
+ | ** Y = undocumented, bit 3 of the result byte | ||
+ | ** P = parity (set if the result byte has an even number of bits set) or overflow (set when crossing the boundary of the signed range); always specified | ||
+ | ** N = negative, set if the previous operation was a subtraction; always specified | ||
+ | ** C = carry, the theoretical bit 8 of the result byte | ||
* 0 = always reset | * 0 = always reset | ||
* 1 = always set | * 1 = always set | ||
− | * X = change | + | * X = change described under Effect |
− | * | + | * P = parity (only for the parity flag) |
+ | * V = overflow (only for the parity flag) | ||
+ | * A = OR with the respective bit of the accumulator |
Revision as of 23:46, 25 February 2006
About this page
Ez az én kis játszóterem.
Z80 instruction set
Reference
Instruction | Opcode | Time | S | Z | X | H | Y | P | N | C | Effect |
---|---|---|---|---|---|---|---|---|---|---|---|
adc a,R | 10001rrr | 4 | + | + | + | + | + | V | 0 | + | a += R + cf |
adc a,N | 11001110 nnnnnnnn | 7 | + | + | + | + | + | V | 0 | + | a += N + cf |
adc a,(hl) | 10001110 | 7 | + | + | + | + | + | V | 0 | + | a += (hl) + cf |
adc a,(ix+D) | 11011101 10001110 dddddddd | 19 | + | + | + | + | + | V | 0 | + | a += (ix+D) + cf |
adc a,(iy+D) | 11111101 10001110 dddddddd | 19 | + | + | + | + | + | V | 0 | + | a += (iy+D) + cf |
adc hl,Q | 11101101 01qq1010 | 15 | + | + | + | + | + | V | 0 | + | hl += Q + cf |
add a,R | 10000rrr | 4 | + | + | + | + | + | V | 0 | + | a += R |
add a,N | 11000110 nnnnnnnn | 7 | + | + | + | + | + | V | 0 | + | a += N |
add a,(hl) | 10000110 | 7 | + | + | + | + | + | V | 0 | + | a += (hl) |
add a,(ix+D) | 11011101 10000110 dddddddd | 19 | + | + | + | + | + | V | 0 | + | a += (ix+D) |
add a,(iy+D) | 11111101 10000110 dddddddd | 19 | + | + | + | + | + | V | 0 | + | a += (iy+D) |
add hl,Q | 00qq1001 | 11 | - | - | + | + | + | - | 0 | + | hl += Q + cf |
add ix,Q | 11011101 00qq1001 | 15 | - | - | + | + | + | - | 0 | + | ix += Q + cf |
add iy,Q | 11111101 00qq1001 | 15 | - | - | + | + | + | - | 0 | + | iy += Q + cf |
call A | 11001101 alalalal ahahahah | 17 | - | - | - | - | - | - | - | - | sp -= 2, (sp) := pc, pc := A |
ccf | 00111111 | 4 | - | - | A | X | A | - | 0 | X | hf := cf, cf := ~cf |
ld R1,R2 | 01rrrsss | 4 | - | - | - | - | - | - | - | - | R1 := R2 |
pop P | 11pp0001 | 10 | - | - | - | - | - | - | - | - | P := (sp), sp += 2 |
push P | 11pp0101 | 11 | - | - | - | - | - | - | - | - | sp -= 2, (sp) := P |
ret | 11001001 | 10 | - | - | - | - | - | - | - | - | pc := (sp), sp += 2 |
Legend
Notation | Meaning | Respective opcode bits |
---|---|---|
A | 16-bit address | alalalal ahahahah |
D | 8-bit signed relative offset | dddddddd |
N | 8-bit immediate | nnnnnnnn |
P | 16-bit register pair: bc, de, hl, af | pp = 00, 01, 10, 11 |
Q | 16-bit register: bc, de, hl, sp | qq = 00, 01, 10, 11 |
R | 8-bit general purpose register: a, b, c, d, e, h, l | rrr (or sss) = 111, 000, 001, 010, 011, 100, 101 |
Flags
- - = no change
- + = change by definition:
- S = sign, bit 7 of the result byte (accumulator or high byte for 16-bit operations)
- Z = zero, set if the result is zero (8 or 16-bit value)
- X = undocumented, bit 5 of the result byte
- H = half-carry, the carry of the low nibble of the result byte
- Y = undocumented, bit 3 of the result byte
- P = parity (set if the result byte has an even number of bits set) or overflow (set when crossing the boundary of the signed range); always specified
- N = negative, set if the previous operation was a subtraction; always specified
- C = carry, the theoretical bit 8 of the result byte
- 0 = always reset
- 1 = always set
- X = change described under Effect
- P = parity (only for the parity flag)
- V = overflow (only for the parity flag)
- A = OR with the respective bit of the accumulator