Re: [cc65] Zeropage Vars

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-02-03 20:25:18
On Tue, Feb 03, 2009 at 10:57:34AM -0300, Tachdaun wrote:
> Hi, is there a way to access Zeropage memory from C?
> I suspect there are special opcodes to deal with zeropage, and thus it
> may only be accessible from __asm{}

You can either use absolute addresses like this:

        #include <peekpoke.h>
        ...
        POKE (0x34, 0xAA);

or external zero page symbols like this:

        extern char foo;
        #pragma zpsym (foo);
        ...
        foo = 0xAA;

In the latter case, the symbol must be defined somewhere, usually in an
assembler file.

> Anyway, is this specific to each platform or generic to 6502?

Specific locations are platform dependent, the zeropage itself is a 6502
feature.

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 Tue Feb 3 20:27:51 2009

This archive was generated by hypermail 2.1.8 : 2009-02-03 20:27:53 CET