So, you're looking for an algorithm that converts a dword into an ASCII binary string?
Well, I won't do your homework for you, but I'll give you some help. There are different ways you can do this, but here's one method:
You can use the TEST or AND CPU instructions (TEST is more efficient) to see if a bit is set. Since you're converting dwords, your loop should run 32 times.
The algorithm with TEST works like this (I'll use the number 500 in this example.):
1) Use a register (e.g. EDX) to store a number with the value 80000000h. This number has bit 31 set, and the rest of the bits are zero.
2) Use a register as a pointer which points to the start of the Y array.
3) Use a register as a loop counter.
4) TEST EDX with 500.
5) If it's zero, then write the ASCII '0' to the Y array and then increment the array pointer.
6) If it's one, then do the same thing as step 5, but write the ASCII '1' character.
7) Shift EDX to the right once to test the next bit.
8) Decrement your loop counter and jump to step 4 until the loop is done.
Converting a dword to a hex string works by dividing a number (e.g. 500) by 16 in a loop. There is more code required with this algorithm due to the ASCII conversion.