;;; -*- Mode:LISP; Package:LAMBDA; Lowercase:T; BASE:10; readtable: ZL -*-
;;;
;;; (c) Copyright 1986 - Lisp Machine, Inc.
;;;

;;; Youcef. 01/06/86.
;;;
;;; This will provide an window interface for the hardware diagnostics.
;;;

(defvar *frame* NIL)
(defvar *command-pane* NIL)
(defvar *lam-command-menu* NIL)
(defvar *Current-config* NIL)
(defvar *title-pane* NIL)
(defvar *interaction-pane* NIL)
(defvar *path-info* NIL)
(defvar *current-test* NIL)
(defvar *current-instruction-pane* NIL)
(defvar *graphic-pane* NIL)
(defvar *debugger-rack* NIL)
(defvar *menu-choose-window-for-set-up* nil)
(defvar *mode-line-pane* NIL)
(defvar *lam-command-pane-for-experienced* nil)

(defvar *boards* nil)
(defvar *lines-to-delete-if-old-selection-is* NIL)
(defvar *list-of-paths* nil)
(defvar *list-of-lines* NIL)
(defvar *current-path* NIL)

(defvar *dummy-for-burr-brown* (make-instance 'lambda-via-burr-brown))
(defvar *dummy-for-serial* (make-instance 'lambda-via-lmi-serial))
;(defvar *dummy-for-local* (make-instance 'lambda-via-local-access))
;(defvar *dummy-for-LMI-DEBUG* (make-instance 'lambda-via-lmi-debug))



(defmacro force-input (char)
  `(funcall *interaction-pane* :force-kbd-input ,char)
  )

(defmacro force-string-in (string)
  `(dotimes (i (string-length ,string))
     (funcall *interaction-pane* :force-kbd-input (aref ,string i)))
  )

(defun open-locations ()
  (format *interaction-pane* "~%~%To open a register type <register>//
To change its contents enter the new value followed by <Return>.
To open previous location type ^, next location type <line>~%")
  )

(defun force-input-into-buffer (char)
  (force-input char)
  )

(defun force-string-into-buffer (string)
  (force-string-in string)
  )

(defvar *lam-menu-commands*
	`(("Opening locations"
	   :funcall open-locations :font fonts:tr8b
	   :documentation "Open a location, register in a processor")
	  ("Numeric value"
	   :eval (force-input-into-buffer #/=) :font fonts:tr8b
	   :documentation "Shows the numerical value of last value typed by you or LAM")
	  ("Open quantity"
	   :eval (force-input-into-buffer #\tab) :font fonts:tr8b
	   :documentation "Open quantity addressed by pointer field of last quantity typed")
	  ("Reset"
	   :eval (force-input-into-buffer #\ctrl-r) :font fonts:tr8b
	   :documentation "Reset")
	  ("Step"
	   :eval (force-input-into-buffer #\ctrl-n) :font fonts:tr8b
	   :documentation "Step one micro instruction")
	  ("Auto Step"
	   :eval (force-string-into-buffer ":AUTO-STEP ") :font fonts:tr8b
	   :documentation "Step in loop untill character is typed")
	  ("Proceed"
	   :eval (force-input-into-buffer #\ctrl-p) :font fonts:tr8b
	   :documentation "Run machine untill character is typed")
	  ("Stop"
	   :eval (force-input-into-buffer #\ctrl-s) :font fonts:tr8b
	   :documentation "Stop machine")
	  ("remote console"
	   :eval (force-input-into-buffer #\ctrl-t) :font fonts:tr8b
	   :documentation "Starts machine and enter remote console mode")
	  ("Modify"
	   :eval (force-string-into-buffer ":MODIFY ") :font fonts:tr8b
	   :documentation "Prints uinsts in opc buffer which modify arg (an A or M location)")
	  ("Affect"
	   :eval (force-string-into-buffer ":AFFECT ") :font fonts:tr8b
	   :documentation "Prints uinsts which affect this uinst")
	  ("Area"
	   :eval (force-string-into-buffer ":AREA ") :font fonts:tr8b
	   :documentation "Prints area that last value typed points to.")
	  ("Region"
	   :eval (force-string-into-buffer ":REGION ") :font fonts:tr8b
	   :documentation "Prints region that last value typed points to.")
	  ("Describe areas"
	   :eval (force-string-into-buffer ":DESCRIBE-AREAS ") :font fonts:tr8b
	   :documentation "Gives information about areas")
	  ("Describe region"
	   :eval (force-string-into-buffer ":DESCRIBE-REGION ") :font fonts:tr8b
	   :documentation "Gives information about region <arg>")
	  ("Communic area"
	   :eval (force-string-into-buffer ":SYSTEM-COMMUNICATION-AREA ") :font fonts:tr8b
	   :documentation "Prints entire contents of system communication area")
	  ("Scratch init area"
	   :eval (force-string-into-buffer ":SCRATCH-PAD-INIT-AREA ") :font fonts:tr8b
	   :documentation "Prints entire contents of Scratch pad init area")
	  ("Maps"
	   :eval (force-string-into-buffer ":MAPS ") :font fonts:tr8b
	   :documentation "Prints first and second level maps addressed by last value typed")
	  ("Stack backtrace"
	   :eval (force-string-into-buffer ":STKP ") :font fonts:tr8b
	   :documentation "Backtrace of info on stack. Preceeding arg is number of frames. All if no arg")
	  ("Trace"
	   :eval (force-string-into-buffer ":TRACE ") :font fonts:tr8b
	   :documentation "backtrace of info on stack pointed to by last value if valid stack group. otherwise like :STKP")
	  ("Tracen"
	   :eval (force-string-into-buffer ":TRACEN ") :font fonts:tr8b
	   :documentation "Like trace but does not print args")
	  ("Atom foo"
	   :eval (force-string-into-buffer ":ATOM ") :font fonts:tr8b
	   :documentation "Tells about atomic symbol foo")
	  ("Function foo"
	   :eval (force-string-into-buffer ":FUNCTION ") :font fonts:tr8b
	   :documentation "Tells about function cell of symbol foo")
	  ("Property foo"
	   :eval (force-string-into-buffer ":PROPERTY ") :font fonts:tr8b
	   :documentation "Tells about the property list symbol foo")
	  ("Backtrace"
	   :eval (force-string-into-buffer ":BACKTRACE ") :font fonts:tr8b
	   :documentation "I really do not know")
	  ("Memory status"
	   :eval (force-string-into-buffer ":MEMSTAT ") :font fonts:tr8b
	   :documentation "Tells about all pages that are swapped in.")
	  ("Relative PC"
	   :eval (force-string-into-buffer ":RELPC ") :font fonts:tr8b
	   :documentation "Types out what M-AP points to and if that is a FEF, prints out relative LC")
	  ("Code"
	   :eval (force-string-into-buffer ":CODE ") :font fonts:tr8b
	   :documentation "Disassembles the macrocode function being executed.")
	  ("Disassemble FEF"
	   :eval (force-string-into-buffer ":DISASSEMBLE-FEF ") :font fonts:tr8b
	   :documentation "Disassemble last quantity typed. Asks for center PC or NIL")
	  ("Check Map"
	   :eval (force-string-into-buffer ":CHECK-MAP ") :font fonts:tr8b
	   :documentation "Checks contents of hardware map against page hash table")
	  ("Check map bulk"
	   :eval (force-string-into-buffer ":CHECK-MAP-BULK ") :font fonts:tr8b
	   :documentation "similar to check map but does not take quite as long")
	  ("Check level2 map"
	   :eval (force-string-into-buffer ":CHECK-REVERSE-LEVEL-2-MAP-BULK ") :font fonts:tr8b
	   :documentation "I really do not know")
	  ("Print Frame"
	   :eval (force-string-into-buffer ":PF ") :font fonts:tr8b
	   :documentation "Interprets open register as LP-FEF Q of a PDL-FRAME and prints the entire frame")
	  ("Previous frame"
	   :eval (force-string-into-buffer ":PREVIOUS-ACTIVE-FRAME ") :font fonts:tr8b
	   :documentation "If the FEF word of a frame is openm open the prvious active frame")
	  ("Previous open frame"
	   :eval (force-string-into-buffer ":PREVIOUS-OPEN-FRAME ") :font fonts:tr8b
	   :documentation "Like previous frame, the previous open frame")
	  ("Flags"
	   :eval (force-string-into-buffer ":FLAGS ") :font fonts:tr8b
	   :documentation "Decodes the M-FLAGS")
	  ("Interrupts off"
	   :eval (force-string-into-buffer ":INTOFF ") :font fonts:tr8b
	   :documentation "Turns off interrupts of machine")
	  ("Interrupts on"
	   :eval (force-string-into-buffer ":INTON ") :font fonts:tr8b
	   :documentation "Turns on interrupts of machine")
	  ("TV interrupts off"
	   :eval (force-string-into-buffer ":TVINTOFF ") :font fonts:tr8b
	   :documentation "Turns off interrupts from TV")
	  ("TV interrupts on"
	   :eval (force-string-into-buffer ":TVINTON ") :font fonts:tr8b
	   :documentation "Turns on interrupts from TV")
	  ("Describe"
	   :eval (force-string-into-buffer ":DESCRIBE ") :font fonts:tr8b
	   :documentation "Describes last quantity typed if it is a closure or entity. If stack group prints info from stack")
	  ("Parity check"
	   :eval (force-string-into-buffer ":PCHECK ") :font fonts:tr8b
	   :documentation "Types what the parity generator chips for the last quantity examined should put out.")
	  ("Select speed"
	   :eval (force-string-into-buffer ":SELECT-SPEED ") :font fonts:tr8b
	   :documentation "Select TRAM speed")
	  ("LAM Iopb"
	   :eval (force-string-into-buffer ":LAM-IOPB ") :font fonts:tr8b
	   :documentation "Prints disk command block used by main ucode.")
	  ("Debug Iopb"
	   :eval (force-string-into-buffer ":DEBUG-IOPB ") :font fonts:tr8b
	   :documentation "Command block used by the LAM program itself.")
	  ("SDU Iopb"
	   :eval (force-string-into-buffer ":SDU-IOPB ") :font fonts:tr8b
	   :documentation "Command block used by the SDU")
	  ("PROM Iobp"
	   :eval (force-string-into-buffer ":PROM-IOPB ") :font fonts:tr8b
	   :documentation "Command block used by the PROM")
	  ("Address of CSM"
	   :eval (force-string-into-buffer ":CSM ") :font fonts:tr8b
	   :documentation "prints symbolic address of CSM")
	  ("Mapping registers"
	   :eval (force-string-into-buffer ":PRINT-ACTIVE-MAPPING-REGS ") :font fonts:tr8b
	   :documentation "Print lambda iopb and mapping register it addresses.")
	  ("Init disk control"
	   :eval (force-string-into-buffer ":EAGLE-INITIALIZE ") :font fonts:tr8b
	   :documentation "Initialize disk controller.")
	  ("RG mode reg"
	   :eval (force-string-into-buffer ":RG-MODE ") :font fonts:tr8b
	   :documentation "prints RG mode register")
	  ("DP mode reg"
	   :eval (force-string-into-buffer ":DP-MODE ") :font fonts:tr8b
	   :documentation "prints DP mode register")
	  ("Select symbols"
	   :eval (force-string-into-buffer ":SELECT-SYMBOLS ") :font fonts:tr8b
	   :documentation "Select symbols for current version of microcode")
	  ("Contents of MID"
	   :eval (force-string-into-buffer ":MID ") :font fonts:tr8b
	   :documentation "Print symbolic contents of MID addressed by last quantity typed or ARG")
	  ("Macro break"
	   :eval (force-string-into-buffer ":MACRO-BREAK ") :font fonts:tr8b
	   :documentation "Insert a break point into macrocode by smashing an instruction")
	  ("Macro unbreak"
	   :eval (force-string-into-buffer ":MACRO-UNBREAK ") :font fonts:tr8b
	   :documentation "Remove macro break point.")
	  ("Macro restore"
	   :eval (force-string-into-buffer ":MACRO-RESTORE ") :font fonts:tr8b
	   :documentation "Replace smashed instruction")
	  ("Macro single step"
	   :eval (force-string-into-buffer ":MACRO-SINGLE-STEP ") :font fonts:tr8b
	   :documentation "the input is arg:macro-single-step, sets or clears single step mode flag in hardware")
	  ("Force return"
	   :eval (force-string-into-buffer ":FORCE-MACRO-RETURN ") :font fonts:tr8b
	   :documentation "N:force-macro-return forces n levels of macrocode subroutine return")
	  ("Cold boot"
	   :eval (force-string-into-buffer ":COLD-BOOT ") :font fonts:tr8b
	   :documentation "Cold boot machine after microcode is loaded. Write memory configuration info.")
	  ("Load Cold boot"
	   :eval (force-string-into-buffer ":COLD-BOOT-AND-LOAD-SYMBOLS ") :font fonts:tr8b
	   :documentation "Loads symbols while it is Cold booting machine.")
	  ("Cold boot setup"
	   :eval (force-string-into-buffer ":COLD-BOOT-SETUP ") :font fonts:tr8b
	   :documentation "Cold boot machine but does not start machine. Write memory configuration info.")
	  ("Start at PROM"
	   :eval (force-string-into-buffer ":START-PROM ") :font fonts:tr8b
	   :documentation "Transfers to PROM at location 36000 or 36001 if in share mode.")
	  ("Chaos meters"
	   :eval (force-string-into-buffer ":CHAOS-METERS ") :font fonts:tr8b
	   :documentation "Prints out chaos meters of debugged machine.")
	  ("Ether meters"
	   :eval (force-string-into-buffer ":ETHER-METERS ") :font fonts:tr8b
	   :documentation "Prints out ethernet meters of debugged machine.")
	  ("Search OPCs"
	   :eval (force-string-into-buffer ":OPC-SEARCH ") :font fonts:tr8b
	   :documentation "Searches OPCs for a symbol you type.")
	  ("Summarize OPCs"
	   :eval (force-string-into-buffer ":SUMMERIZE-OPCS ") :font fonts:tr8b
	   :documentation "Summary of the history of the executed microcode.")
	  ("Turn CACHE on"
	   :eval (force-string-into-buffer ":CACHE-ON ") :font fonts:tr8b
	   :documentation "Turns cache on.")
	  ("Turn CACHE off"
	   :eval (force-string-into-buffer ":CACHE-OFF ") :font fonts:tr8b
	   :documentation "Turns cache off.")
	  ("Start"
	   :eval (force-string-into-buffer ":START ") :font fonts:tr8b
	   :documentation "address :start  starts machine and let it run.")
	  ("Low level T"
	   :eval (force-string-into-buffer ":LOW-LEVEL T ") :font fonts:tr8b
	   :documentation "Turns low level on where reading registers happens from hardware and not on saved state.")
	  ("Low level VERY"
	   :eval (force-string-into-buffer ":LOW-LEVEL VERY ") :font fonts:tr8b
	   :documentation "Mode where LAM tries not to affect  spontaneously the hardware in any way. Be carefull !!!")
	  ("Mode"
	   :eval (force-string-into-buffer ":MODE ") :font fonts:tr8b
	   :documentation "Decodes the mode register symbollically.")
	  ("Edit Mode register"
	   :eval (force-string-into-buffer ":CHMODE ") :font fonts:tr8b
	   :documentation "Edits the mode register symbollically.")
	  ("Restore"
	   :eval (force-string-into-buffer ":RESTORE ") :font fonts:tr8b
	   :documentation "Does a full restore, getting software state into hardware.")
	  ("SM Step"
	   :eval (force-string-into-buffer ":SM-STEP ") :font fonts:tr8b
	   :documentation "Calls SM-STEP program (minor cycle stepper).")
	  ("Select test"
	   :eval (force-string-into-buffer ":SELECT-TEST ") :font fonts:tr8b
	   :documentation "Calls select step program, menu interface to simple loop tests.")
	  ("Execute IR"
	   :eval (force-string-into-buffer ":EX ") :font fonts:tr8b
	   :documentation "Executes .IR once.")
	  ("Scope"
	   :eval (force-string-into-buffer ":SCOPE ") :font fonts:tr8b
	   :documentation "Executes whatever in debug-ir repeatedly at full speed. Deposit in .IR just before doing this.")
	  ("Set breakpoint"
	   :eval (force-string-into-buffer ":B ") :font fonts:tr8b
	   :documentation "Sets breakpoint at prefix arg or open location.")
	  ("Unset breakpoint"
	   :eval (force-string-into-buffer ":UB ") :font fonts:tr8b
	   :documentation "Unsets breakpoint at prefix arg or open location.")
	  ("List breakpoints"
	   :eval (force-string-into-buffer ":LISTB ") :font fonts:tr8b
	   :documentation "List breakpoints.")
	  ("Unset all breakpoints"
	   :eval (force-string-into-buffer ":UAB ") :font fonts:tr8b
	   :documentation "Unsets all breakpoints")
	  ("Reset breakpoints"
	   :eval (force-string-into-buffer ":RB ") :font fonts:tr8b
	   :documentation "Reset all breakpoints (usefull if they have been loaded over).")
	  ("Proceed"
	   :eval (force-string-into-buffer ":P ") :font fonts:tr8b
	   :documentation "Proceed machine.")
	  ("Warm boot"
	   :eval (force-string-into-buffer ":G ") :font fonts:tr8b
	   :documentation "Does 1@G and :P.")
	  ("Set temp break"
	   :eval (force-string-into-buffer ":TB ") :font fonts:tr8b
	   :documentation "Set temporary breakpoint at prefix arg or open location. Goes away when reached.")
	  ("Temp break proceed"
	   :eval (force-string-into-buffer ":TBP ") :font fonts:tr8b
	   :documentation "Set temporary breakpoint at prefix arg or open location and proceed.")
	  ("Set break at CALL"
	   :eval (force-string-into-buffer ":RETURN-BREAK ") :font fonts:tr8b
	   :documentation "Set breakpoint where current CALL instruction will return.")
	  ("Set break at US"
	   :eval (force-string-into-buffer ":US-BREAK ") :font fonts:tr8b
	   :documentation "Set breakpoint at current open US stack location, to top of US if no reg is open.")
	  ("Print as halfwords"
	   :eval (force-string-into-buffer "_H") :font fonts:tr8b
	   :documentation "type out as halwords low halfword high halfword.")
	  ("Print as bytes"
	   :eval (force-string-into-buffer "_B") :font fonts:tr8b
	   :documentation "type out as bytes right to left.")
	  ("Print as Lisp"
	   :eval (force-string-into-buffer "_Q") :font fonts:tr8b
	   :documentation "type out as LISP.")
	  ("Print as MAC INST"
	   :eval (force-string-into-buffer "_I") :font fonts:tr8b
	   :documentation "type out as a MACRO instruction.")
	  ("Print as MIC INST"
	   :eval (force-string-into-buffer "_A") :font fonts:tr8b
	   :documentation "type out as MICRO instruction.")
	  ("Print as Array"
	   :eval (force-string-into-buffer "_A") :font fonts:tr8b
	   :documentation "type out as ARRAY HEADER.")
	  ("Print as old MIC INS"
	   :eval (force-string-into-buffer "_V") :font fonts:tr8b
	   :documentation "type out as old style MICRO instruction.")
	  ("Print as Reg address"
	   :eval (force-string-into-buffer "__") :font fonts:tr8b
	   :documentation "type out as register addresses.")
	  ("Print as S-expression"
	   :eval (force-string-into-buffer "_S") :font fonts:tr8b
	   :documentation "type out as Lisp machine S-expression.")
	  ("Print as bits"
	   :eval (force-string-into-buffer "_#") :font fonts:tr8b
	   :documentation "type out as bit numbers of set bits.")
	  )
  )

(defvar *tests-for-boards*
	'((:LAMBDA
	    (("RG test" :funcall NEW-RG-TEST :font tr12bi :documentation "Test the RG board")
	     ("Complete RG test" :eval (NEW-RG-TEST t) :font tr12bi :documentation "Test the RG board")
	     ("CM test" :funcall NEW-CM-TEST :font tr12bi :documentation "Test the CM board")
	     ("DP test" :funcall NEW-DP-TEST :font tr12bi :documentation "Test the DP board")
	     ("MI test" :funcall NEW-MI-TEST :font tr12bi :documentation "Test the MI board")
	     ("Fast address tests" :funcall new-lam-test-fast-address-tests :font tr12bi
	      :documentation "Fast address tests of the different memory in the processor")
	     ("ALL tests" :funcall NEW-LAM-TEST-MACHINE :font tr12bi :documentation "Test the LAMBDA processor")
	     ("LAM" :funcall Process-lam :font tr12bi :documentation "ENTER LAM program")
	     ))
	  (:AVP
	    (("RG test" :funcall NEW-RG-TEST :font tr12bi :documentation "Test the RG board")
	     ("Complete RG test" :eval (NEW-RG-TEST t) :font tr12bi :documentation "Test the RG board")
	     ("CM test" :funcall NEW-CM-TEST :font tr12bi :documentation "Test the CM board")
	     ("DP test" :funcall NEW-DP-TEST :font tr12bi :documentation "Test the DP board")
	     ("MI test" :funcall NEW-MI-TEST :font tr12bi :documentation "Test the MI board")
	     ("Fast address tests" :funcall new-lam-test-fast-address-tests :font tr12bi
	      :documentation "Fast address tests of the different memory in the processor")
	     ("ALL tests" :funcall NEW-LAM-TEST-MACHINE :font tr12bi :documentation "Test the LAMBDA processor")
	     ("LAM" :funcall Process-lam :font tr12bi :documentation "ENTER LAM program")
	     )
	     )
	  (:MEMORY
	    ask kent hoult)
	  ))


(defvar *print-menu*
	'(("Print as halfwords"
	   :eval (force-string-into-buffer "_H") :font fonts:tr8b
	   :documentation "type out as halwords low halfword high halfword.")
	  ("Print as bytes"
	   :eval (force-string-into-buffer "_B") :font fonts:tr8b
	   :documentation "type out as bytes right to left.")
	  ("Print as Lisp"
	   :eval (force-string-into-buffer "_Q") :font fonts:tr8b
	   :documentation "type out as LISP.")
	  ("Print as MAC INST"
	   :eval (force-string-into-buffer "_I") :font fonts:tr8b
	   :documentation "type out as a MACRO instruction.")
	  ("Print as MIC INST"
	   :eval (force-string-into-buffer "_A") :font fonts:tr8b
	   :documentation "type out as MICRO instruction.")
	  ("Print as Array"
	   :eval (force-string-into-buffer "_A") :font fonts:tr8b
	   :documentation "type out as ARRAY HEADER.")
	  ("Print as old MIC INS"
	   :eval (force-string-into-buffer "_V") :font fonts:tr8b
	   :documentation "type out as old style MICRO instruction.")
	  ("Print as Reg address"
	   :eval (force-string-into-buffer "__") :font fonts:tr8b
	   :documentation "type out as register addresses.")
	  ("Print as S-expression"
	   :eval (force-string-into-buffer "_S") :font fonts:tr8b
	   :documentation "type out as Lisp machine S-expression.")
	  ("Print as bits"
	   :eval (force-string-into-buffer "_#") :font fonts:tr8b
	   :documentation "type out as bit numbers of set bits.")))


(defvar *area-menu*
	'(("Area"
	   :eval (force-string-into-buffer ":AREA ") :font fonts:tr8b
	   :documentation "Prints area that last value typed points to.")
	  ("Region"
	   :eval (force-string-into-buffer ":REGION ") :font fonts:tr8b
	   :documentation "Prints region that last value typed points to.")
	  ("Describe areas"
	   :eval (force-string-into-buffer ":DESCRIBE-AREAS ") :font fonts:tr8b
	   :documentation "Gives information about areas")
	  ("Describe region"
	   :eval (force-string-into-buffer ":DESCRIBE-REGION ") :font fonts:tr8b
	   :documentation "Gives information about region <arg>")
	  ("Communic area"
	   :eval (force-string-into-buffer ":SYSTEM-COMMUNICATION-AREA ") :font fonts:tr8b
	   :documentation "Prints entire contents of system communication area")
	  ("Scratch init area"
	   :eval (force-string-into-buffer ":SCRATCH-PAD-INIT-AREA ") :font fonts:tr8b
	   :documentation "Prints entire contents of Scratch pad init area"))
  )

(defvar *micro-breakpoints*
	'(("Set breakpoint"
	   :eval (force-string-into-buffer ":B ") :font fonts:tr8b
	   :documentation "Sets breakpoint at prefix arg or open location.")
	  ("Unset breakpoint"
	   :eval (force-string-into-buffer ":UB ") :font fonts:tr8b
	   :documentation "Unsets breakpoint at prefix arg or open location.")
	  ("List breakpoints"
	   :eval (force-string-into-buffer ":LISTB ") :font fonts:tr8b
	   :documentation "List breakpoints.")
	  ("Unset all breakpoints"
	   :eval (force-string-into-buffer ":UAB ") :font fonts:tr8b
	   :documentation "Unsets all breakpoints")
	  ("Reset breakpoints"
	   :eval (force-string-into-buffer ":RB ") :font fonts:tr8b
	   :documentation "Reset all breakpoints (usefull if they have been loaded over)."))
  )

(defvar *symbol-property*
	'(("Atom foo"
	   :eval (force-string-into-buffer ":ATOM ") :font fonts:tr8b
	   :documentation "Tells about atomic symbol foo")
	  ("Function foo"
	   :eval (force-string-into-buffer ":FUNCTION ") :font fonts:tr8b
	   :documentation "Tells about function cell of symbol foo")
	  ("Property foo"
	   :eval (force-string-into-buffer ":PROPERTY ") :font fonts:tr8b
	   :documentation "Tells about the property list symbol foo"))
  )

(defvar *step-stop*
	'(("Reset"
	   :eval (force-input-into-buffer #\ctrl-r) :font fonts:tr8b
	   :documentation "Reset")
	  ("Step"
	   :eval (force-input-into-buffer #\ctrl-n) :font fonts:tr8b
	   :documentation "Step one micro instruction")
	  ("Auto Step"
	   :eval (force-string-into-buffer ":AUTO-STEP ") :font fonts:tr8b
	   :documentation "Step in loop untill character is typed")
	  ("SM Step"
	   :eval (force-string-into-buffer ":SM-STEP ") :font fonts:tr8b
	   :documentation "Calls SM-STEP program (minor cycle stepper).")
	  ("Proceed"
	   :eval (force-input-into-buffer #\ctrl-p) :font fonts:tr8b
	   :documentation "Run machine untill character is typed")
	  ("Stop"
	   :eval (force-input-into-buffer #\ctrl-s) :font fonts:tr8b
	   :documentation "Stop machine")
	  ("remote console"
	   :eval (force-input-into-buffer #\ctrl-t) :font fonts:tr8b
	   :documentation "Starts machine and enter remote console mode")
	  ("Execute IR"
	   :eval (force-string-into-buffer ":EX ") :font fonts:tr8b
	   :documentation "Executes .IR once.")
	  ("Scope"
	   :eval (force-string-into-buffer ":SCOPE ") :font fonts:tr8b
	   :documentation "Executes whatever in debug-ir repeatedly at full speed. Deposit in .IR just before doing this."))
  )

(defvar *last-quantity*
	'(("Opening locations"
	   :funcall open-locations :font fonts:tr8b
	   :documentation "Open a location, register in a processor")
	  ("Numeric value"
	   :eval (force-input-into-buffer #/=) :font fonts:tr8b
	   :documentation "Shows the numerical value of last value typed by you or LAM")
	  ("Open quantity"
	   :eval (force-input-into-buffer #\tab) :font fonts:tr8b
	   :documentation "Open quantity addressed by pointer field of last quantity typed")
	  ("Describe"
	   :eval (force-string-into-buffer ":DESCRIBE ") :font fonts:tr8b
	   :documentation "Describes last quantity typed if it is a closure or entity. If stack group prints info from stack")
	  ))

(defvar *macro-breakpoints*
	'(("Macro break"
	   :eval (force-string-into-buffer ":MACRO-BREAK ") :font fonts:tr8b
	   :documentation "Insert a break point into macrocode by smashing an instruction")
	  ("Macro unbreak"
	   :eval (force-string-into-buffer ":MACRO-UNBREAK ") :font fonts:tr8b
	   :documentation "Remove macro break point.")
	  ("Macro restore"
	   :eval (force-string-into-buffer ":MACRO-RESTORE ") :font fonts:tr8b
	   :documentation "Replace smashed instruction")
	  ("Macro single step"
	   :eval (force-string-into-buffer ":MACRO-SINGLE-STEP ") :font fonts:tr8b
	   :documentation "the input is arg:macro-single-step, sets or clears single step mode flag in hardware")
	  ("Force return"
	   :eval (force-string-into-buffer ":FORCE-MACRO-RETURN ") :font fonts:tr8b
	   :documentation "N:force-macro-return forces n levels of macrocode subroutine return"))
  )

(defvar *mode-registers*
	'(("RG mode reg"
	   :eval (force-string-into-buffer ":RG-MODE ") :font fonts:tr8b
	   :documentation "prints RG mode register")
	  ("DP mode reg"
	   :eval (force-string-into-buffer ":DP-MODE ") :font fonts:tr8b
	   :documentation "prints DP mode register")
	  ("Mode"
	   :eval (force-string-into-buffer ":MODE ") :font fonts:tr8b
	   :documentation "Decodes the mode register symbollically.")
	  ("Edit Mode register"
	   :eval (force-string-into-buffer ":CHMODE ") :font fonts:tr8b
	   :documentation "Edits the mode register symbollically.")
	  ("Flags"
	   :eval (force-string-into-buffer ":FLAGS ") :font fonts:tr8b
	   :documentation "Decodes the M-FLAGS")
	  ("Memory status"
	   :eval (force-string-into-buffer ":MEMSTAT ") :font fonts:tr8b
	   :documentation "Tells about all pages that are swapped in.")
	  ("Contents of MID"
	   :eval (force-string-into-buffer ":MID ") :font fonts:tr8b
	   :documentation "Print symbolic contents of MID addressed by last quantity typed or ARG"))
  )

(defvar *command-blocks*
	`(("LAM Iopb"
	   :eval (force-string-into-buffer ":LAM-IOPB ") :font fonts:tr8b
	   :documentation "Prints disk command block used by main ucode.")
	  ("Debug Iopb"
	   :eval (force-string-into-buffer ":DEBUG-IOPB ") :font fonts:tr8b
	   :documentation "Command block used by the LAM program itself.")
	  ("SDU Iopb"
	   :eval (force-string-into-buffer ":SDU-IOPB ") :font fonts:tr8b
	   :documentation "Command block used by the SDU")
	  ("PROM Iobp"
	   :eval (force-string-into-buffer ":PROM-IOPB ") :font fonts:tr8b
	   :documentation "Command block used by the PROM")
	  ("Mapping registers"
	   :eval (force-string-into-buffer ":PRINT-ACTIVE-MAPPING-REGS ") :font fonts:tr8b
	   :documentation "Print lambda iopb and mapping register it addresses."))
  )

(defvar *starting-machine*
	'(("Cold boot"
	   :eval (force-string-into-buffer ":COLD-BOOT ") :font fonts:tr8b
	   :documentation "Cold boot machine after microcode is loaded. Write memory configuration info.")
	  ("Load Cold boot"
	   :eval (force-string-into-buffer ":COLD-BOOT-AND-LOAD-SYMBOLS ") :font fonts:tr8b
	   :documentation "Loads symbols while it is Cold booting machine.")
	  ("Cold boot setup"
	   :eval (force-string-into-buffer ":COLD-BOOT-SETUP ") :font fonts:tr8b
	   :documentation "Cold boot machine but does not start machine. Write memory configuration info.")
	  ("Start at PROM"
	   :eval (force-string-into-buffer ":START-PROM ") :font fonts:tr8b
	   :documentation "Transfers to PROM at location 36000 or 36001 if in share mode.")
	  ("Start"
	   :eval (force-string-into-buffer ":START ") :font fonts:tr8b
	   :documentation "address :start  starts machine and let it run.")
	  ("Proceed"
	   :eval (force-string-into-buffer ":P ") :font fonts:tr8b
	   :documentation "Proceed machine.")
	  ("Warm boot"
	   :eval (force-string-into-buffer ":G ") :font fonts:tr8b
	   :documentation "Does 1@G and :P."))
  )

(defvar *map-commands*
	'(("Maps"
	   :eval (force-string-into-buffer ":MAPS ") :font fonts:tr8b
	   :documentation "Prints first and second level maps addressed by last value typed")
	  ("Check Map"
	   :eval (force-string-into-buffer ":CHECK-MAP ") :font fonts:tr8b
	   :documentation "Checks contents of hardware map against page hash table")
	  ("Check map bulk"
	   :eval (force-string-into-buffer ":CHECK-MAP-BULK ") :font fonts:tr8b
	   :documentation "similar to check map but does not take quite as long")
	  ("Check level2 map"
	   :eval (force-string-into-buffer ":CHECK-REVERSE-LEVEL-2-MAP-BULK ") :font fonts:tr8b
	   :documentation "I really do not know"))
  )

(defvar *frame-commands*
	'(("Print Frame"
	   :eval (force-string-into-buffer ":PF ") :font fonts:tr8b
	   :documentation "Interprets open register as LP-FEF Q of a PDL-FRAME and prints the entire frame")
	  ("Previous frame"
	   :eval (force-string-into-buffer ":PREVIOUS-ACTIVE-FRAME ") :font fonts:tr8b
	   :documentation "If the FEF word of a frame is openm open the prvious active frame")
	  ("Previous open frame"
	   :eval (force-string-into-buffer ":PREVIOUS-OPEN-FRAME ") :font fonts:tr8b
	   :documentation "Like previous frame, the previous open frame"))
  )

(defvar *interrupts-and-cache*
	'(("Interrupts off"
	   :eval (force-string-into-buffer ":INTOFF ") :font fonts:tr8b
	   :documentation "Turns off interrupts of machine")
	  ("Interrupts on"
	   :eval (force-string-into-buffer ":INTON ") :font fonts:tr8b
	   :documentation "Turns on interrupts of machine")
	  ("TV interrupts off"
	   :eval (force-string-into-buffer ":TVINTOFF ") :font fonts:tr8b
	   :documentation "Turns off interrupts from TV")
	  ("TV interrupts on"
	   :eval (force-string-into-buffer ":TVINTON ") :font fonts:tr8b
	   :documentation "Turns on interrupts from TV")
	  ("Turn CACHE on"
	   :eval (force-string-into-buffer ":CACHE-ON ") :font fonts:tr8b
	   :documentation "Turns cache on.")
	  ("Turn CACHE off"
	   :eval (force-string-into-buffer ":CACHE-OFF ") :font fonts:tr8b
	   :documentation "Turns cache off."))
  )

(defvar *trace-menu*
	'(("Backtrace"
	   :eval (force-string-into-buffer ":BACKTRACE ") :font fonts:tr8b
	   :documentation "I really do not know")
	  ("Stack backtrace"
	   :eval (force-string-into-buffer ":STKP ") :font fonts:tr8b
	   :documentation "Backtrace of info on stack. Preceeding arg is number of frames. All if no arg")
	  ("Trace"
	   :eval (force-string-into-buffer ":TRACE ") :font fonts:tr8b
	   :documentation "backtrace of info on stack pointed to by last value if valid stack group. otherwise like :STKP")
	  ("Tracen"
	   :eval (force-string-into-buffer ":TRACEN ") :font fonts:tr8b
	   :documentation "Like trace but does not print args"))
  )

(defvar *instruction-and-code-menu*
	'(("Relative PC"
	   :eval (force-string-into-buffer ":RELPC ") :font fonts:tr8b
	   :documentation "Types out what M-AP points to and if that is a FEF, prints out relative LC")
	  ("Code"
	   :eval (force-string-into-buffer ":CODE ") :font fonts:tr8b
	   :documentation "Disassembles the macrocode function being executed.")
	  ("Disassemble FEF"
	   :eval (force-string-into-buffer ":DISASSEMBLE-FEF ") :font fonts:tr8b
	   :documentation "Disassemble last quantity typed. Asks for center PC or NIL")
	  ("Modify"
	   :eval (force-string-into-buffer ":MODIFY ") :font fonts:tr8b
	   :documentation "Prints uinsts in opc buffer which modify arg (an A or M location)")
	  ("Affect"
	   :eval (force-string-into-buffer ":AFFECT ") :font fonts:tr8b
	   :documentation "Prints uinsts which affect this uinst")
	  ("Search OPCs"
	   :eval (force-string-into-buffer ":OPC-SEARCH ") :font fonts:tr8b
	   :documentation "Searches OPCs for a symbol you type.")
	  ("Summarize OPCs"
	   :eval (force-string-into-buffer ":SUMMERIZE-OPCS ") :font fonts:tr8b
	   :documentation "Summary of the history of the executed microcode."))
  )

(defvar *temp-breakpoints*
	'(("Set temp break"
	   :eval (force-string-into-buffer ":TB ") :font fonts:tr8b
	   :documentation "Set temporary breakpoint at prefix arg or open location. Goes away when reached.")
	  ("Temp break proceed"
	   :eval (force-string-into-buffer ":TBP ") :font fonts:tr8b
	   :documentation "Set temporary breakpoint at prefix arg or open location and proceed.")
	  ("Set break at CALL"
	   :eval (force-string-into-buffer ":RETURN-BREAK ") :font fonts:tr8b
	   :documentation "Set breakpoint where current CALL instruction will return.")
	  ("Set break at US"
	   :eval (force-string-into-buffer ":US-BREAK ") :font fonts:tr8b
	   :documentation "Set breakpoint at current open US stack location, to top of US if no reg is open."))
  )

(defvar *Examine-menu*
	`(("MD"
	   :eval (force-string-into-buffer "MD// ") :font fonts:tr8b
	   :documentation "Examine value in MD register")
	  ("OPC's"
	   :eval (display-saved-opcs) :font fonts:tr8b
	   :documentation "Examine history")
	  ("C-MEM"
	   :eval (display-memories 'CMEM) :font fonts:tr8b
	   :documentation "Examine contents of control memory")
	  ("A-MEM"
	   :eval (display-memories 'AMEM) :font fonts:tr8b
	   :documentation "Examine contents of A scratch pad memory")
	  ("M-MEM"
	   :eval (display-memories 'MMEM) :font fonts:tr8b
	   :documentation "Examine contents of M scratch pad memory")
	  ("MID"
	   :eval (display-memories 'MID) :font fonts:tr8b
	   :documentation "Examine contents of Macro instruction memory")
	  ("Level 1 map"
	   :eval (display-memories 'L1MEM) :font fonts:tr8b
	   :documentation "Examine contents of Level 1 map")
	  ("Level 2 map"
	   :eval (display-memories 'L2MEM) :font fonts:tr8b
	   :documentation "Examine contents of Level 2 map")
	  ("Ctrl bit in 2 map"
	   :eval (display-memories '2CMEM) :font fonts:tr8b
	   :documentation "Examine contents of control bit in level 2 map")
	  ("Micro stack"
	   :eval (display-memories 'US) :font fonts:tr8b
	   :documentation "Examine contents of micro stack")
	  ("D-MEM"
	   :eval (display-memories 'DMEM) :font fonts:tr8b
	   :documentation "Examine contents of Dispatch memory")
	  ("FUNC-SRC"
	   :eval (display-memories 'FS) :font fonts:tr8b
	   :documentation "Examine contents of Functional sources")
	  ("FUNC-DEST"
	   :eval (display-memories 'DS) :font fonts:tr8b
	   :documentation "Examine contents of Functional DESTINATIONs")
	  )
  )

(defvar *condensed-lam-menu*
	'(("Chaos meters"
	   :eval (force-string-into-buffer ":CHAOS-METERS ") :font fonts:tr8b
	   :documentation "Prints out chaos meters of debugged machine.")
	  ("Ether meters"
	   :eval (force-string-into-buffer ":ETHER-METERS ") :font fonts:tr8b
	   :documentation "Prints out ethernet meters of debugged machine.")
	  ("Select speed"
	   :eval (force-string-into-buffer ":SELECT-SPEED ") :font fonts:tr8b
	   :documentation "Select TRAM speed")
	  ("Init disk control"
	   :eval (force-string-into-buffer ":EAGLE-INITIALIZE ") :font fonts:tr8b
	   :documentation "Initialize disk controller.")
	  ("Parity check"
	   :eval (force-string-into-buffer ":PCHECK ") :font fonts:tr8b
	   :documentation "Types what the parity generator chips for the last quantity examined should put out.")
	  ("Address of CSM"
	   :eval (force-string-into-buffer ":CSM ") :font fonts:tr8b
	   :documentation "prints symbolic address of CSM")
	  ("Select symbols"
	   :eval (force-string-into-buffer ":SELECT-SYMBOLS ") :font fonts:tr8b
	   :documentation "Select symbols for current version of microcode")
	  ("Show as" :eval (update-mode-line-pane *print-menu*) :font fonts:tr8b
	   :documentation "Gives different options in mode line of how to print last quantity typed")
	  ("Instr and code commands" :eval (update-mode-line-pane *instruction-and-code-menu*) :font fonts:tr8b
	   :documentation "Commands to search for instructions or look at disassembled code, summerize opc's....")
	  ("Interrupts and cache" :eval (update-mode-line-pane *interrupts-and-cache*) :font fonts:tr8b
	   :documentation "Interrupt and Cache commands.")
	  ("Area and region" :eval (update-mode-line-pane *Area-menu*) :font fonts:tr8b
	   :documentation "Commands for examining areas and regions")
	  ("Map commands" :eval (update-mode-line-pane *map-commands*) :font fonts:tr8b
	   :documentation "Mapping register commands")
	  ("Mode registers" :eval (update-mode-line-pane *mode-registers*) :font fonts:tr8b
	   :documentation "Commands for examining mode registers")
	  ("Symbol commands" :eval (update-mode-line-pane *symbol-property*) :font fonts:tr8b
	   :documentation "Command for examining symbol typed")
	  ("Frame commands" :eval (update-mode-line-pane *frame-commands*) :font fonts:tr8b
	   :documentation "Command to print and examine frames")
	  ("Micro breakpoints" :eval (update-mode-line-pane *micro-breakpoints*) :font fonts:tr8b
	   :documentation "Commands for setting or resetting microcode level breakpoints")
	  ("Temporary breakpoints" :eval (update-mode-line-pane *temp-breakpoints*) :font fonts:tr8b
	   :documentation "Commands to set or reset temporary breakpoints.")
	  ("Macro Commands" :eval (update-mode-line-pane *macro-breakpoints*) :font fonts:tr8b
	   :documentation "Commands for setting or resetting macrocode level breakpoints")
	  ("Stepping or stopping" :Eval (update-mode-line-pane *step-stop*) :font fonts:tr8b
	   :documentation "Commands for single stepping or stopping machine")
	  ("Command blocks" :eval (update-mode-line-pane *command-blocks*) :font fonts:tr8b
	   :documentation "Commands for IOPB's")
	  ("Starting machine" :eval (update-mode-line-pane *starting-machine*) :font fonts:tr8b
	   :documentation "Commands for starting machine")
	  ("Trace commands" :Eval (update-mode-line-pane *trace-menu*) :font fonts:tr8b
	   :documentation "Trace commands for stack, backtrace...")
	  ("Examine registers" :eval (update-mode-line-pane *examine-menu*) :font fonts:tr8b
	   :documentation "Window oriented examiner of register in the processor.")
	  )
  )

(defvar *permanent-menu-items*
	'(("Setup" :funcall process-function-setup-environment
	   :font fonts:tr12bi
	   :documentation
	   "Setup environment (choose board type, interface type...)")
	  ("LAM" :funcall process-lam
	   :font fonts:tr12bi
	   :documentation
	   "Interactive debugging tool for experienced users")
	  ("LAM for novice"
	   :funcall process-lam-novice
	   :font fonts:tr12bi
	   :documentation
	   "LAM with all commands in a menu")
	  ("Select test"
	   :funcall new-select-test
	   :font fonts:tr12bi
	   :documentation
	   "Select one of the tests")
	  ("Select path"
	   :funcall select-path
	   :font fonts:tr12bi
	   :documentation
	   "Select one of the existing paths")
	  )
  )



(defvar *lam-permanent-menu-items*
	'(("Data paths"
	   :funcall process-data-path
	   :font fonts:tr12bi
	   :documentation
	   "slow speed data path")
	  ("LAM for novice"
	   :eval (process-lam-internal nil)
	   :font fonts:tr12bi
	   :documentation
	   "LAM with all commands in a menu")
	  ("Select path"
	   :funcall select-path
	   :font fonts:tr12bi
	   :documentation
	   "Select one of the existing paths")
	  ("Exit"
	   :eval (force-input #\altmode)
	   :font fonts:tr12bi
	   :documentation "Exit LAM program")
	  )
  )

(defvar *lam-permanent-menu-items-for-novice*
	'(("Data paths"
	   :funcall process-data-path
	   :font fonts:tr12bi
	   :documentation
	   "slow speed data path")
	  ("LAM for Experienced"
	   :eval (process-lam-internal T)
	   :font fonts:tr12bi
	   :documentation
	   "LAM condensed commands in a menu")
	  ("Select path"
	   :funcall select-path
	   :font fonts:tr12bi
	   :documentation
	   "Select one of the existing paths")
	  ("Exit"
	   :eval (force-input #\altmode)
	   :font fonts:tr12bi
	   :documentation "Exit LAM program")
	  )
  )