Re: [cc65] 65C02 indirect zeropage questions

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-06-04 10:27:25
Hi!

On Thu, Jun 03, 2004 at 07:32:21PM -0700, Shawn Jefferson wrote:
> How do you use indirect zeropage addressing in ca65
> (with --cpu 65C02)?  I want to do:
>
> LDA ($20) and STA ($20) but it says illegal addressing
> mode.

Works here without problems:

--------------------------------------------------------------------------
ca65 V2.10.5 - (C) Copyright 1998-2004 Ullrich von Bassewitz
Main file   : t.s
Current file: t.s

000000r 1
000000r 1  B2 00                lda     ($00)
000002r 1  92 00                sta     ($00)
000004r 1
000004r 1
000004r 1
--------------------------------------------------------------------------

> Can you define and use a variable that was declared
> zeropage, and exported with exportzp in a C program?

Yes. This is what

        #pragma zpsym ("foo");

is for.

> Do you do this in C:
> extern unsigned char zpvar;

You need an additional

        #pragma zpsym ("zpvar");

to let the compiler know that this is a zeropage variable and emit the correct
import statement.

> and can this work with a struct declaration like this:
> extern struct MYSTRUCT zpvar;

Yes, it does work. However, the compiler won't treat such variables special
besides importing them with .importzp instead of .import.

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 Fri Jun 4 10:27:28 2004

This archive was generated by hypermail 2.1.8 : 2004-06-04 10:27:36 CEST