Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/18/02 22:04
Read: times


 
#34689 - Possible sdcc bug
Just a quicky possible sdcc bug found in the following code

if(video_buffer[tempY][tempX]==1){


if(direction==0) area+=(yy+1);yy++;
if(direction==1)area+=yy;
if(direction==2)area+=(yy-1);yy--;
if(direction==3)yy++;
if(direction==4)break;
if(direction==5)yy--;
if(direction==6)area-=(yy+1);yy++;
if(direction==7) area-=yy;
if(direction==8) area-=(yy-1);yy--;

I know I should use switch and case but that is not the point the interesting bit is the test for direction==6 compiles ok but the assembler fails producing the following bit of code.
mov a,#0x01
add a,_yy
clr c
mov a,_area
subb a,a
mov area,a
inc _yy

if I change the code to if(direction==6)area-=(yy-1);yy++;

mov a,_yy
dec a
mov r7,a
clr c
mov a,_area
subb a,r7
mov _area,a
inc _yy

If anyone can think of a good reason why it does this I would be grateful,
anyway I am supposed to be on holiday.



List of 8 messages in thread
TopicAuthorDate
Possible sdcc bug            01/01/70 00:00      
RE: Possible sdcc bug            01/01/70 00:00      
RE: Possible sdcc bug            01/01/70 00:00      
RE: Possible sdcc bug            01/01/70 00:00      
RE: Possible sdcc bug            01/01/70 00:00      
RE: Possible sdcc bug -- J.            01/01/70 00:00      
RE: Possible sdcc bug -- J.            01/01/70 00:00      
RE: Possible sdcc bug            01/01/70 00:00      

Back to Subject List