home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / asmlib37.zip / INPUT.DOC < prev    next >
Text File  |  1993-04-26  |  27KB  |  738 lines

  1.  
  2. ********************************  INPUT  ************************************
  3.  
  4. ASMLIB Input subroutines Copyright (C) 1991 - 1993 Douglas Herr
  5. all rights reserved
  6.  
  7. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  8.  
  9. A$EDIT:      editor module used by TEdit and GEdit.
  10.              Must be called by GEdit or TEdit
  11. Source:      a$edit.asm (getkey.asm, isdigit.asm, toupper.asm, tolower.asm)
  12.  
  13.              TEdit and GEdit edit a string on a single row of the screen
  14.              (without word wrap).  Strings longer than the column width of
  15.              the screen are scrolled left or right as required.  A public
  16.              byte in A$EDIT's data area, EWIDTH, establishes the effective
  17.              screen width limit.  EWIDTH is a not-to-exceed limit; if the
  18.              actual screen width is less than EWIDTH, EWIDTH is ignored
  19.              and the actual screen width is used instead.  ASMLIB's default
  20.              EWIDTH is 132.
  21.  
  22.              A$EDIT commands for both TEdit and GEdit are:
  23.  
  24.              Ctrl+left arrow = word left
  25.              Ctrl+right arrow = word right
  26.              Ctrl+end = clear to end of string
  27.              Home = go to start of string
  28.              End = go to end of string
  29.  
  30.  
  31.              Option bits, passed to GEdit or TEdit in register AL, are:
  32.  
  33.              Option 1 = upper case input
  34.              Option 2 = lower case input
  35.              Option 1 OR 2 = digits only input
  36.  
  37. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  38.  
  39. CLEARKEY:    clears the keyboard's 'type-ahead' buffer
  40.              Uses BIOS functions to remove all keys in the buffer.
  41. Source:      clearkey.asm
  42.  
  43. Call with:   no parameters
  44. Returns:     nothing
  45. Uses:        nothing
  46. Supports:    standard and enhanced keyboards
  47. Example:     call   clearkey
  48.  
  49.  
  50.  
  51. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  52.  
  53. GEDIT:       string editor for graphics modes
  54.              See also TEdit for text modes, A$EDIT for general information
  55. Source:      gedit.asm (a$edit.asm, gprint.asm, a$graph.asm, gcursor.asm,
  56.                         strspace.asm, heap.asm)
  57.  
  58. Call with:   DS:[SI] pointing to string buffer; may include a default string
  59.              DS:[DX] pointing to x- & y-coordinates
  60.              assumes DS:@data
  61.              CX = byte size of buffer
  62.              AL = option bits (see A$EDIT)
  63.              You must initialize the near heap before calling GEdit.
  64.              GEdit only works with DrawMode 1 or -1 (see DrawMode in
  65.              GRAPHICS.DOC).  GEdit forces drawmode to 1 or -1 and restores
  66.              the previous drawmode on exit.
  67. Returns:     AX = last key pressed (see getkey for key codes)
  68.              CX = new string length
  69. Uses:        AX, CX, flags
  70. Supports:    all ASMLIB graphics modes
  71. Example:
  72.  
  73. .data
  74. x       dw 8                      ; x-coordinate (pixels from left edge)
  75. y       dw 100                    ; y-coordinate (pixels from top of screen)
  76. extrn   ewidth:byte               ; byte in A$EDIT used to limit columns
  77.                                   ; displayed
  78. .code
  79. ; program fragment assumes DS:@data
  80.         .
  81.         .
  82.         .
  83.         mov   ewidth,40           ; there's stuff on the right side of
  84.                                   ; the screen that should be left alone
  85.  
  86.         lea   si,string_buffer    ; near address of string buffer
  87.         mov   cx,len_buffer       ; byte length of buffer for the string
  88.         mov   al,0                ; nothing tricky
  89.         lea   dx,x                ; point to x & y coordinates
  90.                                   ; see GPrint for explanation of x and y
  91.         call  gedit
  92.  
  93.  
  94.  
  95. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  96.  
  97. GETKEY:      returns next key pressed
  98. Source:      getkey.asm
  99.  
  100. Call with:   no parameters
  101. Returns:     AL = ASCII key code
  102.              AH = 0 if normal key
  103.              AH = 1 if extended key code (such as function keys)
  104. Uses:        AX
  105.              Uses BIOS functions; supports enhanced keyboard if present
  106. Supports:    standard and enhanced keyboards
  107. Example:     call  getkey
  108.              shr   ah,1            ; a function key?
  109.              jc    function_key    ; jump if so
  110.  
  111.  
  112.  
  113. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  114.  
  115. GPICKF:      pick a file from a list of filenames
  116.              GPickF pops a window on the screen and displays filenames
  117.              matching an input filespec mask.  One filename may be selected
  118.              with cursor keys or with hotkeys.  When Esc, Enter or ^C is
  119.              pressed, GPickF restores the screen and returns the selected
  120.              filename to the calling program.
  121.              Unused memory must be released by STARTUP (see STARTUP.ASM or
  122.              TINY.ASM).  Also requires near heap (see HINIT).
  123.              See also MenuOption.
  124. Source:      gpickf.asm (filelist.asm, $gpick.asm, a$menu.asm, $graph.asm)
  125.  
  126. Call with:   DS:[SI] pointing to filespec mask
  127.              BX = initial selection (0 = first filename)
  128.              CX = file attribute mask
  129.              DS:[DX] pointing to upper left corner of menu box
  130.              assumes DS:DGROUP
  131. Returns:     AX = last key pressed
  132.              ES:[BX] points to filename selected
  133.              CX = maximum length of filename
  134. Uses:        AX, BX, CX, ES
  135. Supports:    all ASMLIB graphics modes
  136. Example:     see PICKF
  137.  
  138. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  139.  
  140. GPICKSTR:    pick a string from a list of ASCIIZ strings
  141. Source:      gpickstr.asm ($gpick.asm, $strlist.asm, a$menu.asm, $graph.asm)
  142.  
  143. Call with:   DS:[SI] pointing to list of ASCIIZ strings
  144.              BX = initial cursor position
  145.              DS:[DX] pointing to (x,y) coordinates of upper left corner
  146.                of selection box
  147.  
  148.              GPickStr pops a window on the screen and displays the list
  149.              of strings.  One string may be selected with cursor keys
  150.              or with hotkeys.  When Esc, Enter or ^C is pressed, GPickStr
  151.              restores the screen and returns a string index number.
  152.              Unused memory must be released by STARTUP (see STARTUP.ASM and
  153.              TINY.ASM), and the near heap must be initialized (see HINIT).
  154.              See also MenuOption.  Maximum number of choices: 255
  155.  
  156. Returns:     AX = last key pressed
  157.              BX = string number selected (first string = 0)
  158. Uses:        AX, BX
  159. Supports:    all ASMLIB graphics modes
  160. Example:     see PICKSTR
  161.  
  162.  
  163. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  164.  
  165. ISALPHA:     determines if a keycode returned by GetKey is a letter from
  166.              A-Z or a-z.
  167. Source:      isalpha.asm
  168.  
  169. Call with:   AX = keycode returned by GetKey.
  170. Returns:     if CF = 0, keycode is a character from A-Z or a-z
  171.              if CF = 1, keycode is not a character from A-Z or a-z
  172.              AX is not changed
  173. Uses:        CF
  174. Example:     call   getkey       ; get next keystroke
  175.              call   isalpha
  176.              jc     not_alpha
  177.  
  178.  
  179.  
  180. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  181.  
  182. ISDIGIT:     determines if a keycode returned by GetKey is the ASCII code
  183.              for the numeric characters 0-9
  184. Source:      isdigit.asm
  185.  
  186. Call with:   AX = keycode returned by GetKey.
  187. Returns:     if CF = 0, keycode is a character from 0-9
  188.              if CF = 1, keycode is not a character from 0-9
  189.              AX is not changed
  190. Uses:        CF
  191. Example:     call   getkey       ; get next keystroke
  192.              call   isdigit      ; I want numbers only
  193.              jc     not_a_number
  194.  
  195.  
  196.  
  197. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  198.  
  199. ISLOWER:     determine if a keycode returned by GetKey is lower case
  200. Source:      islower.asm
  201.  
  202. ISUPPER:     determine if a keycode returned by GetKey is upper case
  203. Source:      isupper.asm
  204.  
  205. Call with:   AX = keycode returned by GetKey.
  206. Returns:     if CF = 0, keycode is a character from A-Z or a-z
  207.              if CF = 1, keycode is not a character from A-Z or a-z
  208.              AX is not changed
  209. Uses:        CF
  210. Example:     call   getkey       ; get next keystroke
  211.              call   isupper      ; is it upper case?
  212.              jc     not_upper    ; no; could be lower case
  213.  
  214.  
  215. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  216.  
  217. JANEIN:      German language version of YesNo
  218.              waits for 'J' or 'N' key to be pressed
  219. Source:      janein.asm
  220.  
  221. Call with:   no parameters
  222.              Key pressed may be upper or lower case.  Upper case is
  223.              returned.  Uses BIOS functions
  224. Returns:     AX = 'J' or AX = 'N'
  225.              future versions will also return ^C
  226. Uses:        AX
  227. Example:     call  JaNein
  228.  
  229.  
  230.  
  231. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  232.              
  233. KEYIFWAITING:Returns first key if one is waiting in the keyboard buffer,
  234.              or returns with no keycode if no keypress is waiting.
  235. Source:      kifwait.asm (getkey.asm)
  236.  
  237. Call with:   no parameters
  238. Returns:     AX = 0 if no key waiting
  239.              AX = keycode if one is waiting in the buffer.  Uses BIOS.
  240. Uses:        AX
  241. Example:     call  keyifwaiting
  242.  
  243.  
  244.  
  245. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  246.  
  247. KEYORBUTTON: waits for first keypress or mouse button click
  248. Source:      mouse.asm (getkey.asm)
  249.  
  250. Call with:   no parameters
  251.              If a keypress is waiting in the keyboard buffer before
  252.              this subroutine is called, the keycode is returned to
  253.              the calling program without checking mouse button status.
  254. Returns:     AX = keycode, BX = mouse button code (see MouseStatus)
  255. Uses:        AX, BX
  256. Supports:    2- or 3-button mouse, standard or enhanced keyboard
  257. Example:     call   keyorbutton
  258.  
  259.  
  260. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  261.  
  262. KEYWAITING:  Determines if a key is waiting in the keyboard buffer.
  263.              Does not remove the key code from the buffer.  Uses BIOS.
  264. Source:      getkey.asm
  265.  
  266. Call with:   no parameters
  267. Returns:     AX = 0 if no key waiting
  268.              AX = 1 if key waiting
  269. Uses:        AX
  270. Supports:    standard or enhanced keyboard
  271. Example:     call   keywaiting
  272.              or     ax,ax        ; has a key been pressed?
  273.              jz     no_key       ; nope, not yet
  274.  
  275.  
  276. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  277.  
  278. MENUOPTION:  options for PULLDOWN, PICKF, GPICKF, PICKSTR and GPICKSTR
  279. Source:      a$menu.asm
  280.  
  281. Call with:   AX = option value
  282.              BX = option number
  283.  
  284.              If you do not specify any options or if you call MenuOption
  285.              with AX = 0, default values are assumed.
  286.  
  287.              options available are:           defaults:
  288.                0 = normal text color            07h
  289.                1 = current selection color      70h
  290.                2 = list box color               0Fh
  291.                3 = hotkey color                 0Fh         (1)
  292.                4 = optional quitkey             no quitkey  (2)
  293.                5 = exit when hotkey pressed     00h         (3)
  294.                6 = box frame type (see WFRAME)  -1          (4)
  295.  
  296. NOTE: DEFAULT COLORS MAY NOT BE SUITABLE FOR SOME GRAPHICS MODES
  297.  
  298. (1) the first upper-case letter in each string is that string's hotkey
  299.     no upper-case character = no hotkey
  300. (2) the quitkey value is a keycode returned by GetKey
  301. (3) use AX = -1 for exit when hotkey pressed, AX = 0 to disable
  302. (4) text modes only
  303.  
  304. Returns:     nothing
  305. Uses:        nothing
  306. Supports:    GPickF, GPickStr, PullDown, PickF, PickStr menu systems
  307. Example:
  308.  
  309. include   asm.inc
  310. extrn     menuoption:proc, pulldown:proc
  311.  
  312. .code
  313.           .
  314.           .
  315.           .
  316.           mov   bx,0         ; text color
  317.           mov   ax,23        ; white w/ blue background
  318.                              ; in graph modes, this would be
  319.                              ; MOV  AX,0107h  (see GCOLOR in GRAPHICS.DOC)
  320.           call  menuoption
  321.  
  322.  
  323.  
  324.  
  325. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  326.  
  327. MOUSELIMIT:  limits mouse's range of motion
  328. Source:      mouse.asm
  329.  
  330. Call with:   DS:[BX] pointing to pixel coordinates of minimum and maximum
  331.              x and y limits.  X-limits are the horizontal dimension and
  332.              y-limits are the vertical dimension.
  333. Returns:     nothing
  334. Uses:        nothing
  335. Example:
  336.  
  337. .data
  338.  
  339. x0    dw 30
  340. y0    dw 15
  341. x1    dw 620
  342. y1    dw 250
  343.  
  344. .code
  345. ; program gragment assumes DS:@data
  346.        .
  347.        .
  348.        .
  349.       lea    bx,x          ; DS:[BX] points to limits
  350.       call   mouselimit
  351.  
  352.  
  353. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  354.  
  355. MOUSEPOS:    sets the mouse's position
  356. Source:      mouse.asm
  357.  
  358. Call with:   DS:[DX] pointing to desired x- and y-coordinates
  359.              Note that mouse coordinates are expressed as a pixel location
  360.              as with graphics mode, even if the system is in text mode
  361. Returns:     nothing
  362. Uses:        nothing
  363. Example:
  364.  
  365. .data
  366.  
  367. x     dw 100
  368. y     dw 25
  369.  
  370. .code
  371. ; program gragment assumes DS:@data
  372.       .
  373.       .
  374.       .
  375.       lea    dx,x          ; DS:[DX] points to desired position
  376.       call   mousepos
  377.  
  378. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  379.  
  380. MOUSESTATUS: determine mouse position & buttons pressed
  381. Source:      mouse.asm
  382.  
  383. Call with:   no parameters
  384. Returns:     if ZF = 1, no buttons are pressed
  385.              if ZF = 0, BX = button code
  386.               BX bit 0 if set = left button is down
  387.               BX bit 1 if set = right button is down
  388.               BX bit 2 if set = center button is down
  389.              CX = horizontal (x) coordinate
  390.              DX = vertical (y) coordinate
  391.              Note that mouse positions are expressed as a pixel location
  392.              as with graphics mode, even if the system is in text mode
  393. Uses:        BX, CX, DX, flags
  394. Example:     call  mousestatus
  395.              jz    no_buttons     ; no buttons pressed if ZF = 1
  396.  
  397.  
  398. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  399.  
  400. OUINON:      French language version of YesNo
  401.              waits for 'O' or 'N' key to be pressed
  402. Source:      ouinon.asm
  403.  
  404. Call with:   no parameters
  405.              Key pressed may be upper or lower case.  Upper case is
  406.              returned.  Uses BIOS functions
  407. Returns:     AX = 'O' or AX = 'N'
  408.              future versions will also return ^C
  409. Uses:        AX
  410. Example:     call  OuiNon
  411.  
  412.  
  413.  
  414. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  415.  
  416. PICKF:       pick a file from a list of filenames
  417.              PickF pops a window on the screen and displays filenames
  418.              matching an input filespec mask.  One filename may be selected
  419.              with cursor keys or with hotkeys.  When Esc, Enter or ^C is
  420.              pressed, PickF restores the screen and returns the selected
  421.              filename to the calling program.
  422.              Unused memory must be released by STARTUP (see STARTUP.ASM).
  423.              PickF allocates a block of DOS memory which should be released
  424.              after you are done with it.  See example.
  425.              See also MenuOption.
  426. Source:      pickf.asm ($pick.asm, $listw.asm, m$putw.asm, filelist.asm,
  427.                           dosalloc.asm, wsave.asm, a$menu.asm)
  428.  
  429. Call with:   DS:[SI] pointing to filespec mask
  430.              BX = initial cursor position
  431.              CX = file attribute mask
  432.              DH = top screen row for list
  433.              DL = left screen column for list
  434. Returns:     if CF = 0, AX = last key pressed
  435.                         ES:[BX] points to filename selected
  436.                         CX = maximum length of filename
  437.              if CF = 1, no filenames match input filespec
  438. Uses:        AX, BX, CX, ES, CF
  439. Supports:    text mode
  440. Example:
  441.  
  442. include   asm.inc
  443.  
  444. public    myproc
  445. extrn     pickf:proc
  446.  
  447. .data
  448. filespec db '*.asm',0            ; search for ASM source code
  449.  
  450. .code
  451. ; program fragment assumes DS:@data
  452.         .
  453.         .
  454.         .
  455.         lea     si,filespec
  456.         mov     bx,0             ; start at top of list
  457.         xor     dx,dx            ; upper left corner of screen
  458.         mov     cx,0             ; normal files only
  459.         call    pickf
  460.         cmp     ax,0Dh           ; was Enter the last key pressed?
  461.         jne     abort            ;  nope - someone wants out
  462.         call    strndup          ;  yup - copy filename to near heap
  463.         mov     ah,49h
  464.         int     21h              ; release the filename buffer
  465.  
  466.  
  467. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  468.  
  469. PICKSTR:     pick a string from a list of ASCIIZ strings
  470. Source:      pickstr.asm ($pick.asm, m$putw.asm, $strlist.asm,
  471.                           dosalloc.asm, wsave.asm, a$menu.asm)
  472.  
  473. Call with:   DS:[SI] pointing to list of ASCIIZ strings
  474.              BX = initial cursor position
  475.              DH = top screen row for list
  476.              DL = left screen column for list
  477.  
  478.              PickStr pops a window on the screen and displays the list
  479.              of strings.  One string may be selected with cursor keys
  480.              or with hotkeys.  When Esc, Enter or ^C is pressed, PickStr
  481.              restores the screen and returns a string index number.
  482.              Unused memory must be released by STARTUP (see STARTUP.ASM).
  483.              See also MenuOption.  Maximum number of choices: 255
  484.  
  485. Returns:     AX = last key pressed
  486.              BX = string number selected (first string = 0)
  487. Uses:        AX, BX
  488. Supports:    text mode
  489. Example:
  490.  
  491. include   asm.inc
  492.  
  493. public    myproc
  494. extrn     pickstr:proc
  495.  
  496. .data
  497. string1   db 'January',0
  498.           db 'February',0
  499.           db 'March',0
  500.           db 'April',0
  501.           db 'May',0
  502.           db 'June',0
  503.           db 'July',0
  504.           db 'August',0
  505.           db 'September',0
  506.           db 'October',0
  507.           db 'November',0
  508.           db 'December',0
  509.           db 0              ; mark end of menu strings
  510.  
  511. .code
  512. ; program fragment assumes DS:@data
  513.         .
  514.         .
  515.      lea  si,string1
  516.      mov  bx,1
  517.      xor  dx,dx
  518.      call pickstr
  519.  
  520. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  521.  
  522. PULLDOWN:    pull-down menu system
  523. Source:      pulldown.asm (a$menu.asm, tprint.asm, tprintce.asm, tputchr.asm
  524.                            strlen.asm, wclear.asm, wframe.asm, wsize.asm
  525.                            wsave.asm, getkey.asm, pickstr.asm and others)
  526.  
  527. Call with:   DS:[SI] pointing to menu labels
  528.              BH = initial main menu choice, BL = initial submenu choice
  529.              assumes DS:@data
  530.              Unused memory must be released (see STARTUP.ASM and ENDPROG)
  531.  
  532.              If PullDown is called with BL < 0, only the main headings are
  533.              printed initally; the submenus are printed when ENTER is
  534.              pressed, a mouse button is pressed, or when either the down
  535.              arrow key is pressed or a "down" mouse movement is detected.
  536.  
  537.              If PullDown is called with BL >= 0, it starts in the full main
  538.              headings plus submenus mode.  In this mode, a mouse button
  539.              click or the ENTER key will exit PullDown.  In either mode,
  540.              ESC, ^C or the user-defined quitkey (see MenuOption) causes
  541.              PullDown to return to the calling program.
  542.  
  543.              If there are too many main headings to fit across the top of the
  544.              screen, the headings are scrolled left or right as required to
  545.              show the selected heading.  Use Left, Right, Home and End keys
  546.              to change selected headings.  Maximum number of headings: 20
  547.  
  548.              If there are too many submenu choices under a heading to fit
  549.              on the screen, the selections are scrolled up or down as required
  550.              to show the selected item.  Use Up, Down, PgUp, PgDown keys
  551.              to change selection, or press highlighted letter of selection.
  552.              Maximum number of selections per heading: 255
  553.  
  554. Returns:     BH = main menu choice, BL = submenu choice
  555.              if CF = 1, ^C or Ctrl-Break was pressed
  556.              if CF = 0
  557.                  AX = 13 if ENTER was pressed
  558.                  AX = user-defined quitkey if pressed (see MenuOption)
  559.                  AX = 0 if insufficient DOS memory is available
  560.                  AX = 27 if ESC was pressed
  561.                  AH = 1-7, AL = 0 if mouse button pressed
  562. Uses:        AX, BX
  563. Supports:    text mode; all row/column configurations supported by ASMLIB
  564.              Text subroutines
  565. Example:
  566.  
  567. see next page
  568.  
  569. ;    this sample menu has 4 main menu headings:
  570. ;                          Critters, Things, Food, Trees
  571. ;    submenu choices for each main heading follow each main heading
  572. ;    Note that each string is terminated with NUL, and that there's an
  573. ;    extra NUL between the end of the submenu choices and the next main
  574. ;    heading.
  575. ;    The entire set of menu choices is terminated with 2 NUL bytes
  576. ;
  577. ;    PULLDOWN will return to the calling program when either ESCAPE or
  578. ;    ENTER is pressed (AX = ASCII code of key pressed).  PULLDOWN returns
  579. ;    AX = 0 if insufficient memory is available to save the underlying
  580. ;    screen, or AX = 3 if breaktrap was enabled and Ctrl+Break was pressed.
  581. ;
  582. ;    On return, BH = the main heading and BL = the submenu choice in effect
  583. ;    when the key was pressed.  The first main heading is number 0, and
  584. ;    the first submenu choice for each main heading is also number 0.
  585.  
  586. include asm.inc
  587.  
  588. extrn     pulldown:proc
  589.  
  590. .stack
  591.  
  592. .data
  593. menu    db 'Critters',0
  594.         db 'Goats',0,'Chickens',0,'Turkeys',0,'Cows',0,'Snow dogs',0
  595.  
  596.         db 0                   ; separate Things from Critters
  597.         db 'Things',0
  598.         db 'Computers',0,'Tractors',0,'CPU chips',0,'Barbie dolls',0
  599.  
  600.         db 0                   ; separate Food from Things
  601.         db 'Food',0
  602.         db 'Hot dogs',0,'Wheat germ',0,'Lasagne',0,'Cheerios',0
  603.         db 'Potatoes',0,'chocolate chip cooKies',0
  604.  
  605.         db 0                   ; separate Trees from Food
  606.         db 'Trees',0
  607.         db 'giant Sequoia',0,'black Spruce',0,'Willow',0,'live Oak',0
  608.         db 'Acacia',0,'digger Pine',0
  609.  
  610.         db 2 dup(0)            ; end of menu choices
  611.  
  612. .code
  613. ; program fragment assumes DS:@data
  614.         .
  615.         .
  616.         .
  617.         lea   si,menu          ; point to menu labels
  618.         xor   bx,bx            ; initial selection is "goats"
  619.         call  pulldown
  620.  
  621.  
  622. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  623.  
  624. SINO:        Spanish language version of YesNo
  625.              waits for 'S' or 'N' key to be pressed
  626. Source:      sino.asm
  627.  
  628. Call with:   no parameters
  629.              Key pressed may be upper or lower case.  Upper case is
  630.              returned.  Uses BIOS functions
  631. Returns:     AX = 'S' or AX = 'N'
  632.              future version will also return ^C
  633. Uses:        AX
  634. Example:     call  sino
  635.  
  636.  
  637. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  638.  
  639. TEDIT:       ASCIIZ string editor for text modes
  640.              See also GEdit for graphics modes, A$EDIT for general information.
  641.              TEdit turns the cursor off (with CursorOFF) on exit.
  642. Source:      tedit.asm (a$edit.asm, cursor.asm, a$clrw.asm, str2vbuf.asm,
  643.                         crtinfo.asm)
  644.  
  645. Call with:   DS:[SI] pointing to string buffer; may include a default string
  646.              assumes DS:@data
  647.              CX = byte size of buffer (excluding terminating NUL)
  648.              AH = color attribute
  649.              AL = option bits (see A$EDIT)
  650.              DH = row (offset from top of screen)
  651.              DL = column (offset from left edge of screen)
  652.  
  653. Returns:     AX = last key pressed (see GetKey for key codes)
  654.              CX = new string length
  655. Uses:        AX, CX, flags
  656. Supports:    text modes; all row/column configurations
  657. Example:     lea   si,string_buffer    ; near address of string buffer
  658.              mov   cx,len_buffer       ; byte length of buffer for the string
  659.              mov   dh,row
  660.              mov   dl,column
  661.              mov   ah,attr             ; color attribute
  662.              mov   al,2                ; force lower case
  663.              call  tedit
  664.  
  665.  
  666.  
  667. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  668.  
  669. TMOUSELIMIT: limits mouse's range of motion on text mode screen
  670. Source:      tmlimit.asm
  671.  
  672. Call with:   DS:[BX] pointing to character coordinates of minimum and maximum
  673.              rows and columns.  Columns are the horizontal dimension and
  674.              rows are the vertical dimension.
  675. Returns:     nothing
  676. Uses:        nothing
  677. Example:
  678.  
  679. .data
  680.  
  681. x0    dw 3          ; first row
  682. y0    dw 1          ; first column
  683. x1    dw 20         ; last row
  684. y1    dw 50         ; last column
  685.  
  686. .code
  687. ; program fragment assumes DS:@DATA
  688.        .
  689.        .
  690.        .
  691.       lea    bx,x          ; DS:[BX] points to limits
  692.       call   tmouselimit
  693.  
  694.  
  695.  
  696. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  697.  
  698. TOLOWER:     converts keycode returned by getkey to lower case
  699. Source:      tolower.asm
  700.  
  701. Call with:   AX = keycode
  702. Returns:     AX = lower case keycode
  703.              ToLower leaves the keycode alone if the keycode is not
  704.              upper case A-Z.
  705. Uses:        AX
  706. Example:     call   getkey
  707.              call   tolower
  708.  
  709.  
  710. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  711.  
  712. TOUPPER:     converts keycode returned by getkey to upper case
  713. Source:      toupper.asm
  714.  
  715. Call with:   AX = keycode
  716. Returns:     AX = upper case keycode
  717.              ToUpper leaves the keycode alone if the keycode is not
  718.              lower case a-z.
  719. Uses:        AX
  720. Example:     call   getkey
  721.              call   toupper
  722.  
  723.  
  724. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  725.  
  726. YESNO:       waits for 'Y' or 'N' key to be pressed
  727. Source:      yesno.asm
  728.  
  729. Call with:   no parameters
  730.              Key pressed may be upper or lower case.  Upper case is
  731.              returned.  Uses BIOS functions
  732. Returns:     AX = 'Y' or AX = 'N'
  733.              future version will also return ^C
  734. Uses:        AX
  735. Example:     call  yesno
  736.  
  737.  
  738.