Last change
on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
1.2 KB
|
Rev | Line | |
---|
[3ae31e9] | 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 |
|
---|
| 11 | extern int xtrap15(); /* the ROMP trap */
|
---|
| 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 |
|
---|
| 23 | int
|
---|
| 24 | waitcr()
|
---|
| 25 | {
|
---|
| 26 | int c;
|
---|
| 27 |
|
---|
| 28 | BIOS(B_PUTC, CON_DEV, '\007'); /* wake up the operator */
|
---|
| 29 |
|
---|
| 30 | /* await a CR, in which case we just exit */
|
---|
| 31 |
|
---|
| 32 | while ('\r' NE (c = (0x007F & (int)BIOS(B_GETC, CON_DEV))))
|
---|
| 33 | if (c EQ '\007') /* ... or a control-G */
|
---|
| 34 | xtrap15(); /* ... in which case we trap first */
|
---|
| 35 |
|
---|
| 36 | return(c); /* return the character that caused us to exit */
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.