mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Add 2mg support to disk2
This commit is contained in:
parent
7209758339
commit
212db7cc77
@ -199,7 +199,7 @@ function openManage() {
|
||||
$("#manage").dialog("open");
|
||||
}
|
||||
|
||||
function loadHTTP(url, cb) {
|
||||
function loadHTTP(url) {
|
||||
loading = true;
|
||||
$("#loading").dialog("open");
|
||||
|
||||
@ -215,9 +215,6 @@ function loadHTTP(url, cb) {
|
||||
$("#disklabel" + _saveDrive).text(name);
|
||||
$("#loading").dialog("close");
|
||||
loading = false;
|
||||
if (cb) {
|
||||
cb();
|
||||
}
|
||||
}
|
||||
}
|
||||
req.send(null);
|
||||
|
@ -203,7 +203,7 @@ function openManage() {
|
||||
$("#manage").dialog("open");
|
||||
}
|
||||
|
||||
function loadHTTP(url, cb) {
|
||||
function loadHTTP(url) {
|
||||
loading = true;
|
||||
$("#loading").dialog("open");
|
||||
|
||||
@ -219,9 +219,6 @@ function loadHTTP(url, cb) {
|
||||
$("#disklabel" + _saveDrive).text(name);
|
||||
$("#loading").dialog("close");
|
||||
loading = false;
|
||||
if (cb) {
|
||||
cb();
|
||||
}
|
||||
}
|
||||
}
|
||||
req.send(null);
|
||||
|
32
js/disk2.js
32
js/disk2.js
@ -720,6 +720,38 @@ function DiskII(io, callbacks, slot)
|
||||
if (fmt === "do") {
|
||||
fmt = "dsk";
|
||||
}
|
||||
_cur.readOnly = false;
|
||||
if (fmt === "2mg") {
|
||||
// Standard header size is 64 bytes. Make assumptions.
|
||||
var prefix = new Uint8Array(data.slice(0, 64));
|
||||
var data = data.slice(64);
|
||||
|
||||
// Check image format.
|
||||
// Sure, it's really 64 bits. But only 2 are actually used.
|
||||
switch (prefix[0xc]) {
|
||||
case 0:
|
||||
fmt = "dsk";
|
||||
break;
|
||||
case 1:
|
||||
fmt = "po";
|
||||
break;
|
||||
case 2:
|
||||
fmt = "nib";
|
||||
break;
|
||||
default: // Something hinky, assume "dsk"
|
||||
fmt = "dsk";
|
||||
break;
|
||||
}
|
||||
var flags =
|
||||
prefix[0x10] | (prefix[0x11] << 8) |
|
||||
(prefix[0x12] << 16) | (prefix[0x13] << 24);
|
||||
_cur.readOnly = (flags & 0x80000000) ? true : false;
|
||||
if (flags & 0x10) {
|
||||
_cur.volume = flags & 0xff;
|
||||
} else {
|
||||
_cur.volume = 254;
|
||||
}
|
||||
}
|
||||
for (var t = 0; t < 35; t++) {
|
||||
var track, off, d;
|
||||
if (fmt === "nib") {
|
||||
|
Loading…
Reference in New Issue
Block a user