Restored from previous forum. Originally posted by ricardo.
I will try to be more clear about my problem.
Im doing this:
Code: Select all
For i = buffer To (buffer + (length/2)) - 1 Step 4
ChD.w = PeekW(i)
ChI.w = PeekW(i + 2)
If ChD > 32767 Or ChI > 32767
MessageRequester("Oops",Str(Chd),0)
End
EndIf
WriteStringN(Str(ChD))
WriteStringN(Str(ChI))
NewD.w = ChD * (-1)
NewI.w = ChI * (-1)
ChD = NewD
ChI = NewI
PokeW(i,ChD)
PokeW(i + 2,ChI)
Next i
Thats, im trying to change the sign on every word.
If you see, if a word value was > 32767 i get a prompt and the program ends, thats never happens.
But if i read the file with the values readed i get somethig like:
62521
63849
3015<< was * -1 result
1687<< was * -1 result
Those two values are greater than 32767!! But the IF dosent detects it?
I tried to change the .w for .f in the variables that receive the *-1 result and dosent works too.
I have done this same thing in the past (reading from a file) with success, receiving the expected results, thats why i dont get where is the problem.
In my old code (reading from a file) i get values from -32768 to 32767 and its easy to change the sign, try this:
valor.w = -32767
valor = valor * -1
Debug valor
Best Regards
Ricardo
Dont cry anymore...