Re: [cc65] Odd problems creating a new target.

From: L. Adamson <leaf1dizzydragon.net>
Date: 2012-06-23 23:34:37
On Sat, Jun 23, 2012 at 1:57 PM, Shawn Jefferson <sjefferson@shaw.ca> wrote:

> **
>
> Have you verified that sp actually contains what you think it does?  It
> seems to be (based on the mapfile) at zeropage location $00…
>

I'm going to get confused, unless I refer to the stack pointers explicitly
as the CPU stack pointer and the C stack pointer. :P

I checked out the CPU SP right before I went to bed.  It turns out that
there /is/ a (known) bug in the emulator (mirroring a bug in the "real"
CPU) where it places the CPU SP at 0x2FF if you TXS 0xFF into the CPU SP
while the stack is empty.  I "fixed" this by pushing a zero onto the stack
before TXSing, which properly sets it to 0x1FF, but saw no change in the
program's behavior, other than the stack growing and shrinking from 0x1FF
rather than 0x2FF.  Returning from procedures seems to work either way, as
the area from 0x200-0x2FF is not being used by anything other than the
bundled FORTH 'terp, which I've not been loading at all.

Later today, I plan to copy some of the C SP routines out of the cc65
source tree into the library source tree and insert some debugging stuff so
I can watch what it is doing more easily.


Doing a bit of googling, and it seems the 65EL02 may have separate stacks
> for parameters and for return addresses?
>

It sort of does.  The area from 0x100-0x1FF is used for the hardware stack
as usual, and the area from 0x200-0x2FF is used for a parameter stack (but
only by the FORTH interpreter bundled with the machine, I /think/).

I don't think there is anything radically different about the EL02 hardware
stack.  Chatting with a fellow who ported 6502 MS-BASIC to it leads me to
believe that things work as expected once the TSX bug has been worked
around.  I'm fairly certain that the problem is somewhere in my code, or
something I'm not doing that I should be, rather than some kind of
incompatibility.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Jun 23 23:35:21 2012

This archive was generated by hypermail 2.1.8 : 2012-06-23 23:35:24 CEST