home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s3.arc / READKBD.MOD < prev    next >
Text File  |  1988-02-07  |  4KB  |  81 lines

  1. (*----------------------------------------------------------------------*)
  2. (*            Read_Kbd --- Read one character from keyboard             *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Read_Kbd( VAR Ch: CHAR );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Read_Kbd                                             *)
  10. (*                                                                      *)
  11. (*     Purpose:    Reads one character from the keyboard                *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Read_Kbd( VAR Ch: CHAR );                                     *)
  16. (*                                                                      *)
  17. (*           Ch  --- Character read                                     *)
  18. (*                                                                      *)
  19. (*     Remarks:                                                         *)
  20. (*                                                                      *)
  21. (*        This routine centralizes single character keyboard reads so   *)
  22. (*        that time-slicing control for multitaskers is more easily     *)
  23. (*        centralized.  In this particular implementation, the time     *)
  24. (*        spent waiting for a keyboard entry is donated to the other    *)
  25. (*        DoubleDos partition.                                          *)
  26. (*                                                                      *)
  27. (*----------------------------------------------------------------------*)
  28.  
  29. BEGIN (* Read_Kbd *)
  30.  
  31.    WHILE ( NOT PibTerm_KeyPressed ) DO
  32.       GiveAwayTime( 2 );
  33.  
  34.    Ch := ReadKeyboard;
  35.  
  36. END   (* Read_Kbd *);
  37.  
  38. (*----------------------------------------------------------------------*)
  39. (*  Read_Kbd_Old --- Read one character from keyboard ignoring extended *)
  40. (*----------------------------------------------------------------------*)
  41.  
  42. PROCEDURE Read_Kbd_Old( VAR Ch: CHAR );
  43.  
  44. (*----------------------------------------------------------------------*)
  45. (*                                                                      *)
  46. (*     Procedure:  Read_Kbd_Old                                         *)
  47. (*                                                                      *)
  48. (*     Purpose:    Reads one character from the keyboard, but           *)
  49. (*                 ignores presence of extended 101-key keyboard.       *)
  50. (*                                                                      *)
  51. (*     Calling Sequence:                                                *)
  52. (*                                                                      *)
  53. (*        Read_Kbd_Old( VAR Ch: CHAR );                                 *)
  54. (*                                                                      *)
  55. (*           Ch  --- Character read                                     *)
  56. (*                                                                      *)
  57. (*     Remarks:                                                         *)
  58. (*                                                                      *)
  59. (*        This routine is useful when reading cursor input for menus    *)
  60. (*        so that it isn't necessary to explicitly check for both       *)
  61. (*        sets of cursor keys, both sets of position keys, etc.         *)
  62. (*                                                                      *)
  63. (*----------------------------------------------------------------------*)
  64.  
  65. VAR
  66.    Use_Ext : BOOLEAN;
  67.  
  68. BEGIN (* Read_Kbd_Old *)
  69.  
  70.    WHILE ( NOT PibTerm_KeyPressed ) DO
  71.       GiveAwayTime( 2 );
  72.  
  73.    Use_Ext           := Extended_Keyboard;
  74.    Extended_Keyboard := FALSE;
  75.  
  76.    Ch := ReadKeyboard;
  77.  
  78.    Extended_Keyboard := Use_Ext;
  79.  
  80. END   (* Read_Kbd_Old *);
  81.