## Display Device Driver Reference for OS/2

[prev][next][parent][TOC]

### .PMI Constructs and Library Functions

.PMI constructs are keywords that are used for program flow control in PMI command sections. There are three flow control constructs: WHILE loop, unconditional jump GOTO, and conditional IF GOTO label jump. The constructs can be nested. Label reference can only be forward; in other words, a label must have been encountered before its referring construct.

    WHILE <condition>       ;while loop condition is true, proceed
    ...                             ;else continue after ENDWHILE statement
    ...
    ...
    ENDWHILE

    GOTO <label>            ;jump to label

    IF <condition>  GOTO <label>     ;if condition true, jump to label

For example:

    if (r1 != 0x88) goto done

Two library functions facilitate string and binary compares: STRCMP and MEMCMP. These functions are especially useful in searching for signature sequences when identifying the adapter or comparing other string-literal names. STRCMP is used to compare a zero-ended character string (must be in double quotes) source with a destination specified as its physical address. MEMCMP is used to compare binary fields. The source string-literal for MEMCMP is assumed to be a string of 1s and 0s. If there is a need to search for a hexadecimal or another string, these must be converted to their binary form first. Byte alignment of both the source and target in the physical memory is assumed. Both functions return the result in r0: zero if the match was completely successful or nonzero otherwise. The length of the search is determined by the length of the source string.

String compares are performed after both source and target are converted to uppercase.

    STRCMP(<destination>, <source>};
    <destination>  ::= <address>        ;physical address
    <source>  ::= <string>)
    MEMCMP(<destination>, <source>};
    <source>  ::= <binary-string>
    <address> ::= <.PMI keyvariable> | <constant>

For example:

    MEMCMP (0xc0154,"1001001111010001"); //compare 2 bytes at 0xc0154 with 0x93d1