I have a simple high level assembly program, where I am learning the ins and outs of bit shifting and rotation. I have this simple program to play around with shifting the bits in a single byte.
static
var: int8 := 127;
begin test1;
stdout.put(var, nl);
shl(1, var);
stdout.put(var, nl);
if (@C) then stdout.put("carry set"); endif;
end test1;
As the byte is set to 127, it should be 01111111.
Surely by shifting left once, the carry flag should be raised as the last bit is reserved for signing?
This is not what appears to happen however, indeed all the bytes shift left once so the byte is now 11111110, or -2.
If this happens every time, what conditions would cause the carry flag to be set?
Platform is win 7 64bit