source: buchla-68k/iolib/waitcr.c@ 7258c6a

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

Use standard integer types.

  • 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 "biosdefs.h"
9#include "stddefs.h"
10
11extern void xtrap15(void);
12
13/*
14 =============================================================================
15 waitcr() -- wait for a CR or a CTL-G. CR returns control to the
16 caller, CTL-G invokes xtrap15(), which if it returns, returns to
17 the caller. The xtrap15() escape is to allow a convenient debug
18 point whenever we wait on the console. The character that caused
19 the return (CR or CTL-G) is returned as the value of the function.
20 =============================================================================
21*/
22
23int16_t waitcr(void)
24{
25 int16_t c;
26
27 BIOS(B_PUTC, CON_DEV, '\007'); /* wake up the operator */
28
29 /* await a CR, in which case we just exit */
30
31 while ('\r' NE (c = (0x007F & (int16_t)BIOS(B_GETC, CON_DEV))))
32 if (c EQ '\007') /* ... or a control-G */
33 xtrap15(); /* ... in which case we trap first */
34
35 return(c); /* return the character that caused us to exit */
36}
Note: See TracBrowser for help on using the repository browser.