home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / Basic / SDA30.ZIP / $FIELD.MAC < prev    next >
Encoding:
Text File  |  1983-03-07  |  3.4 KB  |  143 lines

  1.     .XLIST
  2. ;;
  3. ;;        ***********************************************
  4. ;;        *     Field Macros for use with SDA          *
  5. ;;        ***********************************************
  6. ;;
  7. ;;    These macros are for use with the Screen Design    Aid, and permit
  8. ;;    field manipulation.  Basically the user    may:
  9. ;;
  10. ;;        -  Input to a field (optionally    cleared    before input)
  11. ;;        -  Output to a field
  12. ;;        -  Output followed by input to a field
  13. ;;        -  Clear a field
  14. ;;        -  Position the    cursor to a field (start)
  15. ;;
  16. ;;    Under output conditions, the cursor is always left one character beyond
  17. ;;    the end    of the field.  If the string supplied for output to the    field
  18. ;;    is shorter than    the field, then    the field is cleared to    the
  19. ;;    end.  If the string is longer, output stops at the end of the
  20. ;;    defined    field.    The string is bounded by a "nul" byte at the end.
  21. ;;
  22. ;;    When a field is    "cleared" (any case), the field    is set to the
  23. ;;    attribute contained in the field definition table.
  24. ;;
  25. ;;    (This is an "internal" macro and should    not be directly    invoked)
  26. ;;
  27. $FDDEF    MACRO
  28.     IFNDEF    $SDA
  29.     EXTRN    $SDA:NEAR
  30.     ENDIF
  31.     ENDM
  32. ;;
  33. ;;    Output to a field    - P1 is    field number
  34. ;;                - P2 is    output string (terminated by a nul)
  35. ;;
  36. $FDOUT    MACRO    P1,P2
  37.     $FDDEF
  38.     IFNB    <P1>
  39.     MOV    AX,P1+100H
  40.     ELSE
  41.     MOV    AH,1
  42.     ENDIF
  43.     IFNB    <P2>
  44.     MOV    DX,OFFSET P2
  45.     ENDIF
  46.     CALL    $SDA
  47.     ENDM
  48. ;;
  49. ;;    Input from a field    - P1 = Field number
  50. ;;                - P2 = String buffer
  51. ;;                - P3 = Don't clear flag (Optional)
  52. ;;
  53. ;;        On entry, SI should point to the start of a string buffer.  This
  54. ;;        buffer must be as long as the input field plus one.  On    return
  55. ;;        the last byte (not included in the length) will    be a nul, and
  56. ;;        the length will    be contained in    the AL register    (0 is valid).
  57. ;;        AH will    contain    a code:    0 - CR at end, 1 - Tab right, 2    - tab
  58. ;;        left, 4    - escape, 8 - a    "scan code" is returned.  The carry is
  59. ;;        set for    all cases other    than "CR" (normal).  If    a scan code is
  60. ;;        returned, it will be a one byte    field, with the    80H bit    turned
  61. ;;        on, and    is the value returned by DOS, without the leading nul.
  62. ;;
  63. $FDINP    MACRO    P1,P2,P3
  64.     $FDDEF
  65.     IFNB    <P3>
  66. $SDAEQU    =    80H
  67.     ELSE
  68. $SDAEQU    =    0
  69.     ENDIF
  70.     IFNB    <P1>
  71.     MOV    AX,P1+200H+$SDAEQU
  72.     ELSE
  73.     MOV    AH,2
  74.     OR    AL,$SDAEQU
  75.     ENDIF
  76.     IFNB    <P2>
  77.     MOV    SI,OFFSET P2
  78.     ENDIF
  79.     CALL    $SDA
  80.     ENDM
  81. ;;
  82. ;;    Output to, and then input from the same    field.    In this    case, no
  83. ;;    option for clear before    input is permitted.  P1    = field    number,
  84. ;;    and P2 is the label of the string to be    output.     P3 is the label
  85. ;;    of an input buffer for the returned string.  See $FDOUT    and
  86. ;;    $FDINP for details of functioning.
  87. ;;
  88. $FDOIN    MACRO    P1,P2,P3
  89.     $FDDEF
  90.     IFNB    <P1>
  91.     MOV    AX,300H+P1
  92.     ENDIF
  93.     IFNB    <P2>
  94.     MOV    DX,OFFSET P2
  95.     ENDIF
  96.     IFNB    <P3>
  97.     MOV    SI,OFFSET P3
  98.     ENDIF
  99.     OR    AL,80H
  100.     CALL    $SDA
  101.     ENDM
  102. ;;
  103. ;;    Clear the specified field the the attribute in the field table.
  104. ;;    Cursor is left at the start of the field. P1=field number
  105. ;;
  106. $FDCLR    MACRO    P1
  107.     $FDDEF
  108.     IFNB    <P1>
  109.     MOV    AX,400H+P1
  110.     ELSE
  111.     MOV    AH,4
  112.     ENDIF
  113.     CALL    $SDA
  114.     ENDM
  115. ;;
  116. ;;    Position cursor    to the start of    the specified field. P1=field number
  117. ;;
  118. $FDPOS    MACRO    P1
  119.     $FDDEF
  120.     IFNB    <P1>
  121.     MOV    AX,500H+P1
  122.     ELSE
  123.     MOV    AH,5
  124.     ENDIF
  125.     CALL    $SDA
  126.     ENDM
  127. ;;
  128. ;;    Display    Primary    Menu - P1, if specified    is label of compressed
  129. ;;                   image, else offset to start of image
  130. ;;                   should be in    DX.
  131. ;;
  132. $FDISP    MACRO    P1
  133.     $FDDEF
  134.     IFNB    <P1>
  135.     MOV    DX,OFFSET P1
  136.     ENDIF
  137.     XOR    AH,AH
  138.     CALL    $SDA
  139.     ENDM
  140. ;;
  141.     .LIST
  142.     .SALL
  143.