Changes

Z80

185 bytes added, 10 March
/* Z80 Instructions */
|-
| srl (I+D)->R || 11i11101 11001011 dddddddd 00111rrr || 7 || 23 (4,4,3,5,4,3) || 0 || + || + || 0 || + || P || 0 || X || cf := (I+D).0, (I+D) := R := (I+D) >> 1
|}
 
=== Block group ===
 
{| class="wikitable" style="white-space: nowrap;"
|-
! Instruction !! Opcode !! NOPs !! Cycles !! S !! Z !! 5 !! H !! 3 !! P !! N !! C !! Effect !! Description
|-
| cpd || 11101101 10101001 || 4 || 16 (4,4,3,5) || + || + || X || + || X || C || 1 || - || tmp := a - (hl) => flags, bc -= 1, hl -= 1,
f5 := [tmp - hf].1, f3 = [tmp - hf].3
|| Compare and Decrement
|-
| cpdr || 11101101 10111001 || 6/4 || 21/16 (4,4,3,5,5)/(4,4,3,5) || + || + || X || + || X || C || 1 || - || cpd, if bc <> 0 and nz then pc -= 2 || Compare and Decrement, Repeat
|-
| cpi || 11101101 10100001 || 4 || 16 (4,4,3,5)|| + || + || X || + || X || C || 1 || - || tmp := a - (hl) => flags, bc -= 1, hl += 1,
f5 := [tmp - hf].1, f3 = [tmp - hf].3
|| Compare and Increment
|-
| cpir || 11101101 10110001 || 6/4 || 21/16 (4,4,3,5,5)/(4,4,3,5) || + || + || X || + || X || C || 1 || - || cpi, if bc <> 0 and nz then pc -= 2 || Compare and Increment, Repeat
|-
| ldd || 11101101 10101000 || 5 || 16 (4,4,3,5) || - || - || X || 0 || X || C || 0 || - || tmp := (hl), (de) := tmp, de -= 1, hl -= 1,
bc -= 1, f5 := [tmp + a].1, f3 := [tmp + a].3
|| Load and Decrement
|-
| lddr || 11101101 10111000 || 6/5 || 21/16 (4,4,3,5,5)/(4,4,3,5) || - || - || X || 0 || X || C || 0 || - || ldd, if bc <> 0 then pc -= 2 || Load and Decrement, Repeat
|-
| ldi || 11101101 10100000 || 5 || 16 (4,4,3,5) || - || - || X || 0 || X || C || 0 || - || tmp := (hl), (de) := tmp, de += 1, hl += 1,
bc -= 1, f5 := [tmp + a].1, f3 := [tmp + a].3
|| Load and Increment
|-
| ldir || 11101101 10110000 || 6/5 || 21/16 (4,4,3,5,5)/(4,4,3,5) || - || - || X || 0 || X || C || 0 || - || ldi, if bc <> 0 then pc -= 2 || Load and Increment, Repeat
|-
| ind || 11101101 10101010 || 5 || 16 (4,5,4,3) || + || + || + || X || + || X || X || X || tmp := ((c)), (hl) := tmp, hl -= 1,
b -= 1 => flags, nf := tmp.7,
 
tmp2 = tmp + [[c - 1] AND 0xff],
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Input and Decrement
|-
| indr || 11101101 10111010 || 6/5 || 21/16 (4,5,4,3,5)/(4,5,4,3) || + || + || + || X || + || X || X || X || ind, if b <> 0 then pc -= 2 || I/O Input and Decrement, Repeat
|-
| ini || 11101101 10100010 || 5 || 16 (4,5,4,3) || + || + || + || X || + || X || X || X || tmp := ((c)), (hl) := tmp, hl += 1,
b -= 1 => flags, nf := tmp.7,
 
tmp2 := tmp + [[c + 1] AND 0xff],
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Input and Increment
|-
| inir || 11101101 10110010 || 6/5 || 21/16 (4,5,4,3,5)/(4,5,4,3) || + || + || + || X || + || X || X || X || ini, if b <> 0 then pc -= 2 || I/O Input and Increment, Repeat
|-
| outd || 11101101 10101011 || 5 || 16 (4,5,3,4) || + || + || + || X || + || X || X || X || tmp := (hl), ((c)) := tmp, hl -= 1,
b -= 1 => flags, nf := tmp.7, tmp2 = tmp + l,
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Output and Decrement
|-
| otdr || 11101101 10111011 || 6/5 || 21/16 (4,5,3,4,5)/(4,5,3,4) || + || + || + || X || + || X || X || X || outd, if b <> 0 then pc -= 2 || I/O Output and Decrement, Repeat
|-
| outi || 11101101 10100011 || 5 || 16 (4,5,3,4) || + || + || + || X || + || X || X || X || tmp := (hl), ((c)) := tmp, hl += 1,
b -= 1 => flags, nf := tmp.7, tmp2 = tmp + l,
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Output and Increment
|-
| otir || 11101101 10110011 || 6/5 || 21/16 (4,5,3,4,5)/(4,5,3,4) || + || + || + || X || + || X || X || X || outi, if b <> 0 then pc -= 2 || I/O Output and Increment, Repeat
|}
|-
| ccf || 00111111 || 1 || 4 (4) || - || - || A || X || A || - || 0 || X || hf := cf, cf := ~cf || Complement Carry Flag
|-
| cpd || 11101101 10101001 || 4 || 16 (4,4,3,5) || + || + || X || + || X || C || 1 || - || tmp := a - (hl) => flags, bc -= 1, hl -= 1,
f5 := [tmp - hf].1, f3 = [tmp - hf].3
|| Compare and Decrement
|-
| cpdr || 11101101 10111001 || 6/4 || 21/16 (4,4,3,5,5)/(4,4,3,5) || + || + || X || + || X || C || 1 || - || cpd, if bc <> 0 and nz then pc -= 2 || Compare and Decrement, Repeat
|-
| cpi || 11101101 10100001 || 4 || 16 (4,4,3,5)|| + || + || X || + || X || C || 1 || - || tmp := a - (hl) => flags, bc -= 1, hl += 1,
f5 := [tmp - hf].1, f3 = [tmp - hf].3
|| Compare and Increment
|-
| cpir || 11101101 10110001 || 6/4 || 21/16 (4,4,3,5,5)/(4,4,3,5) || + || + || X || + || X || C || 1 || - || cpi, if bc <> 0 and nz then pc -= 2 || Compare and Increment, Repeat
|-
| cpl || 00101111 || 1 || 4 (4) || - || - || + || 1 || + || - || 1 || - || a := ~a || Complement
|-
| inc I || 11i11101 00100011 || 3 || 10 (4,6) || - || - || - || - || - || - || - || - || I += 1
|-
| ind || 11101101 10101010 || 5 || 16 (4,5,4,3) || + || + || + || X || + || X || X || X || tmp := ((c)), (hl) := tmp, hl -= 1,
b -= 1 => flags, nf := tmp.7,
 
tmp2 = tmp + [[c - 1] AND 0xff],
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Input and Decrement
|-
| indr || 11101101 10111010 || 6/5 || 21/16 (4,5,4,3,5)/(4,5,4,3) || + || + || + || X || + || X || X || X || ind, if b <> 0 then pc -= 2 || I/O Input and Decrement, Repeat
|-
| ini || 11101101 10100010 || 5 || 16 (4,5,4,3) || + || + || + || X || + || X || X || X || tmp := ((c)), (hl) := tmp, hl += 1,
b -= 1 => flags, nf := tmp.7,
 
tmp2 := tmp + [[c + 1] AND 0xff],
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Input and Increment
|-
| inir || 11101101 10110010 || 6/5 || 21/16 (4,5,4,3,5)/(4,5,4,3) || + || + || + || X || + || X || X || X || ini, if b <> 0 then pc -= 2 || I/O Input and Increment, Repeat
|}
|-
| ld sp,I || 11i11101 11111001 || 3 || 10 (4,6) || - || - || - || - || - || - || - || - || sp := I
|-
| ldd || 11101101 10101000 || 5 || 16 (4,4,3,5) || - || - || X || 0 || X || C || 0 || - || tmp := (hl), (de) := tmp, de -= 1, hl -= 1,
bc -= 1, f5 := [tmp + a].1, f3 := [tmp + a].3
|| Load and Decrement
|-
| lddr || 11101101 10111000 || 6/5 || 21/16 (4,4,3,5,5)/(4,4,3,5) || - || - || X || 0 || X || C || 0 || - || ldd, if bc <> 0 then pc -= 2 || Load and Decrement, Repeat
|-
| ldi || 11101101 10100000 || 5 || 16 (4,4,3,5) || - || - || X || 0 || X || C || 0 || - || tmp := (hl), (de) := tmp, de += 1, hl += 1,
bc -= 1, f5 := [tmp + a].1, f3 := [tmp + a].3
|| Load and Increment
|-
| ldir || 11101101 10110000 || 6/5 || 21/16 (4,4,3,5,5)/(4,4,3,5) || - || - || X || 0 || X || C || 0 || - || ldi, if bc <> 0 then pc -= 2 || Load and Increment, Repeat
|}
|-
| out (c),0 || 11101101 01110001 || 4 || 12 (4,4,4) || - || - || - || - || - || - || - || - || ((c)) := 0 (255 on CMOS CPU)
|-
| outd || 11101101 10101011 || 5 || 16 (4,5,3,4) || + || + || + || X || + || X || X || X || tmp := (hl), ((c)) := tmp, hl -= 1,
b -= 1 => flags, nf := tmp.7, tmp2 = tmp + l,
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Output and Decrement
|-
| otdr || 11101101 10111011 || 6/5 || 21/16 (4,5,3,4,5)/(4,5,3,4) || + || + || + || X || + || X || X || X || outd, if b <> 0 then pc -= 2 || I/O Output and Decrement, Repeat
|-
| outi || 11101101 10100011 || 5 || 16 (4,5,3,4) || + || + || + || X || + || X || X || X || tmp := (hl), ((c)) := tmp, hl += 1,
b -= 1 => flags, nf := tmp.7, tmp2 = tmp + l,
 
pf := parity of [[tmp2 AND 0x07] XOR b],
 
hf := cf := tmp2 > 255
|| I/O Output and Increment
|-
| otir || 11101101 10110011 || 6/5 || 21/16 (4,5,3,4,5)/(4,5,3,4) || + || + || + || X || + || X || X || X || outi, if b <> 0 then pc -= 2 || I/O Output and Increment, Repeat
|}
13,173
edits