-- XXDebugUser.mesa Edited by Bruce, September 22, 1980 11:19 AM DIRECTORY AltoDefs: FROM "altodefs", Inline: FROM "inline", IODefs: FROM "iodefs", Mopcodes: FROM "mopcodes", RESOut: FROM "resout", SegmentDefs: FROM "segmentdefs", StringDefs: FROM "stringdefs", XXDebugDefs: FROM "xxdebugdefs"; XXDebugUser: PROGRAM IMPORTS Inline, RESOut, SegmentDefs, StringDefs EXPORTS XXDebugDefs = BEGIN OPEN RESOut, XXDebugDefs; CoreFile: SegmentDefs.FileHandle ← NIL; CoreSeg: SegmentDefs.FileSegmentHandle; GetPage: PROCEDURE [page: CARDINAL] RETURNS [base: POINTER] = BEGIN OPEN SegmentDefs; IF CoreFile = NIL THEN BEGIN CoreFile ← NewFile["Swatee"L, Read, DefaultVersion]; LockFile[CoreFile]; CoreSeg ← NewFileSegment[CoreFile, page, 1, Read]; MakeSwappedIn[CoreSeg, DefaultBase, HardUp]; END; IF CoreSeg.base # page THEN BEGIN Unlock[CoreSeg]; SwapOut[CoreSeg]; MoveFileSegment[CoreSeg, page, 1]; MakeSwappedIn[CoreSeg, DefaultBase, HardUp]; END; base ← SegmentAddress[CoreSeg]; END; UserREAD: PUBLIC PROCEDURE [loc: LONG POINTER] RETURNS [val: UNSPECIFIED] = BEGIN OPEN Mopcodes; mempage, offset: CARDINAL; [mempage, offset] ← Inline.LongDivMod[LOOPHOLE[loc], AltoDefs.PageSize]; SELECT mempage FROM > 253 => RETURN[ReadVM[loc]]; ENDCASE => RETURN [(GetPage[mempage] + offset)↑]; END; UserCopyRead: PUBLIC PROCEDURE [ from: LONG POINTER, nwords: CARDINAL, to: LONG POINTER] = BEGIN i: CARDINAL; FOR i IN [0..nwords) DO (to+i)↑ ← UserREAD[from+i]; ENDLOOP; RETURN END; ReadVM: PROCEDURE [p: LONG POINTER] RETURNS [UNSPECIFIED] = BEGIN RBL: PROC [LONG POINTER] RETURNS [UNSPECIFIED] = MACHINE CODE BEGIN Mopcodes.zRBL, 0 END; RETURN[RBL[p]]; END; Octal0: IODefs.NumberFormat = [base: 8, unsigned: TRUE, zerofill: FALSE, columns: 0]; nString: PUBLIC STRING ← NIL; UserOctalRead: PUBLIC PROCEDURE [loc: LONG POINTER] = BEGIN val, i, cols, count: CARDINAL; IF nString = NIL THEN GO TO noNumber; count ← StringDefs.StringToNumber[nString, 10 ! StringDefs.InvalidNumber => GO TO noNumber]; PCr[]; FOR i IN [0..count) DO val ← UserREAD[(loc+i)]; cols ← Log8[val]; IF val > 7 THEN cols ← cols + 1; IF i # 0 AND MakeRoom[cols+2, 0] THEN PString[", "] ELSE {PLongNumber[(loc+i), Octal0]; PString["B: "L]}; POctal[val]; ENDLOOP; EXITS noNumber => BEGIN Complain["specify a count, please"L]; ERROR cancelAction; END; END; END.