Implementation Details
5-29Code Development Tools
add_string(p,pp,p,lgm1+i+1);
}
if(sign == –1)
{
neg_string(pp,p,STR_LENGTH((lgp+2)));
copy_string(p,pp,STR_LENGTH((lgp+2)));
}
free(mm1);
free(mm2);
free(pp);
}
cmm_func main(int argc,char *argv)
{
int m1[4],m2[4],product[9];
xfer_const(m1,M1,STR_LENGTH(4));
xfer_const(m2,M2,STR_LENGTH(4));
string_multiply(product,STR_LENGTH(9),m1,STR_LENGTH(4),m2,STR_LENGTH(4));
}
5.6.5 Programming Example, C –– With Assembly Routines
There are several important considerations when using the C–– compiler. The
ram allocation must be coordinated so that a location isn’t accidentally used
twice. In assembly this is usually done with IRX files by making each label
equal to the location of the previous one, plus whatever storage space is need-
ed. All of the IRX files for a project are then combined in a master IRX file so
that the space for each sub file can be allocated. For example ( a master IRX
file ):
RAM_SIZE equ640
STACK equ2 * (RAM_SIZE – 14)
BEGIN_RAM equ0
RESERVED equ BEGIN_RAM + 2 * 1
RAMSTART_INT equRESERVED
include ”..\inter\inter_ram.irx”
RAMSTART_ASM equRAMEND_INT
include ”. .\asm_ram.irx”