The “data” section of an assembler program can contain the definitions of probability variables. Every definition of a probability variable must be on a separate line. The line begins with a data label followed by at least one whitespace character, the ‘prob’ keyword, at least one whitespace character, and the initial value of a probability variable in the range 0 to 1 inclusive. The data label is the name of this probability variable. The assembler supports fixed-point and exponential notations for specifying the initial values of probability variables. The “data” section followed by the “code” section may look like this:
.data var_name_1 prob val1 var_name_2 prob val2 ... var_name_N prob valN .code
An assembler program can contain multiple ‘.data’ and ‘.code’ blocks, for example, within macros later expanded by the assembler preprocessor. The parser of an assembler program merges those blocks into a single “data” section and a single “code” section.
You can replace numeric probability values in
case instructions with the names of probability variables previously defined in the “data” section:
jprob var_name, loc_label
case var_name, loc_label
choice instruction block might look like this:
choice case var1, L1 case var2, L2 case 0.25, L3 case var1, L4 end choice
After parsing an assembler program, you can obtain the number of probability variables defined in the assembler program by the following function.
This function returns the number of probability variables defined in a program prg using ‘prob’ keywords. A returned value is always non-negative.
Use the following function to get the name of a probability variable by its index.
This function returns the name of a probability variable with index var_idx in a program prg.
If var_idx is negative or greater than or equal to the number of probability variables defined in the program using ‘prob’ keywords, the function returns
See Output Arrays, for how to define output probabilities arrays in an assembler program.