# HAL operand query

The unit at [hal/opq.fs] provides words to extract information from otherwise
opaque HAL operands.

## API

### Constants

REGW
REGA
REGS
REGPSP
REGRSP  Numerical constants corresponding to registers

(src  ( op -- reg )
  Yield source register. This yields an undefined result on an immediate op.

(dst  ( op -- reg )
  Yield destination register

src) ( op reg -- op )
  Set source register of operand. Everything else stays unchanged.

dst) ( op reg -- op )
  Set destination register of operand. Everything else stays unchanged.
  Don't use this with an invalid register such as REGPSP or REGRSP.

(W? ( op -- f )
  Yields whether "op"'s base register is W, regardless of its
  direct/displacement/invert flags. Because W is the top of stack, there's often
  special processing to do in that case.

(&? ( op -- f )
  Yields whether the "&)" flag is applied to op.

(sz ( op -- n )
  Yields "op" width in bytes, that is, 4, 2 or 1.

nb) ( halop sz -- halop )
  Apply 8b) to halop if sz is 1, 16b) if it's 2, nothing otherwise.

(i? ( op -- ?n f )
  Yields whether "op" is an immediate one. If it is, also yield the associated
  immediate number.

hslot ( op -- slot )
  Yields the HAL bank slot number encoded in the op.

.hal ( op -- )
  Print a human readable representation of specified op. Destination is on the
  left of the "<" or ">" (depending on "<>)") and the rest is the
  source+modifiers.
