// 128 64 32 16 8 4 2 1
//255 1111 1111 -0
//254 1111 1110 -1
//253 1111 1101 -2
//251 1111 1011 -4
//247 1111 0111 -8
//239 1110 1111 -16
//223 1101 1111 -32
//191 1011 1111 -64
//127 0111 1111 -128
int main(){
int p =0xff;
int q=1,c=0,temp=p;
while(1){
if(p<=255){
printf("%d\n",temp);
temp=p-(q<<c++);
if(temp<127){
temp=p;
c=0;
printf("%n");
}
}
}
}
stc89c52
运行结果