Re: [cc65] optimizer or me?

From: Shawn Jefferson <jefferson_shawn_a8bit1yahoo.com>
Date: 2004-07-15 17:58:26
Uz, the example you gave doesn't give the same code as
my example. Should it?

cl65 -Osir -t atari --listing -T

char i, j;

int main(void) 
{
  i = 0;
  j = i;
  if (j == 0)
    i = 1;
  else
    i = 2;

  return(1);
}

000002r 1               ;
---------------------------------------------------------------
000002r 1               ; int __near__ main (void)
000002r 1               ;
---------------------------------------------------------------
000002r 1               
000002r 1               .segment	"CODE"
000000r 1               
000000r 1               .proc	_main: near
000000r 1               
000000r 1               .segment	"CODE"
000000r 1               
000000r 1               ;
000000r 1               ; i = 0;
000000r 1               ;
000000r 1  A9 00        	lda     #$00
000002r 1  8D rr rr     	sta     _i
000005r 1               ;
000005r 1               ; j = i;
000005r 1               ;
000005r 1  8D rr rr     	sta     _j
000008r 1               ;
000008r 1               ; if (j == 0)
000008r 1               ;
000008r 1  AD rr rr     	lda     _j
00000Br 1  D0 05        	bne     L0007
00000Dr 1               ;
00000Dr 1               ; i = 1;
00000Dr 1               ;
00000Dr 1  A9 01        	lda     #$01
00000Fr 1               ;
00000Fr 1               ; else
00000Fr 1               ;
00000Fr 1  4C rr rr     	jmp     L0010
000012r 1               ;
000012r 1               ; i = 2;
000012r 1               ;
000012r 1  A9 02        L0007:	lda     #$02
000014r 1  8D rr rr     L0010:	sta     _i
000017r 1               ;
000017r 1               ; return(1);
000017r 1               ;
000017r 1  A2 00        	ldx     #$00
000019r 1  A9 01        	lda     #$01
00001Br 1               ;
00001Br 1               ; }
00001Br 1               ;
00001Br 1  60           	rts
00001Cr 1               
00001Cr 1               .endproc
00001Cr 1

--
Shawn               


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jul 15 18:02:11 2004

This archive was generated by hypermail 2.1.8 : 2004-07-15 18:02:21 CEST