Adrian Hudson
Member
I want to convert a the number 0 to 8 to the equivalent number of bits as efficiently as possible
e.g
3 -> 00000111
5 -> 00011111
Sort of like the DCD command but with bit filling
The obvious way is to shift in a bit in a loop
b0 = 6 ; (for example)
do while b0 > 0
b1 = b1 * 2 + 1
dec b0
loop
Does anyone know a whizzo quick way to do this please?
e.g
3 -> 00000111
5 -> 00011111
Sort of like the DCD command but with bit filling
The obvious way is to shift in a bit in a loop
b0 = 6 ; (for example)
do while b0 > 0
b1 = b1 * 2 + 1
dec b0
loop
Does anyone know a whizzo quick way to do this please?