.xcsim

This statement causes XPE to be emitted and incorporated into the simulated code. This XPE code is run by the simultor whenever the program counter of the simulated code reaches it. It allows complex breakpoints to be setup. Traps for error conditions to be embedded within the code. Test data reading and result outputing.
e.g.
        .xcsim  if [{xfr_len}] == 3 then
        .breakpoint
        .xcsim  endif
        .print  [{xfr_len}]
There are two types of xcsim statement. These are grouped and sparse. The grouped type of statement may not be interleaved with machine code instructions. The sparce type of statement may be interleaved with machine code instructions.
e.g.    sparce

        movlw   10
        movwf   data_in
        .print  [{data_in}]
        incf    data_in
        .print  [{data_in}]

e.g.    grouped

        movlw   10
        movwf   data_in
        .xcsim  if [{data_in}] == 3 then
        .breakpoint
        .xcsim  endif
typically sparce instructions are used where execution of these instructions is determined by the machine code being simulated.
e.g.
        .open   "file1", "r"
        .open   "file2", "r"


lab1    .read   "file1", [{data_in}]
        movfw   data_in
        movwf   FSR
        .read   "file2", [{data_in}]
        movfw   data_in
        movwf   INDF
        tstf    INDF
        btfsc   STATUS,Z
        goto    lab1

        .close  "file1"
        .close  "file2"
grouped instructions describe sections of XPE code that must be executed by the simulator. These groups cannot selectively execute machine code outside of the normal control flow of the machine code program (it does not make sence to even attempt to try).

the following is not allowed and does not make sense.

        .xcsim  for j=0 while j<10 step j+=1 do
        incf    data_len
        .xcsim  done
neither does the following
        .xcsim  if [{data_len}] > 10 then
        clrf    data_len
        .xcsim  done