Fixed a couple of new DiskDump bugs

This commit is contained in:
Jeff Parsons 2016-02-23 10:48:22 -08:00
commit a56e347a88
5 changed files with 19 additions and 16 deletions

View file

@ -1,4 +1,5 @@
developer: true
url: "http://localhost:4000"
pcjs:
compiled: false

View file

@ -13,10 +13,10 @@ Browse [IBM PC](pc/) and [Challenger 1P](c1p/) disk archives.
PCjs works best with disk images in a **JSON** format, to save conversion time, so that's the only
disk image format you'll find on the PCjs website.
To convert any of our **JSON** disk images back into an **IMG** file, you can use the DiskDump API
To convert any of our **JSON** disk images back into an **IMG** file, you can use the [DiskDump API](/api/v1/dump)
with the *format* parameter set to `img` instead of `json`. For example:
http://localhost:8088/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img
{{ site.url }}/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img
In fact, when browsing the disk archives, the PCjs web server automatically provides "onclick" handlers
for links to JSON-encoded disk images, which will invoke the API for you.

View file

@ -211,9 +211,9 @@ or with the "--path" option, which specifies either a single file or a set files
node diskdump --path="./apps/pc/1981/visicalc/bin/vc.com;../readme.md" --format=json --output=./apps/pc/1981/visicalc/disk.json
or via the PCjs server's DiskDump API:
or via the PCjs server's [DiskDump API](/api/v1/dump):
http://www.pcjs.org/api/v1/dump?path=/apps/pc/1981/visicalc/bin/vc.com&format=json
{{ site.url }}/api/v1/dump?path=/apps/pc/1981/visicalc/bin/vc.com&format=json
Learn more about PCjs disk image formats [here](/disks/).

View file

@ -158,25 +158,27 @@ All of the examples described above are available for [download](examples/).
### Creating PCjs-Compatible Disk Images
If you have (or find) an IMG disk image file on a server, the PCjs web server provides a **DiskDump API** via endpoint
"/api/v1/dump" that creates PCjs-compatible disks in JSON:
If you have (or find) an IMG disk image file on a server, the PCjs web server provides a
[DiskDump API](/api/v1/dump) via endpoint "/api/v1/dump" that creates PCjs-compatible disks in JSON:
http://localhost:8088/api/v1/dump?disk=(file|url)&format=json
{{ site.url }}/api/v1/dump?disk=(file|url)&format=json
For example, let's say you found a disk image online:
For example, let's say you found a disk image online, such as:
http://archive.pcjs.org/disks/pc/dos/ibm/1.00/PCDOS100.img
To convert it to a PCjs-compatible JSON format, use the following command:
To convert it to a PCjs-compatible JSON format, issue the following
[request](/api/v1/dump?disk=http://archive.pcjs.org/disks/pc/dos/ibm/1.00/PCDOS100.img&format=json),
save the resulting JSON file to a folder on your server, and then update your machine XML file(s) to use that file.
http://localhost:8088/api/v1/dump?disk=http://archive.pcjs.org/disks/pc/dos/ibm/1.00/PCDOS100.img&format=json
{{ site.url }}/api/v1/dump?disk=http://archive.pcjs.org/disks/pc/dos/ibm/1.00/PCDOS100.img&format=json
Save the resulting JSON file to a folder on your server, and then update your machine XML file(s) to use that file.
If necessary, you can also reverse the process, converting a JSON disk image back into an IMG file:
If necessary, you can also reverse the process and convert a JSON disk image back into an IMG file, with the
this [request](/api/v1/dump?disk=http://www.pcjs.org/disks/pc/dos/ibm/1.00/PCDOS100.json&format=img):
http://localhost:8088/api/v1/dump?disk=http://www.pcjs.org/disks/pc/dos/ibm/1.00/PCDOS100.json&format=img
{{ site.url }}/api/v1/dump?disk={{ site.url }}/disks/pc/dos/ibm/1.00/PCDOS100.json&format=img
Although PCjs will accept IMG disk image files, it must call the **DiskDump API** to convert the image
Although PCjs will accept IMG disk image files, it must call the [DiskDump API](/api/v1/dump) to convert the image
every time it's loaded, so it's *much* faster and more efficient to use pre-converted JSON-encoded disk images.
Remember that PC and PC XT machines supported only 160Kb diskettes (on any version of PC-DOS),

View file

@ -155,7 +155,7 @@ BufferPF.prototype.fill = function(b)
if (NODE) {
this.buf.fill(b);
} else {
for (var off = 0; off < this.ab.length; off++) {
for (var off = 0; off < this.length; off++) {
this.dv.setUint8(off, b);
}
}
@ -175,7 +175,7 @@ BufferPF.prototype.write = function(s, off, len)
this.buf.write(s, off, len);
} else {
var i = 0;
while (off < init.length) {
while (off < this.length) {
this.dv.setUint8(off, s.charCodeAt(i++));
off++;
}