* 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. **/
| 287 | * @return The bank of that offset or -1 if the offset is not part of the ROM. |
| 288 | **/ |
| 289 | int 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 | |
| 302 | int GetNesFileAddress(int A){ |
| 303 | int result; |
no test coverage detected