Ladder with counter CTU and initialization in ST, several runs

This test case it part of the test suite proposed for new devices.

Test case ID: R0260
Language: ST,LD

Code:
tests2/t0260a.st
(* t0260a.st  - warning:  this should run before the graphical program *)
PROGRAM A_T0256
    VAR_GLOBAL
        RES  : BOOL := FALSE;
        Z : INT;
        R1 : BOOL;
        A : BOOL := FALSE;
    END_VAR

    VAR
        cycle_prev : INT := 0;
    END_VAR
    VAR_EXTERNAL 
        _T_PARAMS : TEST_PARAMS;
    END_VAR
    
    cycle_prev := _T_PARAMS.cycle-1;
    IF cycle_prev > 0 THEN
(*     _GEB_MSG_('values after cycle (cycle, A,Z,R1)');
      _GEB_MSG_(INT_TO_STRING(cycle_prev));
      _GEB_MSG_(BOOL_TO_STRING(A));
      _GEB_MSG_(INT_TO_STRING(Z));
      _GEB_MSG_(BOOL_TO_STRING(R1));
*)
       _GEB_ASSERT_(A = MOD_INT(cycle_prev,2));
       _GEB_ASSERT_(R1 = (cycle_prev=8));
       IF cycle_prev <9 THEN
       _GEB_ASSERT_(Z = cycle_prev/2);
       ELSE
      _GEB_ASSERT_(Z =MOD(((cycle_prev -8)/2),2));
       END_IF;
   
    END_IF;
    
     IF ( _T_PARAMS.cycle = 12 ) THEN      RES := TRUE;
    ELSE       RES := FALSE;    END_IF; 

END_PROGRAM

(* Values AFTER both executions (st + fbd) of cycle n :
n     1    2    3    4    5    6    7    8    9    10   11    12   13   14   15     
A     1    0    1    0    1    0    1    0    1    0     1    0    1    0    1
CV=Z  0    1    1    2    2    3    3    4    0    1     1    0    0    1    1
R1    0    0    0    0    0    0    0    1    0    0     0    0    0    0    0
RES   0    0    0    0    0    0    0    0    0    0     0    1    0    0    0  *)
tests2/t0260b.fbd
    <vars name="A" datatype="BOOL" type="EXTERNAL"/>
    <vars name="PEAK" datatype="INT" init="4"/>
    <vars name="R1" datatype="BOOL" type="EXTERNAL"/>
    <vars name="RES" datatype="BOOL" type="EXTERNAL"/>
    <vars name="Z" datatype="INT" type="EXTERNAL"/>
    <vars name="X" datatype="INT" type="TEMP"/>
 (* graphical code omitted in this listing *)