[cc65] Assembler code from C

From: Apple2Stuff <apple2stuff1rogers.com>
Date: 2004-03-17 05:56:05
I have a question about the code being generated by the complier.

Here is the source code

In the header we have 

#define INT_STATUS(i)  (I2CHIP_BASE + 0x04 + i)

In the listing we see

001203r 1               ; I_STATUS[0] = IndirectReadByte(INT_STATUS(0));
001203r 1               ;
001203r 1  A9 04         lda     #$04
001205r 1  20 rr rr      jsr     push4
001208r 1  20 rr rr      jsr     _IndirectReadByte
00120Br 1  8D rr rr      sta     _I_STATUS
00120Er 1               ;

and 

001221r 1               ; I_STATUS[1] = IndirectReadByte(INT_STATUS(1));
001221r 1               ;
001221r 1  A9 05         lda     #$05
001223r 1  20 rr rr      jsr     push5
001226r 1  20 rr rr      jsr     _IndirectReadByte
001229r 1  8D rr rr      sta     _I_STATUS+1

and so on

Why load A twice with the same value?

using OPT=-Or


Glenn


Personal Website: http://members.rogers.com/rg.jones/
Apple Specific Website http://members.rogers.com/apple2stuff/apple.htm
Email: Reply to apple2stuff at rogers dot com 
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Mar 17 05:56:59 2004

This archive was generated by hypermail 2.1.8 : 2004-03-17 05:57:05 CET