ValueToStringBin
Synopsis
ValueToStringBin(buffer, value, optlen)
A0 D0:32 D1
void ValueToStringBin(APTR, LONG, ULONG);C Prototype
void ConvBin(APTR, LONG, ULONG);Description
Converts a signed 32-bit LONG value into a binary ASCII string.
By default (when optlen is NULL), 32 characters are placed in the buffer. The optlen parameter can be used to specify a different number of output characters.
Inputs
- buffer — Pointer to a buffer that will contain the output string.
- value — The LONG value to convert.
- optlen — Number of characters to place in the output buffer. If NULL, defaults to 32 characters.
Result
The buffer is filled with the binary string representation.
See Also
StringBinToValue, ValueToStringDec, ValueToStringHex
Implementation
The original 68020 assembly implementation:
; (20-Feb-1995) --- ValueToStringBin(buffer, value, optlen) (a0,d0,d1)
_LVOValueToStringBin
movem.l d0/a0,-(sp)
tst.l d1
bne.s ConvBin_NoDefault
moveq #32,d1
ConvBin_NoDefault
andi.w #$FF,d1
subq.b #1,d1
moveq #"0",d2
ConvBin_Loop
btst d1,(sp) ; Fast Code
beq.s ConvBin_Zero
moveq #"1",d2
ConvBin_Zero
move.b d2,(a0)+
moveq #"0",d2
dbf d1,ConvBin_Loop
ConvBin_Exit
movem.l (sp)+,d0/a0
rtsLast updated on