User’s Manual
31
3.4 How to Do It in Assembly Language—Tips and Tricks
3.4.1 Zero HL in 4 Clocks
BOOL HL ; 2 clocks, clears carry, HL is 1 or 0
RR HL
; 2 clocks, 4 total - get rid of possible 1
This sequence requires four clocks compared to six clocks for
LD HL,0
.
3.4.2 Exchanges Not Directly Implemented
HL<->HL' - eight clocks
EX DE',HL
; 2 clocks
EX DE',HL' ; 4 clocks
EX DE',HL ; 2 clocks, 8 total
DE<->DE' - six clocks
EX DE',HL ; 2 clocks
EX DE,HL ; 2 clocks
EX DE',HL ; 2 clocks, 6 total
BC<->BC' - 12 clocks
EX DE',HL ; 2 clocks
EX DE,HL' ; 4
EX DE,HL ; 2
EXX ; 2
EX DE,HL ; 2
Move between IX, IY and DE, DE'
IX/IY->DE / DE->IX/IY
;IX, IX --> DE
EX DE,HL
LD HL,IX/IY / LD IX/IY,HL
EX DE,HL ; 8 clocks total
; DE --> IX/ IY
EX DE,HL
LD IX/IY,HL
EX DE,HL
; 8 clocks total
3.4.3 Manipulation of Boolean Variables
Logical operations involving HL when HL is a logical variable with a value of 1 or 0—
this is important for the C language where the least bit of a 16-bit integer is used to repre-
sent a logical result
Logical not operator—invert bit 0 of HL in four clocks (also works for
IX
,
IY
in eight
clocks)
DEC HL
; 1 goes to zero, zero goes to -1
BOOL HL ; -1 to 1, zero to zero. 4 clocks total
Logical xor operator—
xor HL,DE
when HL/DE are 1 or 0.
ADD HL,DE
RES 1,l ; 6 clocks total, clear bit 1 result of if 1+1=2
Summary of Contents for 2000
Page 1: ...Rabbit 2000 Microprocessor User s Manual 019 0069 041018 M...
Page 12: ...6 Rabbit 2000 Microprocessor...
Page 46: ...40 Rabbit 2000 Microprocessor...
Page 54: ...48 Rabbit 2000 Microprocessor...
Page 76: ...70 Rabbit 2000 Microprocessor...
Page 96: ...90 Rabbit 2000 Microprocessor...
Page 142: ...136 Rabbit 2000 Microprocessor...
Page 154: ...148 Rabbit 2000 Microprocessor...
Page 170: ...164 Rabbit 2000 Microprocessor...
Page 174: ...168 Rabbit 2000 Microprocessor...
Page 180: ...174 Rabbit 2000 Microprocessor...
Page 202: ...196 Rabbit 2000 Microprocessor...
Page 206: ...200 Rabbit 2000 Microprocessor...
Page 226: ......
Page 230: ...224 Rabbit 2000 Microprocessor...