Re: [cc65] Zeropage Vars

From: Tachdaun <tachdaun1gmail.com>
Date: 2009-02-06 18:53:31
Thanks!
very useful info.

Ullrich von Bassewitz wrote:
For a variable to be accessible from C, there must be two conditions met:

  1. The symbol must be .export'ed from an object file somewhere.

  2. The symbol must begin with an underscore, which is automatically
     prepended to all external C identifiers.

The tickcount symbol doesn't meet either condition, so you cannot use it from
C as is.

But there's a simple workaround. Write a small assembler module containing

        .include        "nes.inc"
        _tickcount      := tickcount
        .exportzp       _tickcount

and link the resulting .o file to your application. This will enable you to
use tickcount as described in one of my last mails

  
How's the correct way to do this? if it's possible?
Does #pragma zpsym() create a var in the zp?
    
You can answer questions like this yourself: Just compile your sources using
the "-g" and "-T" command line switches. The former will add debug infos, so
code is attributed with line numbers of the source file, while the latter will
add the actual source file lines to the assembly. Checking the assembly code
will show exactly what code was generated for each C source line.

Regards


        Uz


  
---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail. Received on Fri Feb 6 17:54:36 2009

This archive was generated by hypermail 2.1.8 : 2009-02-06 17:54:38 CET