Re: [cc65] CC65 and Stack Pointer

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2006-11-28 19:30:37
Good evening.

On Wed, Nov 29, 2006 at 03:16:41AM +0900, Hiroji Kimura wrote:
> 1. Is it correct to say there are two stacks in the system? The true
> hardware stack provided by the 6502 and the stack used by the code
> generated by cc65.

Yes.

> 2. Does our way of initializing the sp have any flaws?

That depends on your memory setup. Provided that you have a system with free
RAM at $FFF0, it should work. A better way is to setup stack addresses in the
linker config and just reference them in the startup code. This way, you don't
have to change the source code (start.s) if you want to move the stack. Just
change the linker config and relink.

> 3. Upon entering the interrupt handler do we need to push registers and
> pop them before RTI?

If you're calling C code, you will also have to save the zero page locations
used by the compiler. If your interrupt handler doesn't use C code, saving
just the registers is ok.

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 Nov 28 19:30:53 2006

This archive was generated by hypermail 2.1.8 : 2006-11-28 19:30:56 CET