C38 Product News
The following sections describe new features in Byte Craft Limited Products.
Byte Craft Limited
55 Northfield Drive East 213
Waterloo, Ontario, Canada
N2K 3T6
phone: +1 519.888.6911
<support@bytecraft.com>
C38 includes new #pragma directives which support the organized and efficient use of memory resources.
-
Named address space allows you to group variables at specific memory locations.
-
Special address space allows you to declare variables at special memory locations such as external devices or internal EEPROM.
-
Local address space allows you to direct the placement of local variables. You can pass multiple arguments to functions by declaring local variable space.
-
Stack space can be defined using the #pragma memory STACK directive.
The directive #pragma memory LOCAL can be used to define local variable space. If local variable space is declared in your device header file, the two byte limit for function arguments imposed in previous versions of C38 will no longer apply.
Bit fields contain a user-specified number of bits. A bit field is a member of a structure and is named and accessed like any other structure member. Bit fields are declared using the following syntax:
intname:size;
where name is the name of the bit field and size is the number of bits. Bit fields may cross byte boundaries.
There are three special types which declare variables to access MELPS registers. They are registera, registerx, or registery. Using a variable declaration has the same effect as using the equivalent #pragma directive. Names declared with the #pragma directives cannot be used in function declarations, while those declared as type registera, registerx, or registery can.
The C38 compiler supports direct communication to debug environments. Embedded BCdirect commands can be used to pre-set breakpoints, pass set up information, and embed print and log statements without impacting generated code. BCdirect information is passed as extra message content in the .COD file.
The environment variables LIB and INCLUDE can be used to specify paths for the library and include file directories. Specify a semicolon-separated list of directories.
C38 now supports the use of sizeof() with arrays and structures. The compiler evaluates the sizeof(name) function at compile time to determine the number of bytes allocated to a variable or data type. The parentheses around name are optional.
An enumerated type lets the programmer describe objects in familiar terms. In C38 variables declared as type enum are also single byte integers. C38 supports the initialization of enum members, enum as a function parameter, and arrays in enum declarations.
__FILE__ returns the name of the file currently open instead of that of the main .C source file. __DATE__ now returns the date with a four digit year instead of a two digit year.
This option turns off the default initialization. The compiler usually generates an error if you try to create a function called __RESET because this conflicts with the automatic setting of the reset vector. When NOINIT is used, the compiler allows you to create a __RESET function. However, you are responsible for jumping to the start of the program at the end of the __RESET function.
C38 supports the ANSI standard uses for the static storage class modifier:
When variables are declared and initialized simultaneously, the compiler generates code to load the variables with the values. For static local variables, this is done once at the beginning of the program. Further calls to the function do not reinitialise the variables, thus preserving their values.
When used with the linker, static limits the scope of global variables to the module in which the variable is declared.
C38 compilers are available for the HP 700 series under HP-UX and for the SUN SPARC under either Solaris or SUN-OS. There is also a version of the C38 compiler available for the NEC-PC development platform.
Switch for 16-bit integer size. A command line switch has been added to allow the default integer size to be 16 bits. This is available only from the command line.
| +1 | 16-bit integers. |
| -i | 8-bit integers. |
-i is the integer default size representing the natural word size of the C38 processor.
+i only affects the int, and size of int, and int casting operation on the compiler. switch operations and enum operations remain based on the 8-bit processor natural size even with the +i switch on.
Assembler function entry points may be prototyped and called as C functions. Arguments may be "passed" through the registers.
void abc(void);
void def(char i);
#asm
abc: nop
nop
lda #6 def: nop
loop: deca
bne loop
nop
rts #endasmSpace is reserved at the highest address of the declared RamPage0 space for the long pseudo-registers (__longAC and __longIX), and scratch space for the library functions. The scratch pad locations are identified by the special name __SPAD. The space requirements for these functions is
Highest RAM Address __SPAD+3
Highest RAM Address - 1 __SPAD+2
Highest RAM Address - 2 __SPAD+1
Highest RAM Address - 3 __SPAD+0 Start of scratch pad space
Highest RAM Address - 5 __longAC
Highest RAM Address - 7 __longIX
Highest RAM Address - 8 __longIX op code
Memory requirements and temp assignments for the math library routines.
long __MUL16x16(void) char R0 &__SPAD+0;
char R1 &__SPAD+1;
void __MUL8x8(void) char R @ &__SPAD+2;
char Q @ &__SPAD+3;
void __DIV8BY8(void) char S @ &__SPAD+0;
char R @ &__SPAD+1;
char Q @ &__SPAD+2;
void __LDIV(void) char S @ &__SPAD+0;
char al @ &__SPAD+1;
char ah @ &__SPAD+2;
char xh @ &__SPAD+3;
long __RDIV(void); // same as __LDIV
long __RMOD(void); // same as __LDIV The C38 compiler can generate two different sequences for interrupt functions. The default is to treat an interrupt function as a standard void function with void return and to change the RTS to a RTI.
If you use the option switch a1 (#pragma option a1;), the compiler generates code to save and restore the registers (A,X,Y).
You can set the value stored in unused ROM locations with the #pragma option fillrom statement:
#pragma option fillrom value;where value is an 8-bit integer expression.
The default integer size of Code Development Systems is 8 bits. If the symbol __INT16 is defined, it indicates that the default integer size is 16 bits.
The __INT16 preprocessor symbol is defined by the compiler when either the +i is set on the command line, or the #pragma option +h directive appears in a source file.

eTPU_C:
C6808: