[cc65] Stack problems with several segments.

From: Karri Kaksonen <karri1sipo.fi>
Date: 2004-11-17 10:19:20
Hi,

I have a strange problem with the C-stack.

If I run my code in one segment everything works OK.

But if I move any subroutine to another code segment then the
C stack pointer starts growing upwards for every round by some bytes
until the application crashes. (So it shrinks instead of growing.)

Is there some keywords I should set for routines that are in a different
code segment?

When I compare the codes in the working and non-working setup I found that
there is a missing

ldy #$01

statement in the non-working version.

Working:

lda #$00
jsr pusha
ldy #$01
jsr _check_channels

Non-working (check_channels is in a different segment):

lda #$00
jsr pusha
jsr _check_channels


The check_channels is defined as

extern void check_channels(unsigned char action);

The code generated for check_channels is identical in both cases. At least
it looks so to my eyes.

--
Regards,

Karri

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Nov 17 10:19:29 2004

This archive was generated by hypermail 2.1.8 : 2004-11-17 10:19:38 CET