def pack_param(param: int, reg: bool = False, deref: bool = False) -> bytes:
    """Packs a single parameter into bytes."""
    signed = param < 0
    return (param | reg << 15 | deref << 14).to_bytes(2, byteorder="little", signed=signed)