home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / vms / 20582 < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.4 KB  |  60 lines

  1. Path: sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!zl2tnm!toyunix!don
  2. Newsgroups: comp.os.vms
  3. Subject: Re: Question: Reading keys with command procedures.
  4. Message-ID: <3698007@zl2tnm.gen.nz>
  5. From: don@zl2tnm.gen.nz (Don Stokes)
  6. Date: 8 Jan 93 14:29:55 GMT
  7. Sender: news@zl2tnm.gen.nz (GNEWS Version 2.0 news poster.)
  8. References: <73051@cup.portal.com>
  9. Distribution: world
  10. Organization: The Wolery
  11. Lines: 47
  12.  
  13. Chris_F_Chiesa@cup.portal.com writes:
  14. > assign the obtained keystroke (I recommend VAX BASIC if you have it, because 
  15. > its INKEY$ function implicitly parses the function keys for you and returns 
  16. > strings such as "UP" for the up-arrow, "DOWN" for the down-arrow, etc. (as
  17. > distinguished from you typing D,O,W,N, which would generate a "D" the first
  18. > time you called INKEY$, an "O" the second time, etc., e.g.) to a DCL symbol.
  19.  
  20. For those without VAX BASIC, a calling sequence of:
  21.  
  22.     BAS$INKEY( key by descriptor, 0 by value, 0 by value, 0 by value)
  23.  
  24. (where key is the destination string for the key) will do the same thing.
  25. What follows is a MACRO program that will call BAS$INKEY and place the 
  26. result in the symbol GETKEY_KEY.
  27.  
  28. Note that this fits into the "not supported but will break too much if it
  29. goes away" category.  All bets are off on Alpha.  8-)
  30.  
  31.         .title GETKEY   Get key and place in GETKEY_KEY
  32.         .ident "9/1/93/dcs"
  33.  
  34.                 $DSCDEF            ; Descriptor definitions
  35.  
  36. key:            .word 0                 ; Dynamic descriptor to return key in
  37.                 .byte DSC$K_DTYPE_T
  38.                 .byte DSC$K_CLASS_D
  39.                 .long 0
  40. sym:            .ascid "GETKEY_KEY"     ; Name of symbol to return key pressed
  41.  
  42.         .entry GETKEY, ^M<>
  43.                 pushl #0                ; Four parameters to BAS$INKEY
  44.                 pushl #0                ; First parameter is string to return
  45.                 pushl #0        ; key pressed in (placed on stack last)
  46.                 pushaq key
  47.                 calls #4, g^BAS$INKEY
  48.                 blbc R0, 99$        ; Abort on error
  49.                 pushaq key        ; LIB$SET_SYMBOL(sym,key)
  50.                 pushaq sym
  51.                 calls #1, g^LIB$SET_SYMBOL
  52. 99$:            ret            ; Done
  53.  
  54.                 .end GETKEY
  55.         
  56. --
  57. Don Stokes, ZL2TNM (DS555)                        don@zl2tnm.gen.nz (home)
  58. Network Manager, Computing Services Centre            don@vuw.ac.nz (work)
  59. Victoria University of Wellington, New Zealand              +64-4-495-5052
  60.