IIUC, you want to express something like this in assembly:
Code:
int result = n ? -1 : 0;
In that case, using neg+sbb does the trick:
Code:
mov eax, [val]
neg eax
sbb eax, eax
This works since neg sets the carry flag if its operand is non-zero, and clears it otherwise. The sbb instruction then subtracts the carry flag from zero and thus yields -1 for non-zero inputs, and zero otherwise.
Example:
eax contains a non-zero value, say x. neg eax turns this into -x and sets the CF. sbb eax, eax computes eax = eax - eax - cf <-> eax = 0 - CF.
Same drill when eax is zero initially.