8BIT wrote:
Sorry for not being very clear. I was not overrunning the stack, I was causing a misalignment. I'd not leave the stack as I found it... i'd either pull too much off or leave something behind. I hope that makes more sense.
For I try not to use stack in my assembly code. Those are simple i/o routines. Everything else is written in C.
Anyway, I think my initial theory is wrong. I tried to extract sprintf.o and itoa.o files from c64.lib and supervision.lib. In both cases they are exactly the same size.
Is there something else I should do to use standard library, except of including header files in my source code and then giving .lib file to the linker?
UPDATE: I was able to make itoa/utoa work. Kind of... I forgot about placing function prototype inside my source file.
Now function works, but only with 8bit variables. When I try to pass 16bit variable, it doesn't hang my device, but buffer is filled with "256" every single time.
The sprintf function still doesn't work, hanging device completely.
Any ideas?
UPDATE:
Ok, I have yet another hypothesis. I've noticed that Watara Supervision was a handheld console using CMOS version of 6502. Currently I am using original, NMOS version of this CPU. Probably new instructions from compiled version of standard library are the reason of this unstability. Any idea which library should I "borrow" instead?
UPDATE:
Hypothesis confirmed. It works with c64.lib.