;========================================================================
;                        Menu definition
; Menu is a structure containing a menu text and all information needed
; to interpret characters, to select or deselect items and perform
; necessary actions.

                ; Menu header
MH$noitems =    0       ; No. of items
MH$entries =    2       ; Ptr to the first entry
MH$text =       4       ; Menu text starts here

                ; Format of a menu entry
                ; Its ptr is passed to the all procedures in r0
ME$char =       0       ; Char whose pressing selects the item
ME$type =       1       ; Item type
ME$loc  =       2       ; Location of the item  <col,row> or <col+256.*row>
ME$length =     4       ; Item length (byte)
                ; The meaning of the following depends on the item type
                        ; type = 0 - branch to the next menu
ME$menu =       6               ; Ptr to the menu
                        ; type = 1 - call the procedure on the item activation
ME$proc =       6               ; Ptr to the procedure
                        ; type = 2 - the item contains a window to display
                        ;            and to update the decimal value
ME$color =      5               ; Color to be set before the window editing
ME$value =      6               ; Ptr to the word containing a value
ME$wloc  =      10              ; Window location (col,row) or <col+256.*row>
                        ; type = 3 - the item needs the special initialization
ME$iproc =      6               ; Ptr to the initializing procedure
ME$aproc =      10              ; Ptr to the activation procedure

 .macro mentry  char,loc,type,varslot,color=,  ?mark       ; An menu entry
        .byte   char,type,loc
        .byte   <mark-.+4>              ; total entry length
        .if     b <color>
                  .byte   0
        .iff
                  .bktext ,<color>
        .endc
        .word   varslot                 ; variant slot
mark:                           ; End of the entry mark
 .endm

