From 24d15441927a7a3fc0d0f8199871ca4301ccc037 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Thu, 18 Feb 2016 09:06:41 -0800 Subject: [PATCH] Add alert for browsers that don't support named disk downloads --- .../2016-02-17-saving-disks-and-machines.md | 20 +++++++++++-------- docs/pcjs/demos/pc-dbg.js | 6 +++--- docs/pcjs/demos/pc.js | 6 +++--- modules/pcjs/lib/fdc.js | 12 ++++++----- versions/pcjs/1.20.9/pc-dbg.js | 6 +++--- versions/pcjs/1.20.9/pc.js | 6 +++--- 6 files changed, 31 insertions(+), 25 deletions(-) diff --git a/_posts/2016-02-17-saving-disks-and-machines.md b/_posts/2016-02-17-saving-disks-and-machines.md index 950876201..681dff658 100644 --- a/_posts/2016-02-17-saving-disks-and-machines.md +++ b/_posts/2016-02-17-saving-disks-and-machines.md @@ -5,7 +5,7 @@ date: 2016-02-17 14:00:00 permalink: /blog/2016/02/17/ --- -PCjs (v1.20.9) now offers some new, *much* easier ways to save disks and machines, thanks to the new +PCjs (v1.20.9) now offers new, *much* easier ways to save disks and machines, thanks to the new [Save Disk](/blog/2016/02/17/#saving-disks) and [Save Machine](/blog/2016/02/17/#saving-machines) features. With one click, PCjs can now generate a single download containing everything you need to embed any of our IBM PC demos on your own web page. @@ -22,17 +22,17 @@ copy of the disk, click the **Load** button first. PCjs will ask you to confirm disk and discard any changes. Note that the disk *should* be downloaded as an **.img** file, which is nothing more than a sector-by-sector binary -dump of the disk. For example, a 360Kb double-sided double-density (DSDD) disk contains 9 512-byte sectors on each +dump of the disk. For example, a 360Kb double-sided double-density (DSDD) disk contains 9 512-byte sectors in each of the 40 tracks on each of its 2 sides, so when you **Save** a 360Kb disk, the downloaded file should be exactly 368,640 bytes large. The Mac OS X operating system can automatically mount most **.img** files (from disks created by DOS 2.0 or later). -Older 1.x DOS disks, along with most non-DOS disks, do not have a BIOS Parameter Block (BPB) in the boot sector, so +Older DOS 1.x disks, along with most non-DOS disks, do not have a BIOS Parameter Block (BPB) in the boot sector, so most modern operating systems won't recognize the disk format. Other operating systems, like Windows, may require third-party software in order to mount an **.img** file, and some third-party software may prefer a different extension, such as **.ima** or **.bin**. -It's also recommended that make your **.img** files *read-only*, so that if you do mount them on your desktop +It's also recommended that you make your **.img** files *read-only*, so that if you do mount them on your desktop computer, neither you nor the operating system will inadvertently modify the contents of the disk. On OS X, this is easily done with the **chmod** utility. @@ -40,10 +40,14 @@ For example, if you saved the disk named "PC-DOS 2.00 (Disk 1)", it should have in your Downloads folder, so the OS X Terminal command `chmod -w PCDOS200-DISK1.img` will make it read-only, and `chmod +w PCDOS200-DISK1.img` will make it writable again. +**NOTE**: Some browsers, notably Safari, do not support named downloads, so any disks you download will end up +with default names like "Unknown" or "download". PCjs will still try to let you know what the original filename was, +so that you can rename it appropriately. + Saving Machines --- -Saving the entire state of any existing IBM PC machine is also easy now, thanks to the new **Save Machine** link. +Saving the entire state of any existing IBM PC machine is also much simpler now, using the new **Save Machine** link. You can choose to save a machine in its initial state, or make changes to any of the machine's disks and then save it. All your changes should be preserved. @@ -85,9 +89,9 @@ Some notes: * PCjs may attempt to name the downloaded file **pc.json** instead of **pc.js**, because a file with a ".js" extension could cause your web browser to block the download. - * For browsers that don't support dynamic downloads, PCjs will attempt to open a new window/tab instead. Make sure - you copy the *entire* contents of that window into a file named to **pc.js** (or **pc-dbg.js** if the machine is using - the built-in PCjs debugger). + * For browsers that don't support named downloads, PCjs will attempt to open a new window/tab instead. Make sure + you copy the *entire* contents of that window into a file named to **pc.js** (or **pc-dbg.js** if the machine is + using the built-in PCjs debugger). * Your browser may also impose size limitations on the download. If nothing happens, the machine data may be too large for your browser; try a different browser (eg, Firefox or Safari) or a different machine. diff --git a/docs/pcjs/demos/pc-dbg.js b/docs/pcjs/demos/pc-dbg.js index 35c7d7054..fb3046dc0 100644 --- a/docs/pcjs/demos/pc-dbg.js +++ b/docs/pcjs/demos/pc-dbg.js @@ -1020,9 +1020,9 @@ b+" changes applied)";b=-1;break}if(this.cf){c="unable to modify write-protected h.toJSON=function(){var a=JSON.stringify(this.A,function(a,c){return"file"==a?void 0:c}),a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,""),a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:"),a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,""),a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; function Mo(a){Ya.call(this,"FDC",a,Mo,524288);this.dmaRead=this.xk;this.dmaWrite=this.yk;this.dmaFormat=this.Nk;this.W=a.autoMount||null;this.C=[];this.qa=!Ka("Mobi")&&window&&"FileReader"in window}hb(Mo);aa={};var No={3:{Qd:3,fe:0,name:aa.Yn},4:{Qd:2,fe:1,name:aa.Wn},5:{Qd:9,fe:7,name:aa.ho},6:{Qd:9,fe:7,name:aa.Rn},7:{Qd:2,fe:0,name:aa.Tn},8:{Qd:1,fe:2,name:aa.Xn},10:{Qd:2,fe:7,name:aa.Sn},13:{Qd:6,fe:7,name:aa.En},15:{Qd:3,fe:0,name:aa.Vn}};h=Mo.prototype; h.Ub=function(a,b,c){var d=this;switch(b){case "listDisks":return this.xa[b]=c,c.onchange=function(){var a=d.xa.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){Ca("FDC option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.xa[b]=c,c.onchange=function(){var a=ca(c.value,10);null!=a&&Oo(d,a)},!0; -case "loadDrive":return this.xa[b]=c,c.onclick=function(){var a=d.xa.listDisks;a&&Po(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":return this.xa[b]=c,c.onclick=function(){var a=d.xa.listDrives;if(a&&a.options&&d.A)if(a=ca(a.value,10),a=d.A[a])if(a.Da){for(var b=a.Da,c="",k=0,q;q=wo(b,k++);)for(var r=0,x=q.length;r'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.pa[b]=c,c.onchange=function(){var a=ca(c.value,10);null!=a&&Xl(d,a)},!0; -case "loadDrive":return this.pa[b]=c,c.onclick=function(){var a=d.pa.listDisks;a&&Yl(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":return this.pa[b]=c,c.onclick=function(){var a=d.pa.listDrives;if(a&&a.options&&d.B)if(a=ca(a.value,10),a=d.B[a])if(a.za){for(var b=a.za,c="",p=0,q;q=Pl(b,p++);)for(var t=0,B=q.length;t'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.xa[b]=c,c.onchange=function(){var a=ca(c.value,10);null!=a&&Oo(d,a)},!0; -case "loadDrive":return this.xa[b]=c,c.onclick=function(){var a=d.xa.listDisks;a&&Po(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":return this.xa[b]=c,c.onclick=function(){var a=d.xa.listDrives;if(a&&a.options&&d.A)if(a=ca(a.value,10),a=d.A[a])if(a.Da){for(var b=a.Da,c="",k=0,q;q=wo(b,k++);)for(var r=0,x=q.length;r'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.pa[b]=c,c.onchange=function(){var a=ca(c.value,10);null!=a&&Xl(d,a)},!0; -case "loadDrive":return this.pa[b]=c,c.onclick=function(){var a=d.pa.listDisks;a&&Yl(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":return this.pa[b]=c,c.onclick=function(){var a=d.pa.listDrives;if(a&&a.options&&d.B)if(a=ca(a.value,10),a=d.B[a])if(a.za){for(var b=a.za,c="",p=0,q;q=Pl(b,p++);)for(var t=0,B=q.length;t