v1.19.9: Fixed DOS window creation issues

This commit is contained in:
Jeff Parsons 2015-10-23 16:27:12 -07:00
commit 2b1b27c6bb
28 changed files with 7316 additions and 324 deletions

View file

@ -252,6 +252,14 @@ if (BACKTRACK) {
};
}
Bus.ERROR = {
ADD_MEM_INUSE: 1,
ADD_MEM_BADRANGE: 2,
SET_MEM_NOCTRL: 3,
SET_MEM_BADRANGE: 4,
REM_MEM_BADRANGE: 5
};
/**
* @typedef {number}
*/
@ -399,7 +407,7 @@ Bus.prototype.addMemory = function(addr, size, type, controller)
continue;
}
}
return this.reportError(1, addr, size);
return this.reportError(Bus.ERROR.ADD_MEM_INUSE, addr, size);
}
var blockOld = this.aMemBlocks[iBlock];
var blockNew = new Memory(addr, sizeBlock, this.nBlockSize, type, controller);
@ -409,7 +417,7 @@ Bus.prototype.addMemory = function(addr, size, type, controller)
size -= sizeBlock;
}
if (size > 0) {
return this.reportError(2, addr, size);
return this.reportError(Bus.ERROR.ADD_MEM_BADRANGE, addr, size);
}
return true;
};
@ -537,7 +545,7 @@ Bus.prototype.getWidth = function()
};
/**
* setMemoryAccess(addr, size)
* setMemoryAccess(addr, size, afn, fQuiet)
*
* Updates the access functions in every block of the specified address range. Since the only components
* that should be dynamically modifying the memory access functions are those that use addMemory() with a custom
@ -547,16 +555,17 @@ Bus.prototype.getWidth = function()
* @param {number} addr
* @param {number} size
* @param {Array.<function()>} [afn]
* @param {boolean} [fQuiet] (true if any error should be quietly logged)
* @return {boolean} true if successful, false if not
*/
Bus.prototype.setMemoryAccess = function(addr, size, afn)
Bus.prototype.setMemoryAccess = function(addr, size, afn, fQuiet)
{
if (!(addr & this.nBlockLimit) && size && !(size & this.nBlockLimit)) {
var iBlock = addr >>> this.nBlockShift;
while (size > 0) {
var block = this.aMemBlocks[iBlock];
if (!block.controller) {
return this.reportError(5, addr, size);
return this.reportError(Bus.ERROR.SET_MEM_NOCTRL, addr, size, fQuiet);
}
block.setAccess(afn, true);
size -= this.nBlockSize;
@ -564,7 +573,7 @@ Bus.prototype.setMemoryAccess = function(addr, size, afn)
}
return true;
}
return this.reportError(3, addr, size);
return this.reportError(Bus.ERROR.SET_MEM_BADRANGE, addr, size);
};
/**
@ -593,7 +602,7 @@ Bus.prototype.removeMemory = function(addr, size)
}
return true;
}
return this.reportError(4, addr, size);
return this.reportError(Bus.ERROR.REM_MEM_BADRANGE, addr, size);
};
/**
@ -1667,17 +1676,23 @@ Bus.prototype.removePortOutputNotify = function(start, end)
*/
/**
* reportError(op, addr, size)
* reportError(op, addr, size, fQuiet)
*
* @this {Bus}
* @param {number} op
* @param {number} addr
* @param {number} size
* @param {boolean} [fQuiet] (true if any error should be quietly logged)
* @return {boolean} false
*/
Bus.prototype.reportError = function(op, addr, size)
Bus.prototype.reportError = function(op, addr, size, fQuiet)
{
Component.error("Memory block error (" + op + "," + str.toHex(addr) + "," + str.toHex(size) + ")");
var sError = "Memory block error (" + op + ": " + str.toHex(addr) + "," + str.toHex(size) + ")";
if (fQuiet) {
this.log(sError);
} else {
Component.error(sError);
}
return false;
};

View file

@ -467,6 +467,73 @@ Video.TRAPALL = true; // monitor all I/O by default (not just deltas)
*
* Bit 3, or bit 0 of the Clocking Mode register
* Bit 3, or bit 2 of the Miscellaneous Output register
*
* Also, for quick reference, IBM VGA register values for the standard VGA modes (from http://www.pcjs.org/blog/2015/06/01/):
*
* INT 0x10 Mode Requested: 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x0D 0x0E 0x10 0x12 0x13
*
* BIOSMODE: 0x01 0x01 0x03 0x03 0x04 0x04 0x06 0x0D 0x0E 0x10 0x12 0x13
* CRTC[0x00]: HTOTAL 0x2D 0x2D 0x5F 0x5F 0x2D 0x2D 0x5F 0x2D 0x5F 0x5F 0x5F 0x5F
* CRTC[0x01]: HDISP_END 0x27 0x27 0x4F 0x4F 0x27 0x27 0x4F 0x27 0x4F 0x4F 0x4F 0x4F
* CRTC[0x02]: HBLANK_START 0x28 0x28 0x50 0x50 0x28 0x28 0x50 0x28 0x50 0x50 0x50 0x50
* CRTC[0x03]: HBLANK_END 0x90 0x90 0x82 0x82 0x90 0x90 0x82 0x90 0x82 0x82 0x82 0x82
* CRTC[0x04]: HRETRACE_START 0x2B 0x2B 0x55 0x55 0x2B 0x2B 0x54 0x2B 0x54 0x54 0x54 0x54
* CRTC[0x05]: HRETRACE_END 0xA0 0xA0 0x81 0x81 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80
* CRTC[0x06]: VTOTAL 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF 0x0B 0xBF
* CRTC[0x07]: OVERFLOW 0x1F 0x1F 0x1F 0x1F 0x1F 0x1F 0x1F 0x1F 0x1F 0x1F 0x3E 0x1F
* CRTC[0x08]: PRESET_ROW 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* CRTC[0x09]: MAX_SCAN 0x4F 0x4F 0x4F 0x4F 0xC1 0xC1 0xC1 0xC0 0xC0 0x40 0x40 0x41
* CRTC[0x0A]: CURSOR_START 0x0D 0x0D 0x0D 0x0D 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* CRTC[0x0B]: CURSOR_END 0x0E 0x0E 0x0E 0x0E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* CRTC[0x0C]: START_ADDR_HI 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* CRTC[0x0D]: START_ADDR_LO 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* CRTC[0x0E]: CURSOR_ADDR_HI 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x00
* CRTC[0x0F]: CURSOR_ADDR_LO 0x19 0x19 0x41 0x41 0x19 0x19 0x41 0x19 0x41 0x41 0xE1 0xA2
* CRTC[0x10]: VRETRACE_START 0x9C 0x9C 0x9C 0x9C 0x9C 0x9C 0x9C 0x9C 0x9C 0x83 0xEA 0x9C
* CRTC[0x11]: VRETRACE_END 0x8E 0x8E 0x8E 0x8E 0x8E 0x8E 0x8E 0x8E 0x8E 0x85 0x8C 0x8E
* CRTC[0x12]: VDISP_END 0x8F 0x8F 0x8F 0x8F 0x8F 0x8F 0x8F 0x8F 0x8F 0x5D 0xDF 0x8F
* CRTC[0x13]: OFFSET 0x14 0x14 0x28 0x28 0x14 0x14 0x28 0x14 0x28 0x28 0x28 0x28
* CRTC[0x14]: UNDERLINE 0x1F 0x1F 0x1F 0x1F 0x00 0x00 0x00 0x00 0x00 0x0F 0x00 0x40
* CRTC[0x15]: VBLANK_START 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x96 0x63 0xE7 0x96
* CRTC[0x16]: VBLANK_END 0xB9 0xB9 0xB9 0xB9 0xB9 0xB9 0xB9 0xB9 0xB9 0xBA 0x04 0xB9
* CRTC[0x17]: MODE_CTRL 0xA3 0xA3 0xA3 0xA3 0xA2 0xA2 0xC2 0xE3 0xE3 0xE3 0xE3 0xA3
* CRTC[0x18]: LINE_COMPARE 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
* GRC[0x00]: SRESET 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* GRC[0x01]: ESRESET 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* GRC[0x02]: COLORCMP 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* GRC[0x03]: DATAROT 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* GRC[0x04]: READMAP 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* GRC[0x05]: MODE 0x10 0x10 0x10 0x10 0x30 0x30 0x00 0x00 0x00 0x00 0x00 0x40
* GRC[0x06]: MISC 0x0E 0x0E 0x0E 0x0E 0x0F 0x0F 0x0D 0x05 0x05 0x05 0x05 0x05
* GRC[0x07]: COLORDC 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x0F 0x0F 0x0F 0x0F
* GRC[0x08]: BITMASK 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
* SEQ[0x00]: RESET 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03
* SEQ[0x01]: CLOCKING 0x08 0x08 0x00 0x00 0x09 0x09 0x01 0x09 0x01 0x01 0x01 0x01
* SEQ[0x02]: MAPMASK 0x03 0x03 0x03 0x03 0x03 0x03 0x01 0x0F 0x0F 0x0F 0x0F 0x0F
* SEQ[0x03]: CHARMAP 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* SEQ[0x04]: MEMMODE 0x03 0x03 0x03 0x03 0x02 0x02 0x06 0x06 0x06 0x06 0x06 0x0E
* ATC[0x00]: PAL00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* ATC[0x01]: PAL01 0x01 0x01 0x01 0x01 0x13 0x13 0x17 0x01 0x01 0x01 0x01 0x01
* ATC[0x02]: PAL02 0x02 0x02 0x02 0x02 0x15 0x15 0x17 0x02 0x02 0x02 0x02 0x02
* ATC[0x03]: PAL03 0x03 0x03 0x03 0x03 0x17 0x17 0x17 0x03 0x03 0x03 0x03 0x03
* ATC[0x04]: PAL04 0x04 0x04 0x04 0x04 0x02 0x02 0x17 0x04 0x04 0x04 0x04 0x04
* ATC[0x05]: PAL05 0x05 0x05 0x05 0x05 0x04 0x04 0x17 0x05 0x05 0x05 0x05 0x05
* ATC[0x06]: PAL06 0x14 0x14 0x14 0x14 0x06 0x06 0x17 0x06 0x06 0x14 0x14 0x06
* ATC[0x07]: PAL07 0x07 0x07 0x07 0x07 0x07 0x07 0x17 0x07 0x07 0x07 0x07 0x07
* ATC[0x08]: PAL08 0x38 0x38 0x38 0x38 0x10 0x10 0x17 0x10 0x10 0x38 0x38 0x08
* ATC[0x09]: PAL09 0x39 0x39 0x39 0x39 0x11 0x11 0x17 0x11 0x11 0x39 0x39 0x09
* ATC[0x0A]: PAL0A 0x3A 0x3A 0x3A 0x3A 0x12 0x12 0x17 0x12 0x12 0x3A 0x3A 0x0A
* ATC[0x0B]: PAL0B 0x3B 0x3B 0x3B 0x3B 0x13 0x13 0x17 0x13 0x13 0x3B 0x3B 0x0B
* ATC[0x0C]: PAL0C 0x3C 0x3C 0x3C 0x3C 0x14 0x14 0x17 0x14 0x14 0x3C 0x3C 0x0C
* ATC[0x0D]: PAL0D 0x3D 0x3D 0x3D 0x3D 0x15 0x15 0x17 0x15 0x15 0x3D 0x3D 0x0D
* ATC[0x0E]: PAL0E 0x3E 0x3E 0x3E 0x3E 0x16 0x16 0x17 0x16 0x16 0x3E 0x3E 0x0E
* ATC[0x0F]: PAL0F 0x3F 0x3F 0x3F 0x3F 0x17 0x17 0x17 0x17 0x17 0x3F 0x3F 0x0F
* ATC[0x10]: MODE 0x0C 0x0C 0x0C 0x0C 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x41
* ATC[0x11]: OVERSCAN 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
* ATC[0x12]: PLANES 0x0F 0x0F 0x0F 0x0F 0x03 0x03 0x01 0x0F 0x0F 0x0F 0x0F 0x0F
* ATC[0x13]: HPAN 0x08 0x08 0x08 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
*
* TODO: Build a similar table for the IBM EGA, and then work on rationalizing the mode detection logic in checkMode().
*/
/*
@ -4485,7 +4552,7 @@ Video.prototype.setCardAccess = function(nAccess)
* point, however, because there's no guarantee that setMemoryAccess() didn't modify one or more blocks
* before choking.
*/
this.bus.setMemoryAccess(card.addrBuffer, card.sizeBuffer, card.getMemoryAccess());
this.bus.setMemoryAccess(card.addrBuffer, card.sizeBuffer, card.getMemoryAccess(), true);
}
};
@ -4754,7 +4821,7 @@ Video.prototype.checkMode = function(fForce)
var regGRCMode = card.regGRCData[Card.GRC.MODE.INDX];
/*
* This text/graphics hybrid test detects the way Windows 95 reprograms the VGA on boot (ie, switching
* This text/graphics hybrid test detects the way Windows 95 reprograms the VGA on boot; ie, switching
* to graphics mode 0x13 (320x200) without disturbing the text buffer contents, then reprogramming it
* to enable graphics mode 0x15 (320x400), then drawing a logo in the 2nd half of the video memory, and
* finally reprogramming regGRCMode and regGRCMisc to move the frame buffer back to its original text mode
@ -4789,11 +4856,16 @@ Video.prototype.checkMode = function(fForce)
*/
nMode -= (fSEQDotClock? 2 : 0);
}
else if (card.addrBuffer != 0xA0000 && !fTextGraphicsHybrid) {
else if (card.addrBuffer != 0xA0000 && !fTextGraphicsHybrid && nCRTCVertTotal < 350) {
/*
* Here's where we handle CGA graphics modes; since nMode will have been assigned a
* default of either 0x02 or 0x03, convert that to either 0x05 or 0x04 if we're in a
* low-res graphics mode, 0x06 otherwise.
*
* For Windows 95, I've had to add BOTH the "!fTextGraphicsHybrid" test (to avoid
* misdetecting the logo display mode) AND the "nCRTCVertTotal < 350" test (to avoid
* misinterpreting the VDD's video reprogramming during VM creation, the purpose of
* which is still a mystery to me).
*/
nMode = fSEQDotClock? (7 - nMode) : Video.MODE.CGA_640X200;
} else {