Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
42
Task/Binary-digits/OxygenBasic/binary-digits.basic
Normal file
42
Task/Binary-digits/OxygenBasic/binary-digits.basic
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
function BinaryBits(sys n) as string
|
||||
string buf=nuls 32
|
||||
sys p=strptr buf
|
||||
sys le
|
||||
mov eax,n
|
||||
mov edi,p
|
||||
mov ecx,32
|
||||
'
|
||||
'STRIP LEADING ZEROS
|
||||
(
|
||||
dec ecx
|
||||
jl fwd done
|
||||
shl eax,1
|
||||
jnc repeat
|
||||
)
|
||||
'PLACE DIGITS
|
||||
'
|
||||
mov byte [edi],49 '1'
|
||||
inc edi
|
||||
(
|
||||
cmp ecx,0
|
||||
jle exit
|
||||
mov dl,48 '0'
|
||||
shl eax,1
|
||||
(
|
||||
jnc exit
|
||||
mov dl,49 '1'
|
||||
)
|
||||
mov [edi],dl
|
||||
inc edi
|
||||
dec ecx
|
||||
repeat
|
||||
)
|
||||
done:
|
||||
'
|
||||
sub edi,p
|
||||
mov le,edi
|
||||
if le then return left buf,le
|
||||
return "0"
|
||||
end function
|
||||
|
||||
print BinaryBits 0xaa 'result 10101010
|
||||
Loading…
Add table
Add a link
Reference in a new issue