;;; -*- Mode:LISP; Package:LAMBDA; Base:8 -*-



;izero-good-parity

(defvar current-processor-type nil)

(defun setup-common-symbols (for-processor)
  (selectq for-processor
    (:lambda
     (setup-common-symbols-1 lambda-symbols "LAM")
      )
    (:explorer
     (setup-common-symbols-1 raven-symbols "RAV")
     )
    (t (ferror nil "foo")))

  (cond ((fboundp 'fd-regadr)
	 (setq ramd (fd-regadr com-func-dest-md))
	 (setq ravma (fd-regadr com-func-dest-vma))
	 (setq rapp (fd-regadr com-func-dest-pdl-buffer-pointer))
	 (setq rapi (fd-regadr com-func-dest-pdl-buffer-index))))
  (setq current-processor-type for-processor)
  )

(defun setup-common-symbols-1 (symbols-list prefix)
  (do ((tail symbols-list (cddr tail))
       (prefix-length (string-length prefix)))
      ((null tail))
    (if (not (string-equal (string (car tail)) prefix :end1 prefix-length))
	(ferror nil "symbol ~S doesn't start with ~S" (car tail) prefix))
    (let ((common-sym (intern (string-append "COM"
					     (substring (string (car tail)) prefix-length))
			      (find-package "LAMBDA"))))	;really shouldnt matter, but.
      (putprop common-sym t 'special)
      (set common-sym (symeval (car tail)))
      )))


(declare (special lam-uinst-desc lam-uinst-desc-lambda lam-uinst-desc-explorer))

(defun lambda-mode ()
  (setup-common-symbols :lambda)
  (setq pdl-buffer-size-mask 3777)
  (if (boundp 'lam-uinst-desc-lambda)
      (setq LAM-UINST-DESC LAM-UINST-DESC-lambda))  ;may not be bound for UA-LAMBDA
  (setq lam-last-inst-had-halt-bit nil)  )  ;used only for explorer, avoid random printout.


(defun explorer-mode ()
  (setup-common-symbols :explorer)
  (setq pdl-buffer-size-mask 1777)
  (cond ((boundp 'lam-uinst-desc-explorer)
	 (setq LAM-UINST-DESC LAM-UINST-DESC-explorer)
	 ))
  )

(lambda-mode)
(explorer-mode)
