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.0 KB
|
Rev | Line | |
---|
[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | conin.c -- read from the console
|
---|
| 4 | Version 6 -- 1987-06-30 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define _FS_DEF_ /* to avoid unnecessary externals */
|
---|
| 9 |
|
---|
[6262b5c] | 10 | #include "all.h"
|
---|
[f40a309] | 11 |
|
---|
[7258c6a] | 12 | extern void *memcpy(void *vp1, void *vp2, int16_t n);
|
---|
| 13 | extern int16_t readbuf(int16_t dev, int8_t *buf);
|
---|
| 14 | extern void writeln(int16_t unit, int8_t *buf);
|
---|
[f40a309] | 15 |
|
---|
[7258c6a] | 16 | int8_t _ConBuf[258]; /* console input buffer */
|
---|
| 17 | int16_t _CBused;
|
---|
[f40a309] | 18 |
|
---|
[7258c6a] | 19 | int16_t _conin(int8_t *buff, int16_t len)
|
---|
[f40a309] | 20 | {
|
---|
[7258c6a] | 21 | int16_t nbp;
|
---|
| 22 | register int16_t l;
|
---|
[f40a309] | 23 |
|
---|
| 24 | if (_ConBuf[1] EQ 0) {
|
---|
| 25 |
|
---|
| 26 | _ConBuf[0] = 255;
|
---|
| 27 | _ConBuf[1] = _ConBuf[2] = 0;
|
---|
| 28 |
|
---|
| 29 | readbuf(CON_DEV, _ConBuf);
|
---|
| 30 | writeln(CON_DEV, "\r\n");
|
---|
| 31 |
|
---|
| 32 | if (_ConBuf[2] EQ 0x1a) {
|
---|
| 33 |
|
---|
| 34 | _ConBuf[1] = 0;
|
---|
| 35 | return(0);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | nbp = ++_ConBuf[1];
|
---|
| 39 | _ConBuf[nbp++ + 1] = '\r';
|
---|
| 40 | _ConBuf[nbp + 1] = '\n';
|
---|
| 41 | _CBused = 2;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | if ((l = _ConBuf[1]) > len)
|
---|
| 45 | l = len;
|
---|
| 46 |
|
---|
| 47 | memcpy(buff, (_ConBuf + _CBused), l);
|
---|
| 48 | _CBused += l;
|
---|
| 49 | _ConBuf[1] -= l;
|
---|
| 50 | return (l);
|
---|
| 51 | }
|
---|
[6262b5c] | 52 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.