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
} as const;
/** Logic state sequencer ROM */
// See Understanding the Apple IIe, Table 9.3 Logic State Sequencer Commands
// 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 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) {

View File

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