oldval var byte
newval var byte
oldval = %01010101 'just an example value
newval = %110 'but you don't want this into the lower 3 bits, you want it in bits2,3,4...
newval = newval << 1 'shift the newval bits left one position
oldval = oldval AND %11110001 'clear out old bits that you want to replace
oldval = oldval | newval 'bitwise OR to set the bits
It's not one command...I don't think you'll ever get away with trying to use one command. Too many situations, too many (pardon the pun) variables.
Bookmarks