(FILECREATED "21-Jun-86 15:35:44" {ERIS}<TAMARIN>UCODE>OCTALATOR.;3 7341Q  

      changes to:  (FNS TDUMP TFINDOP)

      previous date: " 2-Jun-86 19:47:34" {ERIS}<TAMARIN>UCODE>OCTALATOR.;2)


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT OCTALATORCOMS)

(RPAQQ OCTALATORCOMS ((* * print out a number in a radix)
			(FNS DEC HEX OCT)
			(* * convert byte pointers <-> addresses)
			(FNS BP BO)
			(* * hex dump of tam memory)
			(FNS TDUMP HEXAT)
			(* * misc)
			(FNS TFINDOP)))
(* * print out a number in a radix)

(DEFINEQ

(DEC
  [LAMBDA (N)                                                (* jmh "22-May-86 10:02")
    (printout T .I0.10 N T)
    N])

(HEX
  [LAMBDA (N)                                                (* jmh "21-May-86 18:29")
    (printout T "|x" .I0.16 N T)
    N])

(OCT
  [LAMBDA (N)                                                (* jmh "28-May-86 11:25")
    (printout T .I0.8 N "q" T])
)
(* * convert byte pointers <-> addresses)

(DEFINEQ

(BP
  [LAMBDA (A B)                                              (* jmh " 2-Jun-86 16:25")

          (* * Byte Ptr -- if B is supplied -- A is a word address, B is a byte offset, print byte ptr = word addr *4 + byte 
	  offset in hex and return it -- if B is missing, A is a byte pointer, print the word addr and the byte # in hex and 
	  return a list of them)


    (LET (wordAddr byteNr bytePtr)
         (if B
	     then (SETQ wordAddr A)
		    (SETQ byteNr B)
		    (if (OR (NOT (NUMBERP wordAddr))
				(MINUSP wordAddr)
				(NOT (NUMBERP byteNr)))
			then (HELP "bad args" (LIST wordAddr byteNr)))
		    (SETQ bytePtr (PLUS (UNFOLD wordAddr BYTESPERCELL)
					    byteNr))
		    (printout T "|x" .I0.16 bytePtr T)
		    bytePtr
	   else (SETQ bytePtr A)
		  (if (OR (NOT (NUMBERP bytePtr))
			      (MINUSP bytePtr))
		      then (HELP "bad arg" bytePtr))
		  (SETQ wordAddr (FOLDLO bytePtr BYTESPERCELL))
		  (SETQ byteNr (IDIFFERENCE bytePtr (UNFOLD wordAddr BYTESPERCELL)))
		  (printout T "|x" .I0.16 wordAddr " byte " byteNr T)
		  (LIST wordAddr byteNr])

(BO
  [LAMBDA (baseAddr absBytePtr)                              (* jmh "22-May-86 11:02")

          (* * Byte Offset -- print in octal and return the byte number of the byte pointed to by absBytePtr in the tcodep 
	  whose address is baseAddr)


    (if (OR (NOT (NUMBERP baseAddr))
		(MINUSP baseAddr)
		(NOT (NUMBERP absBytePtr))
		(MINUSP absBytePtr))
	then (HELP "bad args" (LIST baseAddr absBytePtr)))
    (LET [(byteOffset (DIFFERENCE absBytePtr (UNFOLD baseAddr BYTESPERCELL]
         (printout T .I0.8 byteOffset "q" T)
     byteOffset])
)
(* * hex dump of tam memory)

(DEFINEQ

(TDUMP
  [LAMBDA (ADDR NW)                                          (* jmh "29-May-86 14:33")
    (for I from ADDR to (PLUS ADDR (SUB1 (OR NW 14Q))) do (HEXAT I])

(HEXAT
  [LAMBDA (ADDR)                                             (* jmh " 2-Jun-86 18:49")
    (LET ((VAL (MemoryAccess ADDR NIL T)))
         (if (ZEROP VAL)
	     then (printout T "|x0" T)
	   else (printout T "|x" .I4.16.T (LRSH VAL 16)
			    .I4.16.T
			    (LOGAND VAL (MASK.1'S 0 16))
			    T))
     VAL])
)
(* * misc)

(DEFINEQ

(TFINDOP
  [LAMBDA (OP)                                               (* jmh "29-May-86 14:26")
    (if (NUMBERP OP)
	then (ELT \TAMOPCODEARRAY OP)
      else (GETPROP OP (QUOTE TOPCODE])
)
(PUTPROPS OCTALATOR COPYRIGHT ("Xerox Corporation" 3702Q))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1074Q 1742Q (DEC 1106Q . 1315Q) (HEX 1317Q . 1533Q) (OCT 1535Q . 1740Q)) (2023Q 5467Q (
BP 2035Q . 4320Q) (BO 4322Q . 5465Q)) (5533Q 6623Q (TDUMP 5545Q . 6057Q) (HEXAT 6061Q . 6621Q)) (6645Q
 7220Q (TFINDOP 6657Q . 7216Q)))))
STOP