We propogate the common into each high bank so must allow for it. Remove
the hardcoded 4K assumption as it's trivial to do so, and also socz80 at
least doesn't need 0xF000 to be the common base.
static int maps_needed(uint16_t top)
{
- /* FIXME: unhardwire the 0x1000 common assumption ! */
- uint16_t needed = top + 0xFFF; /* 0x1000 common - 1 for shift and inc */
+ /* On many platforms if you touch this or PROGTOP you must
+ touch tricks.s */
+ uint16_t needed = top + 0xFFFF - PROGTOP;
+ /* Usually we have 0x1000 common - 1 for shift and inc */
needed >>= 14; /* in banks */
needed++; /* rounded */
return needed;
static int maps_needed(uint16_t top)
{
- /* FIXME: unhardwire the 4K common assumption */
- uint16_t needed = top + 0xFFF; /* 0x1000 common - 1 for shift and inc */
+ /* On many platforms if you touch this or PROGTOP you must
+ touch tricks.s */
+ uint16_t needed = top + 0xFFFF - PROGTOP;
+ /* Usually we have 0x1000 common - 1 for shift and inc */
if (needed & 0x8000)
return 2;
return return 1;