MCPcopy Create free account
hub / github.com/TASEmulators/fceux / getBank

Function getBank

src/debug.cpp:289–300  ·  view source on GitHub ↗

* Returns the bank for a given offset. * Technically speaking this function does not calculate the actual bank * where the offset resides but the 0x4000 bytes large chunk of the ROM of the offset. * * @param offs The offset * @return The bank of that offset or -1 if the offset is not part of the ROM. **/

Source from the content-addressed store, hash-verified

287* @return The bank of that offset or -1 if the offset is not part of the ROM.
288**/
289int getBank(int offs)
290{
291 //NSF data is easy to overflow the return on.
292 //Anything over FFFFF will kill it.
293
294 //GetNesFileAddress doesn't work well with Unif files
295 int addr = GetNesFileAddress(offs)-NES_HEADER_SIZE;
296
297 if (GameInfo && GameInfo->type==GIT_NSF)
298 return addr != -1 ? addr / 0x1000 : -1;
299 return addr != -1 ? addr / (1<<debuggerPageSize) : -1; //formerly, dividing by 0x4000
300}
301
302int GetNesFileAddress(int A){
303 int result;

Callers 15

evaluateFunction · 0.85
FCEUD_TraceInstructionFunction · 0.85
MemViewCallBFunction · 0.85
AddbpCallBFunction · 0.85
DisassembleFunction · 0.85
DisassembleLineFunction · 0.85
DisassembleDataFunction · 0.85
getBankIndexForAddressFunction · 0.85
loadNameFilesFunction · 0.85

Calls 1

GetNesFileAddressFunction · 0.85

Tested by

no test coverage detected