FOOTBALL-related fixes

This commit is contained in:
Jeff Parsons 2016-02-08 15:36:23 -08:00
commit ac51075c39
7 changed files with 956 additions and 885 deletions

View file

@ -416,10 +416,20 @@ Bus.prototype.addMemory = function(addr, size, type, controller)
addr = addrBlock + this.nBlockSize;
size -= sizeBlock;
}
if (size > 0) {
return this.reportError(Bus.ERROR.ADD_MEM_BADRANGE, addr, size);
if (size <= 0) {
/*
* If all addMemory() calls happened ONLY during device initialization, the following code would not
* be necessary; unfortunately, the Video component can add and remove physical memory blocks during video
* mode changes, so we have to kick out any PAGED blocks that could have references to those physical memory
* blocks. If paging isn't enabled (or supported by the current the CPU), this call has no effect.
*
* We could handle this case with a little more, um, precision, but Video mode changes aren't frequent enough
* to warrant it.
*/
this.cpu.flushPageBlocks();
return true;
}
return true;
return this.reportError(Bus.ERROR.ADD_MEM_BADRANGE, addr, size);
};
/**
@ -600,6 +610,16 @@ Bus.prototype.removeMemory = function(addr, size)
addr = iBlock * this.nBlockSize;
size -= this.nBlockSize;
}
/*
* If all removeMemory() calls happened ONLY during device initialization, the following code would not
* be necessary; unfortunately, the Video component can add and remove physical memory blocks during video
* mode changes, so we have to kick out any PAGED blocks that could have references to those physical memory
* blocks. If paging isn't enabled (or supported by the current the CPU), this call has no effect.
*
* We could handle this case with a little more, um, precision, but Video mode changes aren't frequent enough
* to warrant it.
*/
this.cpu.flushPageBlocks();
return true;
}
return this.reportError(Bus.ERROR.REM_MEM_BADRANGE, addr, size);

View file

@ -4598,6 +4598,7 @@ Video.prototype.getCardAccess = function()
*
* @this {Video}
* @param {number|undefined} nAccess (one of the Card.ACCESS.* constants)
* @return {boolean} true if access may have changed, false if not
*/
Video.prototype.setCardAccess = function(nAccess)
{
@ -4618,7 +4619,9 @@ Video.prototype.setCardAccess = function(nAccess)
* before choking.
*/
this.bus.setMemoryAccess(card.addrBuffer, card.sizeBuffer, card.getMemoryAccess(), true);
return true;
}
return false;
};
/**
@ -6308,7 +6311,32 @@ Video.prototype.outSEQData = function(port, bOut, addrFrom)
this.cardEGA.nSeqMapMask = Video.aEGAByteToDW[bOut & Card.SEQ.MAPMASK.MAPS];
break;
case Card.SEQ.MEMMODE.INDX:
this.setCardAccess(this.getCardAccess());
if (this.setCardAccess(this.getCardAccess())) {
/*
* When switching screens (via SysReq) on early revisions of OS/2 (eg, FOOTBALL), the screen would go
* blank; this appeared to be because when the card is reprogrammed, we first think the card is going into
* graphics mode, then we reverse course when it becomes clear that the card is going back into text mode,
* but unfortunately, at that precise moment, the Sequencer hasn't been fully reprogrammed, so when we're
* reading screen memory, we're getting back ZEROS for every odd byte (which are the text attribute bytes),
* so the screen is redrawn as black-on-black.
*
* My solution was to change setCardAccess() to indicate whether it actually altered the video buffer
* address and/or format, and if so, then force another screen update.
*
* TODO: This scenario does not seem unique; it suggests that we should generally force a screen update
* whenever the video buffer has undergone a significant change.
*
* UPDATE: This change was NOT sufficient to resolve the OS/2 screen-switching bug described above; in fact,
* it's apparently not even necessary, because the REAL problem was caused by PAGED blocks with stale
* physical video memory blocks; the solution was for the Bus addMemory() and removeMemory() functions to
* call the the CPU flushPageBlocks() function. With that change in place, the window now stays in sync
* with the buffer.
*
* However, calling updateScreen() here still seems like a good idea, and it shouldn't hurt performance,
* since we're doing it only when setCardAccess() indicates a change, so I'm leaving this addition in place.
*/
this.updateScreen(true);
}
break;
default:
break;