mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Merge pull request #155 from feelfree69/fix-bank-overflow
fix bank overflow
This commit is contained in:
+2
-2
@@ -21,8 +21,8 @@
|
|||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
#include "phy.h"
|
#include "phy.h"
|
||||||
|
|
||||||
#pragma codeseg BANK1
|
#pragma codeseg BANK2
|
||||||
#pragma constseg BANK1
|
#pragma constseg BANK2
|
||||||
|
|
||||||
extern __code struct machine machine;
|
extern __code struct machine machine;
|
||||||
extern __xdata uint8_t stpEnabled;
|
extern __xdata uint8_t stpEnabled;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int nbanks = (filesize - BANK0_SIZE) / BANK_STRIDE;
|
int nbanks = (filesize - BANK0_SIZE) / BANK_STRIDE;
|
||||||
printf("Input file contains %d banks\n", nbanks);
|
printf("Input file contains %d banks\n", nbanks+1);
|
||||||
|
|
||||||
/* Verify the size of banks in input file:
|
/* Verify the size of banks in input file:
|
||||||
* Bank 0: 0x00002 - 0x04000 <- 0x00000 - 0x03ffe
|
* Bank 0: 0x00002 - 0x04000 <- 0x00000 - 0x03ffe
|
||||||
@@ -119,8 +119,8 @@ int main(int argc, char **argv)
|
|||||||
for (int bank = 1; bank <= nbanks; bank++) {
|
for (int bank = 1; bank <= nbanks; bank++) {
|
||||||
for (int b = (bank + 1) * BANK_STRIDE; b < (bank + 1) * BANK_STRIDE + BANK0_SIZE; b ++) {
|
for (int b = (bank + 1) * BANK_STRIDE; b < (bank + 1) * BANK_STRIDE + BANK0_SIZE; b ++) {
|
||||||
if (buffer[b]) {
|
if (buffer[b]) {
|
||||||
printf("WARNING: Bank %d: code segment too large at 0x%x!\n", bank, b);
|
printf("Error: Bank %d: code segment too large at 0x%x!\n", bank, b);
|
||||||
break;
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user