Author: souvik1997
Posted: 11 Nov 2012 09:57:28 am (GMT -5)
I've been trying to load a TI-82 ROM, and it seems like it's running until 0038h but then it just stops. Also, loading ROMs over 128 KB results in an error.
Code:
Code:
_________________
CALCnet Tournament-38%
![]()
![]()
deviantArt
![]()
Posted: 11 Nov 2012 09:57:28 am (GMT -5)
I've been trying to load a TI-82 ROM, and it seems like it's running until 0038h but then it just stops. Also, loading ROMs over 128 KB results in an error.
Code:
BOOL rom_load_minimal(LPCALC lpCalc, char* FileName, int model, char* version)
{
if (lpCalc == NULL) {
return FALSE;
}
switch (model) {
case TI_81:
calc_init_81(lpCalc, version);
if (!loadFileToRAM(FileName, (void*)lpCalc->cpu.mem_c->flash, lpCalc->cpu.mem_c->flash_size)) return FALSE;
break;
case TI_82:
case TI_83:
calc_init_83(lpCalc, version);
if (!loadFileToRAM(FileName, (void*)lpCalc->cpu.mem_c->flash, lpCalc->cpu.mem_c->flash_size)) return FALSE;
break;
case TI_85:
case TI_86:
calc_init_86(lpCalc);
if (!loadFileToRAM(FileName, (void*)lpCalc->cpu.mem_c->flash, lpCalc->cpu.mem_c->flash_size)) return FALSE;
break;
default:
return FALSE;
}
lpCalc->active = TRUE;
memcpy(lpCalc->rom_version, version, sizeof(lpCalc->rom_version));
//memset(lpCalc->rom_version,0xA5,sizeof(lpCalc->rom_version)); //fill with junk data. Not sure if the rom version is actually used anywhere, though
strcpy(lpCalc->rom_path, FileName);
return TRUE;
}
Code:
BOOL loadFileToRAM(unsigned char* f, void* buffer, unsigned int length)
{
unsigned short pFile[256];
int hFile;
Bfile_StrToName_ncpy(pFile, f, strlen(f));
hFile = Bfile_OpenFile_OS(pFile, READWRITE); // Get handle
if(hFile < 0) // Check if it opened
{
int size = 256;
if(Bfile_CreateEntry_OS(pFile, CREATEMODE_FILE, &size) >= 0) // Did it create?
{
hFile = Bfile_OpenFile_OS(pFile, READWRITE);
Bfile_ReadFile_OS(hFile, buffer, length, 1);
if(hFile < 0) // Still failing?
{
Bfile_CloseFile_OS(hFile);
return FALSE;
}
}
else
{
Bfile_CloseFile_OS(hFile);
return FALSE;
}
}
Bfile_CloseFile_OS(hFile);
return TRUE;
}
_________________
CALCnet Tournament-38%


deviantArt
