cancel
Showing results for 
Search instead for 
Did you mean: 

Devgurus Discussion

albert_redditt
Journeyman III

Feature Request

How about a fast way to load a memory location with bits from a register..

8 bit memory location named bits..

Then an asm instruction , to copy each bit of the register to the corresponding memory location..

mov ax , byte

mov @bits , ax

then bits = 8 binary digits of ax..

It would be a godsend of a feature.. saving lots of processor cycles..

0 Likes
1 Reply
albert_redditt
Journeyman III

Currently I've been using this code..

It's the fastest way I've found so far..

dim as string bits = ""
dim as string n1 = "00000000"
dim as ubyte in

for a as longint = 0 to len( chrs ) - 1 step 1
in = chrs[a]
n1[7] = 48 + in mod 2 : in = in shr 1
n1[6] = 48 + in mod 2 : in = in shr 1
n1[5] = 48 + in mod 2 : in = in shr 1
n1[4] = 48 + in mod 2 : in = in shr 1
n1[3] = 48 + in mod 2 : in = in shr 1
n1[2] = 48 + in mod 2 : in = in shr 1
n1[1] = 48 + in mod 2 : in = in shr 1
n1[0] = 48 + in
bits+= n1
next

0 Likes