Enable TypedArray support at runtime (IE9 is still the outlier)

This commit is contained in:
Jeff Parsons 2014-10-12 13:09:20 -07:00 • committed by jeffpar
commit ade000d0a5
9 changed files with 428 additions and 428 deletions

View file

@ -3,12 +3,12 @@ PCjs Released on GitHub
I've decided the time has come to make the [PCjs Project](https://github.com/jeffpar/pcjs) an open source project on I've decided the time has come to make the [PCjs Project](https://github.com/jeffpar/pcjs) an open source project on
[GitHub](http://github.com/). [GitHub](http://github.com/).
This doesn't mean I'm done with PCjs -- not by a long shot. But I promised to release it on GitHub by the end of This doesn't mean PCjs is done -- not by a long shot. But I promised to release it on GitHub by the end of
the year, which is fast approaching, and I didn't really want to do this in December. the year, which is fast approaching, and I didn't really want to do this in December.
I feel I've made pretty good progress on my goals for the year -- primarily EGA and PC AT support. PC AT machines I feel I've made pretty good progress on my goals for the year -- primarily EGA and PC AT support. PC AT machines
can boot and run in real-mode now, but there's still a lot of protected-mode work to do. The big remaining goal for can boot and run in real-mode now, but there's still a lot of protected-mode work to do. The big remaining goal for
the year is to boot OS/2 1.0. this year is to boot OS/2 1.0.
There are also a lot of rough edges left to polish. Holes in EGA emulation remain to be filled (support for dynamically There are also a lot of rough edges left to polish. Holes in EGA emulation remain to be filled (support for dynamically
loaded fonts is one of the bigger ones). And the PC AT Keyboard, along with the 8042 and Hard Disk controllers, are all loaded fonts is one of the bigger ones). And the PC AT Keyboard, along with the 8042 and Hard Disk controllers, are all

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -989,10 +989,10 @@ HTMLOut.prototype.getDirList = function(sToken, sIndent, aParms)
* Why does this work? The ASCII value of '0' is 48, whereas the ASCII value of '/' is 47, * Why does this work? The ASCII value of '0' is 48, whereas the ASCII value of '/' is 47,
* so there are no intervening characters that could sort differently. * so there are no intervening characters that could sort differently.
*/ */
var re = /^([0-9]?[0-9])kb$/i; var re = /^([0-9]+)(kb|mb)$/i;
for (var i = 0; i < asFiles.length; i++) { for (var i = 0; i < asFiles.length; i++) {
var match = re.exec(asFiles[i]); var match = re.exec(asFiles[i]);
if (match) asFiles[i] = "//".substr(0, 3 - match[1].length) + asFiles[i]; if (match) asFiles[i] = "///".substr(0, 4 - match[1].length) + asFiles[i];
} }
asFiles.sort(); asFiles.sort();

View file

@ -106,7 +106,7 @@ var FATARRAYS = false;
* *
* See the Memory component for details. * See the Memory component for details.
*/ */
var TYPEDARRAYS = (typeof window.ArrayBuffer !== 'undefined'); var TYPEDARRAYS = (typeof ArrayBuffer !== 'undefined');
if (typeof module !== 'undefined') { if (typeof module !== 'undefined') {
global.PCJSCLASS = PCJSCLASS; global.PCJSCLASS = PCJSCLASS;

View file

@ -133,16 +133,16 @@ function Memory(addr, size, fReadOnly, controller) {
* know how to deal with this simple 1-1 mapping of addresses to bytes and words. * know how to deal with this simple 1-1 mapping of addresses to bytes and words.
*/ */
if (TYPEDARRAYS) { if (TYPEDARRAYS) {
this.buffer = new window.ArrayBuffer(size); this.buffer = new ArrayBuffer(size);
/** /**
* @type {DataView} * @type {DataView}
*/ */
this.dv = new window.DataView(this.buffer, 0, size); this.dv = new DataView(this.buffer, 0, size);
/* /*
* We could also use dv.getUint8() and dv.setUint8(), but using ab[] to get/set bytes * We could also use dv.getUint8() and dv.setUint8(), but using ab[] to get/set bytes
* in this.buffer is more convenient and presents no "endianness" issues. * in this.buffer is more convenient and presents no "endianness" issues.
*/ */
this.ab = new window.Uint8Array(this.buffer, 0, size); this.ab = new Uint8Array(this.buffer, 0, size);
this.setAccess(Memory.afnTypedArray); this.setAccess(Memory.afnTypedArray);
} else { } else {
if (FATARRAYS) { if (FATARRAYS) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long