1 HEX
HEX (the Hex File Editor) can be invoked in two ways:

Interactive mode:
  >HEX              Type HEX in response to the CLI prompt.
  HEX>command       Command lines may be entered.
  HEX>command
  HEX>^Z            Control-Z terminates HEX.

Indirect command mode:
  >HEX @filespec    where filespec is the file specification of an indirect
                    command file containing a list of HEX commands.
2 SYNTAX
The following general notes apply to HEX command descriptions:

 1.  aaaa, bbbb, and sequential  uses  of  early  letters  of  the  alphabet
     indicate  a  4, 6, or 8-digit hex number, depending on the current mode
     (16, 24, or  32-bit,  respectively).   All  digits  (including  leading
     zeros) must be specified.

 2.  vvvv, wwww, xxxx, or similar indicate a hex number of exactly the  same
     number  of  digits as there are characters (e.g.  vv is a 2-digit byte,
     xxxxxx is a 6-digit 24-bit address).

 3.  pp indicates a byte value which may be entered either as a 2-digit  hex
     number,  or  a  character  specification  in one of the following forms
     (where c indicates a printing character):-

          ^c    control codes, 00-1F, shown as ^@, ^A, ^B, ... ^_
          'c    printing characters, codes 20-7E, with parity bit set --
                     'space to '~. (Some control codes are also accepted.)
          ^#    the parity-clear delete character, code 7F
          ~c    control codes with parity bit set -- 80-9F, ~@ ... ~_
          -c    printing characters with parity bit set, --
                     codes A0-FE, - , -!, ... -~
          ~#    the parity-set delete character, code FF

 4.  qqqq indicates a 16-bit value which may be entered either as a  4-digit
     hex  number,  or a double-quote followed by two ASCII characters.  Thus
     "ab and 4142 have the same effect, since the hex codes for characters a
     and  b  are  41  and  42  respectively.   Only  parity-clear, printing,
     characters may be entered in this format.

 5.  nnnnnnnn or mmmmmmmm indicates a 1-8 character program name.

 6.  **** represents an entity which may either be a four-digit address or a
     pseudo-register, written as %xx.

 7.  Uppercase words are required keywords.

 8.  Structures in braces ({...}) show an optional  parameter.   The  braces
     are not part of the syntax.

 9.  All  numbers (unless  stated  otherwise) and  all  input/output  of the
     HEX utility are hexadecimal.
2 RANGE
Range specifications used by many commands take the form:

	{ ODD/EVEN } FROM aaaa/LOW THRU bbbb/HIGH { STEP ss }
						{ PLUS/MINUS cccc }

where aaaa and bbbb are the (inclusive) addresses for the operation. If
ss is omitted, every byte in that range is included (i.e. the default ss
is 01), otherwise only every ss'th address, starting at aaaa and <= bbbb,
is used.

ODD or EVEN force aaaa to the appropriate boundary and default ss to 02.

PLUS and MINUS add or subtract the given value from addresses read from or
written to the file. Only available with READ, COMPARE, WRITE, and APPEND.

aaaa may be replaced by LOW, which takes the value of the lowest address
met in the last READ or COMPARE, and similarly, bbbb may be replaced by
HIGH.
2 COMMANDS_LIST
The following hex commands are available:

AND			 APPEND		 COMPARE	 COMPLEMENT
COPY		 CRC		 CSUM		 DECREMENT
DISPLAY		 DIVIDE		 ECHO		 EDIT
EXIT		 FILL		 FORMAT		 HELP
IDENT		 INCREMENT	 INIT		 MOVE
MULTIPLY	 NAME		 NEGATE		 NOECHO
OFFSET		 OR		 READ		 REMAINDER
REVERSE		 ROTATE		 SEARCH		 SHIFT
SUM		 TRANSFER	 USE		 WRITE
XOR		 .(CLI command)	 ?(Help)	 ctrl/Z(Exit)
2 .
	. { CLI command }

sends the rest of the line after the . keyword to the current command
line interpreter (DCL or MCR). Control returns to HEX after the command is
executed. This enables a system command (e.g. an assembly) to be issued
without losing the contents of HEX's buffer and any edits made.
2 AND
	AND { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } WITH pp

logically AND's pp with every byte in the range.
2 APPEND
 	APPEND { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }
             { PLUS/MINUS cccc } { PARTIAL } { WIDTH vv/vvvv } FILE filespec

extends an object file defining locations aaaa to bbbb.

If given, vv determines the maximum number of bytes output per line, by 
causing a new record to be started at addresses which are exact multiples of
vv, e.g. if vv=10, records start at addresses aa00, aa10, aa20 ..., and the
maximum length is thus 16. bytes.

For PROM programmer formats (HEX and OCTAL) vvvv is a 4-digit PROM size. The
STEP range argument may be used to generate hi and lo byte PROM files.

The current program name will be included in the object file if the current
object format provides for this. A trailer record containing the transfer
address (if any) will be written unless suppressed by PARTIAL.
2 COMPARE
	COMPARE {{ ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }}
		{ PLUS/MINUS cccc } { PARTIAL } FILE filespec

where filespec is a file specification of an object file. (See FORMAT for
default filetype).

The code defined by the file will be compared with memory (which is not 
changed).

Optionally, limits may be placed on the portion of the input file to be used
to define virtual memory. If so specified, only code defining addresses from
aaaa to bbbb will be placed in virtual memory. ss, if given, specifies that
consecutive input bytes go into every ss'th location in memory -- used when
file so output by WRITE.

The transfer address and name (if given) update the current ones.

PARTIAL says that a trailer record should not be expected (or allowed).
2 COMPLEMENT
	COMPLEMENT { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }

Sets every ss'th location from aaaa to bbbb to its 1's
complement, i.e. every bit is inverted.
2 COPY
	COPY { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } TO cccc
							{ REPEAT vvvv }

copies the values contained in every ss'th location from aaaa to bbbb to
sequential locations starting at cccc. The copy does not affect the source
area unless it is overlapped by the target area.

If the REPEAT option is given, vvvv contiguous copies of the source are
made.
2 CRC
	CRC FROM aaaa THRU bbbb { STEP ss }{ TO **** }

Calculates and displays the standard bisync CRC of every ss'th byte from 
aaaa to bbbb, using a preset of 0000. If a TO address (or pseudo-register)
is specified, the result is stored there in high-low order.
2 CSUM
	CSUM { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }

calculates and displays a 16-bit byte-wise summation of ss'th locations from
aaaa to bbbb, and writes a a SAL assembler-type CSUM block is at bbbb+1, in
form:
	bbbb+1 = aaaa lo	bbbb+2 = aaaa hi
	bbbb+3 =  sum lo	bbbb+4 =  sum hi
2 DECREMENT
	DECREMENT { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } { BY pp }

Subtracts pp (default 1) to every ss'th byte from aaaa to bbbb.
2 DISPLAY
	DISPLAY { ASCII } FROM aaaa THRU bbbb { STEP ss }{ FILE filespec }

displays every ss'th byte from aaaa to bbbb, on the terminal (or, if
specified, in a file which is then spooled to the printer). If ss is
(default) 01, aaaa to bbbb are rounded to aaa0 to bbbF.

Format is 2-digit hex bytes, unless the ASCII keyword is included. In ASCII
displays, non-printing characters are shown as equivalent letters prefixed 
by:
        ^       control codes, 00-37, thus ^C is ctrl/C, hex 03,
        ~       control codes with parity bit set -- 80-9F,
        -       printing characters with parity bit set, A0-FE,
plus:   ^#      shows the parity-clear delete character, code 7F
        ##      shows the parity-set delete character, code FF
2 DIVIDE
	DIVIDE { SIGNED } { ODD/EVEN } FROM aaaa THRU bbbb 
					{ STEP ss } BY pp

divides every ss'th byte from aaaa to bbbb by pp, and replaces
it with the quotient,

Source and pp are considered unsigned unless the SIGNED option is given.
2 ECHO
	ECHO

re-enables echoing of commands read from a file.
2 EDIT
	EDIT aaaa { STEP ss }

initiates an interactive session which allows you to examine and optionally
replace the contents of virtual memory starting at location aaaa. The
following display appears:

	aaaa vv=cc-

where aaaa is the current address being edited, vv is its contents in hex,
and c is the ASCII character, shown as in DISPLAY. Reply with:-

   vv<CR>   to replace the contents of the location being edited and bring
            up the next ss'th location for editing.

   <CR>     to leave the location as it is and open the next ss'th location.

   vv^<CR>  to replace the contents of the location being edited and open
            the previous ss'th location.

   ^<CR>    to leave the location as it is and open the previous ss'th
            location.

vv's may be 2-digit hex values, or ' followed by character whose ASCII code
is to be inserted (parity clear).
2 EXIT
	EXIT

causes an exit from HEX, and return to the operating system or calling task.
Intended for use in a command file -- control/Z has the same effect at a
terminal.
2 FILL
	FILL { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } WITH pp

Every { ss'th } location from aaaa to bbbb is filled with byte value pp.
2 FORMAT
	FORMAT { type {char}}

Displays or specifies the object file format and sets READ/WRITE defaults:
		       default	 max
	   type		WIDTH	WIDTH	filetype
	-----------    -------	------	--------
	INTEL		  32	  250	.HEX
	MOTOROLA	  32	  252	.HEX
	ROCKWELL	  32	  252	.HEX
	RCA		  32	  169	.HEX
	TEKHEX		  32	  250	.HEX	Tektronix emulator
	EXTENDED {TEKHEX} 32	  250	.HEX	ditto
	TEXAS		  32	  200	.OBJ	TI99xx family
	MOSTEK		  32	  250	.HEX
	WHITESMITHS	   1	    1	none	XEQ. file format
	RIM		  64	  254	.RIM	PDP-8/IM6100 Read-in-Mode
	BIN		 128	  254	.BIN	PDP-8/IM6100 binary mode
	HEX {char}	1024	16384	.PRM	Data I/O hex-char
	OCTAL {char}	1024	16384	.PRM	Data I/O octal-char
	TCI		  32	  263	.HEX
	SIRA		  64	  505	.LDA	Sira binary
	OBJECT		  64	  510	.OBJ	MACRO ABS object
	ABSOLUTE	  64	  505	.LDA	PDP-11 paper tape loader
	TASK		 512	  512	.SYS	TKB output
2 IDENT
	IDENT

Displays HEX's current version number (last revision date).
2 INCREMENT
	INCREMENT { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } { BY pp }

Adds pp ( default 1) to every ss'th byte from aaaa to bbbb.
2 INIT
	INIT WITH { pp }

This command resets HEX to its initial conditions. Virtual memory is set to
value pp (default FF), the transfer address values is set to 0000, program
name to null.
2 MOVE
        MOVE BYTE FROM **** TO ****
or      MOVE WORD FROM **** TO ****

where ****'s represent either a four-digit hex number valid under the
current offset, or a pseudo-register specification.

MOVE is a variation of the COPY command. It is limited to a one byte or one
word transfer, but can access the pseudo-register set. Like COPY, MOVE has
no affect on the source area. A word moves copies the entire word at one
time, rather than bytewise as in copy.
2 MULTIPLY
	MULTIPLY { SIGNED } { ODD/EVEN } FROM aaaa THRU bbbb 
					{ STEP ss } BY pp

Multiplies every byte in the range by pp,

Source and pp are considered unsigned unless the SIGNED option is given.
2 NAME
	NAME { nnnnnnnn }

If nnnnnnnn is given, this becomes the new 1-8 character program name.
If nnnnnnnn is omitted, the current name (if any) is displayed.
2 NEGATE
	NEGATE { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }

sets evey byte to its two's complement (negative).
2 NOECHO
	NOECHO

suppresses echoing of commands (including itself) and READ/WRITE statistics
reports when running from a command file. Has no effect when commands are
being taken from the terminal, or on error messages or SEARCH etc. reports.
The default is to echo all commands except comments starting with ;.
2 OFFSET
	OFFSET { aaaa }

If aaaa is specified, that value becomes the new offset. The offset should
be chosen so that the addresses to be handled will be offset internally to
within 0000 to 7FFF.

After the offset is given, the offsetting of addresses internally is totally
transparent to the user, i.e. the user specifies (and sees) actual addresses

The offset may be 4, 6, or 8 digits to specify 16, 24, or 32-bit mode.

If aaaa is omitted, the current offset is displayed.
2 OR
	OR { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } WITH pp

logically inclusive OR's pp with every byte in the range.
2 READ
	COMPARE/READ {{ ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }}
		{ PLUS/MINUS cccc } { PARTIAL } FILE filespec

where filespec is a file specification of an object file. (See FORMAT for
default filetype).

For READ, the code defined by the file will be placed in its proper location
in virtual memory. Unspecified locations are not affected.

Optionally, limits may be placed on the portion of the input file to be used
to define virtual memory. If so specified, only code defining addresses from
aaaa to bbbb will be placed in virtual memory. ss, if given, specifies that
consecutive input bytes go into every ss'th location in memory -- used when
file so output by WRITE.

The transfer address and name (if given) update the current ones.

PARTIAL says that a trailer record should not be expected (or allowed).
2 REVERSE
	REVERSE { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }

reverses in place the values contained in every ss'th location from aaaa to
bbbb i.e. aaaa is exchanged with bbbb, aaaa+ss with bbbb+ss etc..
2 REMAINDER
	REMAINDER { SIGNED } { ODD/EVEN } FROM aaaa THRU bbbb 
					On { STEP ss } BY pp

Sets every byte in the range to the remainder (modulus) on
dividing it by pp.

Source and pp are considered unsigned unless the SIGNED option is given.
2 ROTATE
	ROTATE LEFT/RIGHT { ODD/EVEN } FROM aaaa THRU bbbb 
					{ STEP ss } { BY pp }

Internally rotates each ss'th byte from aaaa to bbbb left or right by pp
bits.  The default value of pp is 1.

For LEFT rotates, bit 7 goes into bit 0; for RIGHT rotates, bit 0 goes into
bit 7.
2 SEARCH
	SEARCH FROM aaaa THRU bbbb { STEP ss } FOR { NOT } pp/qqqq

searches the specified range of virtual memory for bytes or words which
match (or do not match) the value given. The addresses containing the value
are displayed. In the case of a word value, the search is for that value in
lo-hi order.

pp is a 2-digit hex byte, or 'char, ^char, -char, ~char, or ##.
eqqqq is a 4-digit hex word or "charchar.
2 SHIFT
	SHIFT LEFT/RIGHT { SIGNED }
		{ ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } { BY pp }
 
Shifts each ss'th byte from aaaa to bbbb left or right by pp bits.
The default value of pp is 1.

For a LEFT shift, zeroes are moved into the lo bits.

For a RIGHT shift, zeroes are moved into the high bits unless the SIGNED
option is given, when the sign bit is replicated.
2 SUM
	SUM { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } { TO **** }

calculates and displays on the terminal a 16-bit byte-wise summation of 
ss'th locations from aaaa to bbbb, optionally storing the result at address
or pseudo-register ****.
2 TRANSFER
	TRANSFER { aaaa }

If aaaa is given, this becomes the new transfer address.
If aaaa is omitted, the current one (or 0 if none) is displayed.
2 USE
	USE aa OF bb FOR READ

This command sets up HEX to handle files in which the basic addressable unit
is wider than eight bits. The command instructs READ to input only one 8-bit
section of the addressable unit at each location. Thus the USE command 
allows these files to be split into partitions suitable for loading
into 8-bit proms.

bb represents the number of 8-bit groups that make up each addressable unit
(the width of the addressable unit must be a multiple of eight bits). aa
specifies which of the bb bit groups is to be input as the value of
a location.
2 WRITE
       WRITE { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss }
           { PLUS/MINUS cccc } { PARTIAL } { WIDTH vv/vvvv } FILE filespec

creates an object file defining locations aaaa to bbbb.

If given, vv determines the maximum number of bytes output per line, by
causing a new record to be started at addresses which are exact multiples of
vv, e.g. if vv=10, records start at addresses aa00, aa10, aa20 ..., and the
maximum length is thus 16. bytes.

For PROM programmer formats (HEX and OCTAL) vvvv is a 4-digit PROM size. The
STEP range argument may be used to generate hi and lo byte PROM files.

The current program name will be included in the object file if the current
object format provides for this. A trailer record containing the transfer
address (if any) will be written unless suppressed by PARTIAL.
2 XOR
	XOR { ODD/EVEN } FROM aaaa THRU bbbb { STEP ss } WITH pp

Logically exclusive OR's pp with every byte in the range.
