Re: [cc65] indirect load question...

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-03-04 14:08:00
On Wed, Mar 04, 2009 at 07:31:07AM +0100, Spiro Trikaliotis wrote:
> > #include <peekpoke.h>
> > #define MOUSE_PTR 0x0284
> > unsigned char a=PEEK(MOUSE_PTR);
>
> Indeed, this seems to be the most efficient way to do it. Sad, isn't it?

It is not the only one. Structures in memory are also highly efficient.

------------------------------------------------------------------------------
/* Define a structure with the 6526 register offsets. */
struct __6526 {
    unsigned char	prb;	   	/* Port register B */
    unsigned char	pra;	   	/* Port register A */
    ...
};

#define CIA1	(*(struct __6526*)0xDC00)

void func (void)
{
    CIA1.prb = 0x03;
    ...
}
------------------------------------------------------------------------------

Using "const" for optimizing is difficult, because the C standard does not
guarantee that these values won't change. So "const" does not always mean
"reads always the same value" in C.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
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 4 14:09:36 2009

This archive was generated by hypermail 2.1.8 : 2009-03-04 14:09:38 CET