ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


6 - Bit Twiddling

Similar to the math codes, these are associated with logical evaluation and comparisons:

and rp asr rp; asr t asrt rp cmp8 rp
Bitwise AND of register value and t, placed into t. Arithmetic shift right of a register value into t and the register, or just t - note that arithmetic shifting preserves the sign. Shift the register value right 't' times; that is, the number of times indicated by the t register. Compare only bottom 8 bits of t register and a register specified by RPTR.
cmp16 lsl rp; lsl t lslt rp lsr rp; lsr t
Compare only bottom 16 bits of t register and a register specified by RPTR. Logical shift left the register value pointer to by RPTR or t. Logical barrel shift left, using the t register to determine how many shifts performed. Logical shift right a register or t.
lsrt rp not rp; not t or rp rol t
Logical barrel shift right, using t for the shift count. Invert the value in the specified register or t. Bitwise OR the value in the specified register with t. Rotate left the t register's value.
ror t xor rp zcmp8 rp zcmp16 rp
Rotate right the value in t. EXCLUSIVE-OR the specified register with t, and place in t. Compare the lower 8 bits of the specified register with zero. Compare the lower 16 bits of the specified register with zero.
zx8 rp; zx8 t zx16 rp; zx16 t
Zero extend the specified register or t after 8 bits - in other words, the top three bytes of the register are filled with zero. Zero extend the specified register or t after 16 bits - in other words, the top two bytes of the register are filled with zero.


Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice