Fixed an old annoying bug where a restored video card wouldn't properly display a blinking cursor; originally, I assumed it was a CRTC register restoration bug, but actually, some supporting variables (eg, cBlinks) were not getting initialized in both the reset() and restore() code paths. This is also a good time to remember that when an uninitialized array from some hardware state gets serialized and deserialized to/from JSON, the array is restored as a series of "null" values, not as "undefined" values, so it's best for any code checking for undefined values to use "== null" rather than "=== undefined".

This commit is contained in:
Jeff Parsons 2017-06-26 08:56:17 -07:00 • committed by Jeff Parsons
commit ed75397b83
10 changed files with 58 additions and 36 deletions

View file

@ -1,3 +1,17 @@
---
layout: page
permalink: /
machines:
- id: ibm5150
type: pcx86
resume: 1
name: "IBM PC (Model 5150) with Monochrome Display"
config: /devices/pcx86/machine/5150/mda/64kb/machine.xml
- id: demoC1P
type: c1p
config: /devices/c1p/machine/8kb/large/machine.xml
---
PCjs Machines
=============
@ -14,7 +28,7 @@ All PCjs machine simulations are written entirely in [JavaScript](/modules/). N
required. Supported browsers include modern versions of Chrome, Safari, Firefox, Internet Explorer (v9.0 and up), Edge,
and assorted mobile browsers.
[Embedded IBM PC](/devices/pcx86/machine/5150/mda/64kb/ "PCx86:ibm5150")
{% include machine.html id="ibm5150" %}
The [JavaScript Machine](/devices/pcx86/machine/5150/mda/64kb/) above uses [PCx86](/docs/pcx86/) configured with an Intel
8088 running at 4.77Mhz, with 64Kb of RAM and an IBM Monochrome Display Adapter. For more control, there are also
@ -62,7 +76,7 @@ Below is the [OSI Challenger C1P](/docs/c1pjs/), another simulation in the PCjs
It simulates Ohio Scientific's 6502-based microcomputer, released in 1978. More details about this simulation
and the original machine are available in the [C1Pjs Documentation](/docs/c1pjs/).
[Embedded OSI Challenger C1P](/devices/c1p/machine/8kb/large/ "C1Pjs:demoC1P")
{% include machine.html id="demoC1P" %}
<!--BEGIN:EXCLUDE-->

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1308,7 +1308,7 @@ class Bus extends Component {
if (aNotify !== undefined) {
if (aNotify[0]) {
dataPort = aNotify[0](port, addrLIP);
if (dataPort === undefined) {
if (dataPort == null) {
dataPort = maskPort;
} else {
dataPort &= maskPort;

View file

@ -3166,10 +3166,6 @@ class Video extends Component {
this.buildFonts();
this.nMode = null;
this.iCellCursor = -1; // initially, there is no visible cursor cell
this.cBlinks = -1; // initially, blinking is not active
this.cBlinkVisible = 0; // no visible blinking characters (yet)
this.setMode(this.nModeDefault);
if (this.cardActive.addrBuffer && fRandomize) {
@ -3697,6 +3693,14 @@ class Video extends Component {
}
}
}
if (!fRebuild) {
/*
* Perform some additional initialization common to both reset() and restore() sequences.
*/
this.iCellCursor = -1; // initially, there is no visible cursor cell
this.cBlinks = -1; // initially, blinking is not active
this.cBlinkVisible = 0; // no visible blinking characters (yet)
}
return fChanges;
}
@ -6399,7 +6403,7 @@ class Video extends Component {
* The IBM VGA ROM makes some hardware determinations based on how the CRTC controller responds when
* the IO_SELECT bit in the Miscellaneous Output Register is cleared; normally, that would mean ports
* 0x3B? are decoded and ports 0x3D? are ignored. We didn't used to bother ignoring them, but the
* VGA ROM's logic requires it, so now we also check fActive. However, we ignore only CTRC reads;
* VGA ROM's logic requires it, so now we also check fActive. However, we ignore only CRTC reads;
* we retain any writes in case that information proves useful later.
*
* Note that returning an undefined value now signals the Bus component to return whatever default value
@ -7328,7 +7332,7 @@ Video.TOUCH = {
* Why simulate a SPACE if the tap is in the middle third (center) of the screen? Well, apparently
* I didn't explain earlier that the WHOLE reason I originally added KEYGRID support (before it was
* even called KEYGRID support) was to make the 1985 game "Rogue" (pcjs.org/apps/pcx86/1985/rogue)
* more fun to play on an iPad, and space is a commonly required key.
* more fun to play on an iPad (the space-bar is a commonly required key).
*/
Video.KEYGRID = [
[Keyboard.SIMCODE.HOME, Keyboard.SIMCODE.UP, Keyboard.SIMCODE.PGUP],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -9462,7 +9462,7 @@ class Bus extends Component {
if (aNotify !== undefined) {
if (aNotify[0]) {
dataPort = aNotify[0](port, addrLIP);
if (dataPort === undefined) {
if (dataPort == null) {
dataPort = maskPort;
} else {
dataPort &= maskPort;
@ -49588,10 +49588,6 @@ class Video extends Component {
this.buildFonts();
this.nMode = null;
this.iCellCursor = -1; // initially, there is no visible cursor cell
this.cBlinks = -1; // initially, blinking is not active
this.cBlinkVisible = 0; // no visible blinking characters (yet)
this.setMode(this.nModeDefault);
if (this.cardActive.addrBuffer && fRandomize) {
@ -50119,6 +50115,14 @@ class Video extends Component {
}
}
}
if (!fRebuild) {
/*
* Perform some additional initialization common to both reset() and restore() sequences.
*/
this.iCellCursor = -1; // initially, there is no visible cursor cell
this.cBlinks = -1; // initially, blinking is not active
this.cBlinkVisible = 0; // no visible blinking characters (yet)
}
return fChanges;
}
@ -52821,7 +52825,7 @@ class Video extends Component {
* The IBM VGA ROM makes some hardware determinations based on how the CRTC controller responds when
* the IO_SELECT bit in the Miscellaneous Output Register is cleared; normally, that would mean ports
* 0x3B? are decoded and ports 0x3D? are ignored. We didn't used to bother ignoring them, but the
* VGA ROM's logic requires it, so now we also check fActive. However, we ignore only CTRC reads;
* VGA ROM's logic requires it, so now we also check fActive. However, we ignore only CRTC reads;
* we retain any writes in case that information proves useful later.
*
* Note that returning an undefined value now signals the Bus component to return whatever default value
@ -53750,7 +53754,7 @@ Video.TOUCH = {
* Why simulate a SPACE if the tap is in the middle third (center) of the screen? Well, apparently
* I didn't explain earlier that the WHOLE reason I originally added KEYGRID support (before it was
* even called KEYGRID support) was to make the 1985 game "Rogue" (pcjs.org/apps/pcx86/1985/rogue)
* more fun to play on an iPad, and space is a commonly required key.
* more fun to play on an iPad (the space-bar is a commonly required key).
*/
Video.KEYGRID = [
[Keyboard.SIMCODE.HOME, Keyboard.SIMCODE.UP, Keyboard.SIMCODE.PGUP],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long