Replace magic numbers with BANK_COUNT_* constants

Previously, some instances of the number of banks for each section remained hardcoded. These have been replaced with BANK_COUNT_* constants.

As a side-effect, this could fix a theoretical bug when using BANK(label) when the label is in a high SRAM bank (≥ 4).
This commit is contained in:
Ben10do
2017-03-10 19:24:54 +00:00
parent 4f86a12539
commit 523b7538f0
2 changed files with 13 additions and 13 deletions

View File

@@ -69,11 +69,11 @@ getsymbank(SLONG symid)
}
if (nBank == BANK_WRAM0) return 0;
if (nBank >= BANK_WRAMX && nBank <= (BANK_WRAMX+6))
if (nBank >= BANK_WRAMX && nBank < (BANK_WRAMX + BANK_COUNT_WRAMX))
return nBank - BANK_WRAMX + 1;
if (nBank >= BANK_VRAM && nBank <= (BANK_VRAM+1))
if (nBank >= BANK_VRAM && nBank < (BANK_VRAM + BANK_COUNT_VRAM))
return nBank - BANK_VRAM;
if (nBank >= BANK_SRAM && nBank <= (BANK_SRAM+3))
if (nBank >= BANK_SRAM && nBank < (BANK_SRAM + BANK_COUNT_SRAM))
return nBank - BANK_SRAM;
return nBank;