This commit is contained in:
Will Scullin 2021-07-09 17:53:30 -07:00
parent 45681d8e89
commit f4b0100c98
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD
4 changed files with 15 additions and 18 deletions

View File

@ -67,7 +67,6 @@ const LOC = {
DRIVEWRITEMODE: 0x8F // Q7H: Write DRIVEWRITEMODE: 0x8F // Q7H: Write
} as const; } as const;
/** Logic state sequencer ROM */ /** Logic state sequencer ROM */
// See Understanding the Apple IIe, Table 9.3 Logic State Sequencer Commands // See Understanding the Apple IIe, Table 9.3 Logic State Sequencer Commands
// CODE OPERATION BEFORE AFTER // CODE OPERATION BEFORE AFTER

View File

@ -564,10 +564,12 @@ export function analyseDisk(disk: NibbleDisk) {
} }
/** /**
* Debugging utility to convert a bitstream into a nibble. Does not wrap.
* *
* @param bits Bitstream containing nibbles * @param bits Bitstream containing nibbles
* @param offset Offset into bitstream to start nibblizing * @param offset Offset into bitstream to start nibblizing
* @returns The next nibble in the bitstream * @returns nibble, the next nibble in the bitstream,
* and offset, the end of that nibble in the bitstream
*/ */
export function grabNibble(bits: bit[], offset: number) { export function grabNibble(bits: bit[], offset: number) {

View File

@ -29,7 +29,6 @@ const WOZ_INTEGRITY_CHECK = 0x0a0d0aff;
* @param end end index of string * @param end end index of string
* @returns ASCII string * @returns ASCII string
*/ */
function stringFromBytes(data: DataView, start: number, end: number): string { function stringFromBytes(data: DataView, start: number, end: number): string {
return String.fromCharCode.apply( return String.fromCharCode.apply(
null, null,
@ -188,7 +187,6 @@ export class TrksChunk2 extends TrksChunk {
} }
} }
export class MetaChunk { export class MetaChunk {
values: Record<string, string> values: Record<string, string>
@ -213,20 +211,16 @@ interface Chunks {
/** /**
* Returns a `Disk` object from Woz image data. * Returns a `Disk` object from Woz image data.
* @param {*} options the disk image and options * @param options the disk image and options
* @returns {import('./format_utils').Disk} * @returns A bitstream disk
*/ */
export default function createDiskFromWoz(options: DiskOptions) { export default function createDiskFromWoz(options: DiskOptions): WozDisk {
const { rawData } = options; const { rawData } = options;
if (!rawData) { if (!rawData) {
throw new Error('Requires rawData'); throw new Error('Requires rawData');
} }
const dv = new DataView(rawData, 0); const dv = new DataView(rawData, 0);
let dvOffset = 0; let dvOffset = 0;
const disk: Partial<WozDisk> = {
encoding: ENCODING_BITSTREAM,
};
let wozVersion; let wozVersion;
const chunks: Chunks = {}; const chunks: Chunks = {};
@ -303,11 +297,14 @@ export default function createDiskFromWoz(options: DiskOptions) {
debug(chunks); debug(chunks);
disk.trackMap = chunks.tmap?.trackMap || []; const disk: WozDisk = {
disk.tracks = chunks.trks?.tracks || []; encoding: ENCODING_BITSTREAM,
disk.rawTracks = chunks.trks?.rawTracks || []; trackMap: chunks.tmap?.trackMap || [],
disk.readOnly = true; //chunks.info.writeProtected === 1; tracks: chunks.trks?.tracks || [],
disk.name = chunks.meta?.values['title'] || options.name; rawTracks: chunks.trks?.rawTracks || [],
readOnly: true, //chunks.info.writeProtected === 1;
name: chunks.meta?.values['title'] || options.name
};
return disk as WozDisk; return disk;
} }

View File

@ -246,7 +246,6 @@ describe('ProDOS format', () => {
i = expectSequence(track, i, [0xDE, 0xAA, 0xEB]); i = expectSequence(track, i, [0xDE, 0xAA, 0xEB]);
}); });
it('has correct Address Fields for all tracks', () => { it('has correct Address Fields for all tracks', () => {
// _Beneath Apple DOS_, TRACK FORMATTING, p. 3-12 // _Beneath Apple DOS_, TRACK FORMATTING, p. 3-12
const disk = ProDOS({ const disk = ProDOS({