Re: [cc65] Interrupt <-> C runtime environment

From: Greg King <greg.king41verizon.net>
Date: 2011-07-12 18:44:15
From: "marcas"; on Monday, July 11, 2011; at 01:03 AM -0400
>
> My current ISR is able to handle small C code (e.g., uint8_t++ works;
> uint16_t++ works; uint32_t++ does not work, and results in weird
> behaviour).

The CC65 package has a document called "internal.txt".  It has knowledge
that is useful to you.

But, it doesn't describe 32-bit numbers!
The 32-bit accumulator has two parts:  The lower 16 bits are stored in
the CPU registers X and A; the upper 16 bits are stored in two bytes in
the zero-page RAM.  That is another reason why your ISR must save and
restore the ZEROPAGE segment.

cc65's optimizer doesn't recognize "(void) post-counting".  It generates
code to preserve the variable's original value even when the statement
doesn't use that value.  Therefore, you should do
pre-increments/-decrements, instead of post-increments/-decrements,
where-ever possible (e.g., ++uint8_t, ++uint16_t, and ++uint32_t).

----------------------------------------------------------------------
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 Jul 12 19:55:39 2011

This archive was generated by hypermail 2.1.8 : 2011-07-12 19:56:12 CEST