After creating a minimal target for CHOCHI, I got a simple LED flashing program working:
Code:
void delay(){
int a;
for(a=0x7FFF;a!=0;a--){
};
}
void main(void)
{
char* pLED;
pLED = (char*)0xC000;
while(1){
delay();
*pLED=1;
delay();
*pLED=0;
}
}
Changing the 'int a' declaration to 'long a' breaks the code, without any error messages. I am assuming that some runtime code does not make it into the binary. Looking at the generated assembly I noticed a call to 'ldeax0sp', which seems like a likely culprit as the 'runtime' directory in the library source contains a number of such routines.
Do you think that's the problem? My current "CHOCHI1.lib" currently contains nothing but initialization code. Where does the runtime library come into the game? And shouldn't I be getting linker errors?