[cc65] Volatile and reentrant keywords

From: Apple2Stuff <apple2stuff1rogers.com>
Date: 2004-03-13 17:44:44
One of my work items is to port a sample "c" application using cc65 to the
apple2. it was written for the 8051

My C skills are somewhere between beginner and intermediate ....

In order to get this code to compile I had to remove the volatile keyword
from a function definition and reentrant on the function implementation.

original code snipet

#define IDM_OR   (*((volatile u_char xdata *)(DIRECT_REG_BASE + 0x0C)))
#define IDM_AR0   (*((volatile u_char xdata *)(DIRECT_REG_BASE + 0x0D)))
#define IDM_AR1   (*((volatile u_char xdata *)(DIRECT_REG_BASE + 0x0E)))
#define IDM_DR   (*((volatile u_char xdata *)(DIRECT_REG_BASE + 0x0F)))

it compiles now with volatile removed (and xdata) but am I asking for
trouble?

The keyword reentrant is also being used but I think from my research that
it is okay to leave it out if I make sure the function only uses registers
or stack variables?

original code snipet

char IndirectReadByte(u_int Addr) reentrant
{
char isr;
isr = EX0;
EX0 = 0;
IDM_AR0 = (u_char)((Addr & 0xFF00) >> 8);
IDM_AR1 = (u_char)(Addr & 0x00FF);
EX0 = isr;
return IDM_DR;
}

Glenn

Personal Website: http://members.rogers.com/rg.jones/
Apple Specific Website http://members.rogers.com/apple2stuff/apple.htm
Email: Reply to apple2stuff at rogers dot com

----------------------------------------------------------------------
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 Mar 13 17:45:29 2004

This archive was generated by hypermail 2.1.8 : 2004-03-13 17:45:35 CET