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

  1. ;    kgetchar.a - KGetChar implementation using ROM routines
  2. ;    $VER: kgetchar.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    _KGetChar
  11.     xdef    @KGetChar
  12.  
  13. ; Some aliases
  14.  
  15.     xdef    _kgetc
  16.     xdef    @kgetc
  17.     xdef    KGetChar
  18.  
  19.     section    text,code
  20.  
  21.  
  22. ******* debug.lib/KGetChar **************************************************
  23. *
  24. *   NAME
  25. *       KGetChar -- get a character from the debugging console. (V37)
  26. *
  27. *   SYNOPSIS
  28. *       char = KGetChar()
  29. *       D0
  30. *
  31. *       LONG KGetChar(VOID);
  32. *
  33. *   FUNCTION
  34. *       Busy waits until a character arrives from the debugging console
  35. *       (defaults to the serial port at 9600 baud).
  36. *
  37. *   RESULT
  38. *       char - a character that arrived from console.
  39. *
  40. *   NOTES
  41. *       @KGetChar, @kgetc and KGetChar are identical assembly interfaces.
  42. *       _KGetChar, _kgetc are the C interfaces.
  43. *
  44. *****************************************************************************
  45. *
  46. * _KGetChar(void)
  47. * @KGetChar(void)
  48. *
  49. _KGetChar:
  50. _kgetc:
  51. @KGetChar:
  52. @kgetc:
  53. KGetChar:
  54.     move.l    a6,-(sp)            ; Save a6
  55.     move.l    (4).w,a6            ; Load a6 with SysBase
  56. Loop:
  57.     jsr    _LVORawMayGetChar(a6)        ; Try to get char
  58.     tst.l    d0                ; Got it?
  59.     bmi.b    Loop                ; No - loop
  60.     move.l    (sp)+,a6            ; Restore a6
  61.     rts                    ; Return d0
  62.  
  63.     end
  64.