home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1997 #3 / amigamamagazinepolishissue03-1 / polski_aminet / michal_letowski / debuglib / src / kmaygetchar.a < prev    next >
Text File  |  1996-05-11  |  1KB  |  60 lines

  1. ;    kmaygetchar.a - KMayGetChar implementation using ROM routines
  2. ;    $VER: kmaygetchar.a 37.1 (10.5.96)
  3. ;    Copyright © 1996 Michael Letowski
  4. ;
  5. ;    37.1 (10.5.96) - initial version
  6.  
  7.     include    "exec/funcdef.i"
  8.     include    "exec/exec_lib.i"
  9.  
  10.     xdef    _KMayGetChar
  11.     xdef    @KMayGetChar
  12.  
  13. ; Some aliases
  14.  
  15.     xdef    KMayGetChar
  16.  
  17.     section    text,code
  18.  
  19.  
  20. ******* debug.lib/KMayGetChar ***********************************************
  21. *
  22. *   NAME
  23. *       KMayGetChar -- get a character from debugging console if present,
  24. *                      but don't wait. (V37)
  25. *
  26. *   SYNOPSIS
  27. *       flagchar = KMayGetChar()
  28. *       D0
  29. *
  30. *       LONG KMayGetChar(VOID);
  31. *
  32. *   FUNCTION
  33. *       Checks the status of the debugging console (defaults to the serial
  34. *       port at 9600 baud). Returns either -1, saying that there is no
  35. *       character present, or whatever character was waiting.
  36. *
  37. *   RESULT
  38. *       char - a character that arrived from console, or -1 if there was
  39. *              no char waiting.
  40. *
  41. *   NOTES
  42. *       @KMayGetChar and KMayGetChar are identical assembly interfaces.
  43. *       _KGetChar is the C interface.
  44. *
  45. *****************************************************************************
  46. *
  47. * _KMayGetChar(void)
  48. * @KMayGetChar(void)
  49. *
  50. _KMayGetChar:
  51. @KMayGetChar:
  52. KMayGetChar:
  53.     move.l    a6,-(sp)            ; Save a6
  54.     move.l    (4).w,a6            ; Load a6 with SysBase
  55.     jsr    _LVORawMayGetChar(a6)        ; Get char, no matter if available
  56.     move.l    (sp)+,a6            ; Restore a6
  57.     rts                    ; Return d0
  58.  
  59.     end
  60.