-- DiskDebugImpl.mesa -- Jim Gasbarro 9-Apr-84 10:25:48 DIRECTORY ColorVersatecDriver, ColorVersatecUtils, DicentraDiskDriver, OthelloDefs, Watchdog USING [Deactivate]; DiskDebugImpl: PROGRAM IMPORTS ColorVersatecDriver, ColorVersatecUtils, DicentraDiskDriver, OthelloDefs, Watchdog = BEGIN OPEN ColorVersatecDriver, ColorVersatecUtils, DicentraDiskDriver, OthelloDefs; GoToDebugger: SIGNAL = CODE; StripeBand: PROC [stripeOffset: CARDINAL, hyperOffset: LONG CARDINAL] = BEGIN buffer: ARRAY [0..wordsPerScan) OF CARDINAL; p: POINTER _ @buffer; FOR i: CARDINAL IN [0..wordsPerScan) DO IF i MOD 4 = stripeOffset THEN buffer[i] _ 0F0FFH ELSE buffer[i] _ 0; ENDLOOP; FOR i: LONG CARDINAL IN [0..scansPerBand) DO HyperStore[sourcePtr: p, destOffset: hyperOffset + (i * LENGTH[buffer]), wordCount: LENGTH[buffer]]; ENDLOOP; END; SetupBand: PROC [value: CARDINAL, hyperOffset: LONG CARDINAL] = BEGIN buffer: ARRAY [0..wordsPerScan) OF CARDINAL; p: POINTER _ @buffer; FOR i: CARDINAL IN [0..wordsPerScan) DO buffer[i] _ value; ENDLOOP; FOR i: LONG CARDINAL IN [0..scansPerBand) DO HyperStore[sourcePtr: p, destOffset: hyperOffset + (i * LENGTH[buffer]), wordCount: LENGTH[buffer]]; ENDLOOP; END; CheckBand: PROC [stripeOffset: CARDINAL, hyperOffset: LONG CARDINAL] = BEGIN buffer: ARRAY [0..wordsPerScan) OF CARDINAL; p: POINTER _ @buffer; FOR i: LONG CARDINAL IN [0..scansPerBand) DO HyperRead[destPtr: p, sourceOffset: hyperOffset + (i * LENGTH[buffer]), wordCount: LENGTH[buffer]]; FOR j: CARDINAL IN [0..wordsPerScan) DO IF j MOD 4 = stripeOffset THEN BEGIN IF buffer[j] # 0F0FFH THEN BEGIN OthelloDefs.WriteString["scan: "]; OthelloDefs.WriteLongNumber[i]; OthelloDefs.WriteString[" word: "]; OthelloDefs.WriteLongNumber[j]; OthelloDefs.WriteString[" expected: 170377 got: "]; OthelloDefs.WriteOctal[buffer[j]]; OthelloDefs.NewLine[]; END END ELSE IF buffer[j] # 0 THEN BEGIN OthelloDefs.WriteString["scan: "]; OthelloDefs.WriteLongNumber[i]; OthelloDefs.WriteString[" word: "]; OthelloDefs.WriteLongNumber[j]; OthelloDefs.WriteString[" expected: 0 got: "]; OthelloDefs.WriteOctal[buffer[j]]; OthelloDefs.NewLine[]; END ENDLOOP; ENDLOOP; END; ReadBand: PROC [cylinder: Cylinder] = BEGIN FOR i: LONG CARDINAL IN [0..sectorsPerBand) DO [] _ Read[head: CARDINAL[i / sectorsPerTrack], sector: CARDINAL[i MOD sectorsPerTrack], cylinder: cylinder, sectorCount: 1, cmdOffset: 32, dataOffset: 64 + (i * wordsPerSector)]; ENDLOOP; END; WriteBand: PROC [cylinder: Cylinder] = BEGIN FOR i: LONG CARDINAL IN [0..sectorsPerBand) DO [] _ Write[head: CARDINAL[i / sectorsPerTrack], sector: CARDINAL[i MOD sectorsPerTrack], cylinder: cylinder, sectorCount: 1, cmdOffset: 32, dataOffset: 64 + (i * wordsPerSector)]; ENDLOOP; END; BandTest: PROC [] = BEGIN DiskInitialCheckout[]; ShowMP[1000]; StripeBand[stripeOffset: 0, hyperOffset: 64]; ShowMP[2000]; OthelloDefs.WriteLine["Checking band before disk write..."]; CheckBand[stripeOffset: 0, hyperOffset: 64]; [] _ Write[head: 0, sector: 0, cylinder: 0, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[3000]; SetupBand[value: 52525B, hyperOffset: 64]; [] _ Read[head: 0, sector: 0, cylinder: 0, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[4000]; OthelloDefs.WriteLine["Checking band after disk read..."]; CheckBand[stripeOffset: 0, hyperOffset: 64]; OthelloDefs.WriteLine["Done."]; END; DiskToPlotterTest: PROC [] = BEGIN VersatecInitialCheckout[]; DiskInitialCheckout[]; ShowMP[1000]; StripeBand[stripeOffset: 0, hyperOffset: 64]; [] _ Write[head: 0, sector: 0, cylinder: 0, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; StripeBand[stripeOffset: 1, hyperOffset: 64]; [] _ Write[head: 0, sector: 0, cylinder: 200, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; StripeBand[stripeOffset: 2, hyperOffset: 64]; [] _ Write[head: 0, sector: 0, cylinder: 400, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; StripeBand[stripeOffset: 3, hyperOffset: 64]; [] _ Write[head: 0, sector: 0, cylinder: 600, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[2000]; [] _ Read[head: 0, sector: 0, cylinder: 0, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[2001]; SetColorMode[inches: 10, mode: FirstPassOfColor, color: Black, cmdOffset: 0]; ShowMP[2002]; PlotBuffer[wordCount: wordsPerBand, hyperOffset: 64]; ShowMP[2003]; Rewind[cmdOffset: 0]; ShowMP[3000]; [] _ Read[head: 0, sector: 0, cylinder: 200, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[3001]; SetColorMode[inches: 10, mode: IntermediatePassOfColor, color: Cyan, cmdOffset: 0]; ShowMP[3002]; PlotBuffer[wordCount: wordsPerBand, hyperOffset: 64]; ShowMP[3003]; Rewind[cmdOffset: 0]; ShowMP[4000]; [] _ Read[head: 0, sector: 0, cylinder: 400, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[4001]; SetColorMode[inches: 10, mode: IntermediatePassOfColor, color: Magenta, cmdOffset: 0]; ShowMP[4002]; PlotBuffer[wordCount: wordsPerBand, hyperOffset: 64]; ShowMP[4003]; Rewind[cmdOffset: 0]; ShowMP[5000]; [] _ Read[head: 0, sector: 0, cylinder: 600, sectorCount: sectorsPerBand, cmdOffset: 32, dataOffset: 64]; ShowMP[5001]; SetColorMode[inches: 10, mode: IntermediatePassOfColor, color: Yellow, cmdOffset: 0]; ShowMP[5002]; PlotBuffer[wordCount: wordsPerBand, hyperOffset: 64]; ShowMP[5003]; SendEOT[]; END; FormatDisk: PROC [] = BEGIN c: CHAR; OthelloDefs.WriteString["Are you sure [Y/N]? "]; c _ OthelloDefs.ReadChar[]; OthelloDefs.WriteChar[c]; OthelloDefs.NewLine[]; IF c # 'y AND c # 'Y THEN RETURN[]; [] _ RawFormat[cmdOffset: 32]; END; OthelloDefs.WriteLine["What's up doc?"]; Watchdog.Deactivate[]; DO c: CHAR; OthelloDefs.WriteString["BandTest, RWTest, Seek, Plot, Format, Debugger> "]; c _ OthelloDefs.ReadChar[]; OthelloDefs.WriteChar[c]; OthelloDefs.NewLine[]; SELECT c FROM 'B, 'b => BandTest[]; 'R, 'r => ReadWriteTest[]; 'S, 's => SeekTest[]; 'P, 'p => DiskToPlotterTest[]; 'F, 'f => FormatDisk[]; 'D, 'd => SIGNAL GoToDebugger[]; ENDCASE => OthelloDefs.WriteLine["Learn to type you moron."]; ENDLOOP; END.