| Index | Manual | Download | Source | Macros | Embedded word Case ins.
Sitemap | Links | Forum | Tests | Projects

# status16.htm
Macros
SetSt
RstSt
InvSt
JSt
JNSt

This file can be included to 16bit programs written in Euro Assembler. The library contains OS-independent macroinstructions for easy manipulation with the set of 1..16 boolean flags called Status. Status is usually declared as a static WORD in data segment, but macros will as well operate with status in stack variable, structure member or when loaded in register. Should 16 flags be not enough, you can declare more Status DWORDs with different names in your program.

Programmer should define a symbol for each flag and equate it with individual weight (power of 2).

Similar macros with identical names for different program width are defined in status32.htm

    status16 HEAD

SetSt Status, Flag
  Set the flag bit in Status WORD to 1.
Input
  Status is WORD [variable] or register.
  Flag is constant symbol with value equal to power of two. More than one flag may be set simultaneously, for instance `SetSt [BX],stFlag1 | stFlag2`.
Output
  Registers unchanged, CF=0.

    SetSt %MACRO Status, Flag
            OR %Status,%Flag, DATA=WORD
          %ENDMACRO SetSt

RstSt Status, Flag
  Reset the Flag bit in Status WORD to 0.
Input
  Status is WORD [variable] or register.
  Flag is constant symbol with value equal to power of two. More than one flag may be reset simultaneously.
Output
  Registers unchanged, CF=0.

    RstSt %MACRO Status, Flag
             AND %Status,~(%Flag), DATA=WORD,IMM=WORD
          %ENDMACRO RstSt

InvSt Status, Flag
  Invert the Flag bit in Status WORD.
Input
  Status is WORD [variable] or register.
  Flag is constant symbol with value equal to power of two. More than one flag may be inverted simultaneously.
Output
  Registers unchanged, CF=0.

    InvSt %MACRO Status, Flag
           XOR %Status,%Flag, DATA=WORD
         %ENDMACRO InvSt

JSt Status, Flag, Target
  Jump to the Target if the Status Flag bit is set to 1.
Input
  Status is WORD [variable] or register.
  Flag is constant symbol with value equal to power of two.
  When more than one ORed flags are specified, the jump is taken if at least one flag is set.
  Target is short or near code position (label) to be jumped to.
Output
  Registers unchanged, CF=0.

    JSt  %MACRO Status, Flag, Target
           TEST %Status,%Flag, DATA=WORD
           JNZ %Target
         %ENDMACRO JSt

JNSt Status, Flag, Target
  Jump to the Target if the Status Flag bit is reset to 0.
Input
  Status is WORD [variable] or register.
  Flag is constant symbol with value equal to power of two.
  When more than one ORed flags are specified, the jump is taken only if all flags are reset.
  Target is short or near code position (label) to be jumped to.
Output
  Registers unchanged, CF=0.

    JNSt %MACRO Status, Flag, Target
           TEST %Status,%Flag, DATA=WORD
           JZ %Target
         %ENDMACRO JNSt

     ENDHEAD status16

▲Back to the top▲