source: buchla-68k/iolib/waitcr.c@ 6262b5c

Last change on this file since 6262b5c was 6262b5c, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added include files for global functions and variables.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 =============================================================================
3 waitcr.c -- wait for a CR from the console and allow for debugging
4 Version 3 -- 1987-07-15 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "all.h"
9
10extern void xtrap15(void);
11
12/*
13 =============================================================================
14 waitcr() -- wait for a CR or a CTL-G. CR returns control to the
15 caller, CTL-G invokes xtrap15(), which if it returns, returns to
16 the caller. The xtrap15() escape is to allow a convenient debug
17 point whenever we wait on the console. The character that caused
18 the return (CR or CTL-G) is returned as the value of the function.
19 =============================================================================
20*/
21
22int16_t waitcr(void)
23{
24 int16_t c;
25
26 BIOS(B_PUTC, CON_DEV, '\007'); /* wake up the operator */
27
28 /* await a CR, in which case we just exit */
29
30 while ('\r' NE (c = (0x007F & (int16_t)BIOS(B_GETC, CON_DEV))))
31 if (c EQ '\007') /* ... or a control-G */
32 xtrap15(); /* ... in which case we trap first */
33
34 return(c); /* return the character that caused us to exit */
35}
36
Note: See TracBrowser for help on using the repository browser.