(FILECREATED "19-Aug-85 11:14:06" {DSK}<DSK>HTHOMPSON>DSL>BUSEXTENDER.;3 5851   

      changes to:  (VARS BUSEXTENDERCOMS)

      previous date: "15-Aug-85 11:19:18" {DSK}<DSK>HTHOMPSON>DSL>BUSEXTENDER.;2)


(* Copyright (c) 1984, 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT BUSEXTENDERCOMS)

(RPAQQ BUSEXTENDERCOMS ((E (RESETSAVE CLISPIFYPRETTYFLG NIL))
			(FNS BX.INPUT BX.OUTPUT BX.READSTATUS)
			(* so that the macros will loadcomp from the compiled file)
			(DECLARE: DOCOPY (DECLARE: EVAL@LOAD EVAL@COMPILE (MACROS BX.INPUT BX.OUTPUT))
				  )
			(* to generate errors on non-1109s)
			(FNS \MISC1.UFN \MISC2.UFN)))
(DEFINEQ

(BX.INPUT
  [LAMBDA (ADDR)                                             (* ht: "15-May-85 19:48")

          (* * return the datum at the BX address = SUA.4-7,,fY.1)



          (* * ht put the expansion for \DEVICE.INPUT in by hand instead of defining a macro on the grounds that this way if 
	  the opcode ever changes only BUSMASTER/EXTENDER users are screwed, not random folk who happen to have compiled 
	  something which includes a \DEVICE.INPUT)


    ((OPCODES MISC1 1)
     (IPLUS (LLSH (LOGAND ADDR 30)
		  3)
	    (COND
	      ((EQ (LOGAND ADDR 1)
		   0)
		10)
	      (T 9])

(BX.OUTPUT
  [LAMBDA (DATUM ADDR)                                       (* ht: "15-May-85 19:48")

          (* * write the datum to the BX address = SUA.4-7,,fY.1)



          (* * ht put the expansion for \DEVICE.OUTPUT in by hand instead of defining a macro on the grounds that this way if 
	  the opcode ever changes only BUSMASTER/EXTENDER users are screwed, not random folk who happen to have compiled 
	  something which includes a \DEVICE.OUTPUT)


    ((OPCODES MISC2 2)
     DATUM
     (IPLUS (LLSH (LOGAND ADDR 30)
		  3)
	    (COND
	      ((EQ (LOGAND ADDR 1)
		   0)
		11)
	      (T 0])

(BX.READSTATUS
  [LAMBDA NIL                                                (* jmh " 8-Sep-84 15:50")

          (* * return FPI.0-3 -- get them from PPort -- have to enable them onto PPort first)


    (\DEVICE.OUTPUT 0 14)
    (LOGAND 15 (LRSH (\DEVICE.INPUT 7)
		     4])
)



(* so that the macros will loadcomp from the compiled file)

(DECLARE: DOCOPY 
(DECLARE: EVAL@LOAD EVAL@COMPILE 
(DECLARE: EVAL@COMPILE 

(PUTPROPS BX.INPUT DMACRO [ARGLIST (PROG (ADDRARG LISTOFADDRVAL ADDRVAL)
					 [* * The point of this macro is that almost all of the code 
					    of the function can be computed at compile time if the 
					    argument is known at compile time -- The function is --
					    (\DEVICE.INPUT (IPLUS (LLSH (LOGAND ADDR 30)
									3)
								  (if (ZEROP (LOGAND ADDR 1))
								      then 10 else 9]
					 (* * ht put the expansions for \DEVICE.INPUT in by hand 
					    instead of defining a macro on the grounds that this way 
					    if the opcode ever changes only BUSMASTER/EXTENDER users 
					    are screwed, not random folk who happen to have compiled 
					    something which includes a \DEVICE.INPUT)
					 (SETQ ADDRARG (CAR ARGLIST))
					 (RETURN (COND [[AND (SETQ LISTOFADDRVAL (CONSTANTEXPRESSIONP
								     ADDRARG))
							     (SMALLP (SETQ ADDRVAL (CAR LISTOFADDRVAL]
							(BQUOTE ((OPCODES MISC1 1)
								 ,
								 (IPLUS (LLSH (LOGAND ADDRARG 30)
									      3)
									(COND ((ZEROP (LOGAND ADDRARG 
											      1))
									       10)
									      (T 9]
						       (T (BQUOTE ((OPCODES MISC1 1)
								   (IPLUS (LLSH (LOGAND , ADDRARG 30)
										3)
									  (COND ((ZEROP (LOGAND
											  , ADDRARG 1)
											)
										 10)
										(T 9])

(PUTPROPS BX.OUTPUT DMACRO [ARGLIST (PROG (DATUMARG ADDRARG LISTOFADDRVAL ADDRVAL)
					  [* * The point of this macro is that almost all of the code 
					     of the function can be computed at compile time if the 
					     argument is known at compile time -- The function is --
					     (\DEVICE.OUTPUT DATUM
							     (IPLUS (LLSH (LOGAND ADDR 30)
									  3)
								    (if (ZEROP (LOGAND ADDR 1))
									then 11 else 0]
					  (* * ht put the expansions for \DEVICE.OUTPUT in by hand 
					     instead of defining a macro on the grounds that this way 
					     if the opcode ever changes only BUSMASTER/EXTENDER users 
					     are screwed, not random folk who happen to have compiled 
					     something which includes a \DEVICE.OUTPUT)
					  (SETQ DATUMARG (CAR ARGLIST))
					  (SETQ ADDRARG (CADR ARGLIST))
					  (RETURN (COND
						    [[AND (SETQ LISTOFADDRVAL (CONSTANTEXPRESSIONP
								  ADDRARG))
							  (SMALLP (SETQ ADDRVAL (CAR LISTOFADDRVAL]
						     (BQUOTE ((OPCODES MISC2 2)
							      , DATUMARG ,
							      (IPLUS (LLSH (LOGAND ADDRARG 30)
									   3)
								     (COND ((ZEROP (LOGAND ADDRARG 1))
									    11)
									   (T 0]
						    (T (BQUOTE ((OPCODES MISC2 2)
								, DATUMARG
								(IPLUS (LLSH (LOGAND , ADDRARG 30)
									     3)
								       (COND ((ZEROP (LOGAND , 
											  ADDRARG 1))
									      11)
									     (T 0])
)
)
)



(* to generate errors on non-1109s)

(DEFINEQ

(\MISC1.UFN
  [LAMBDA (ARG ALPHA)                                        (* ht: "26-May-85 17:20")
    (COND
      ((EQ ALPHA 1)
	(ERROR "Attempt to access bus extender option on a machine which does not support it"))
      (T (RAID "Unimplemented MISC1 op" ALPHA])

(\MISC2.UFN
  [LAMBDA (ARG0 ARG1 ALPHA)                                  (* ht: "26-May-85 17:22")
    (COND
      ((EQ ALPHA 2)
	(ERROR "Attempt to access bus extender option on a machine which does not support it"))
      (T (RAID "Unimplemented MISC2 op" ALPHA])
)
(PUTPROPS BUSEXTENDER COPYRIGHT ("Xerox Corporation" 1984 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (655 2240 (BX.INPUT 665 . 1300) (BX.OUTPUT 1302 . 1950) (BX.READSTATUS 1952 . 2238)) (
5168 5764 (\MISC1.UFN 5178 . 5471) (\MISC2.UFN 5473 . 5762)))))
STOP