|
|
1.1 root 1: #include <conio.h>
2: #include <stdio.h>
3:
4: extern unsigned int riobp;
5: int rioini(int,int);
6: int setbaud(int);
7: int incom(void);
8: int outcom(int);
9: void bblst(void);
10: int dtr(int);
11:
12: main() {
13: unsigned int j,c,*pci;
14: unsigned char *pc;
15: directvideo=0;
16: printf("rioini() returned %d, ",rioini(2,0)); /* com 3, irq 4 */
17: printf("setbaud() returned %d\n",setbaud(2400));
18: printf("b"); bblst();
19: system("ios");
20: outcs("\015ready\015\012");
21: printf("\na"); bblst();
22: printf("Any key to start, then escape exits, ");
23: printf("backquote drops dtr, ctrl-r dials Rob.\n");
24: while (!bioskey(1)); c=getch();
25: printf("+"); bblst();
26: while (1) {
27: c=0;
28: if (bioskey(1)) c=getch();
29: if (c==0x1b) break;
30: if (c==0x60) {
31: printf("\n*** dtr() returned %d\n",dtr(2)); c=0; }
32: if (c==0x12) { outcs("atdt 17145299525\015"); c=0; }
33: if (c==0x7e) {
34: outcsi("Here's a test string what tries to overf");
35: outcsi("low the transmit buffer, yessiree.\015");
36: c=0; }
37: if (c) outcom(c);
38: if ((c=incom())!=0x100) putch(c);
39: }
40: printf("\n-"); bblst();
41: printf("done\n");
42: pci=&riobp; pc=pci; pc+=24; printf("rxb ");
43: for (j=0; j<24; j++) printf("%02X ",0xff&*(pc+j));
44: printf("\ntxb ");
45: pc+=*(pci+5);
46: for (j=0; j<24; j++) printf("%02X ",0xff&*(pc+j));
47: printf("\n");
48: outcs("ath\x0d");
49: system("ios");
50: rioini(0,0);
51: }
52: int outcs(char *str) {
53: int i=0;
54: while(str[i]!=0) outcom(str[i++]);
55: }
56: int outcsi(char *str) {
57: int c,i=0;
58: while(str[i]!=0) {
59: outcom(str[i++]);
60: if (i>4)
61: if ((c=incom())!=0x100) putch(c); }
62: }
63: void bblst(void) {
64: unsigned int *pv;
65: int i;
66: pv=&riobp;
67: printf("%Fp",pv);
68: for (i=0; i<12; i++) printf(".%04X",*(pv+i));
69: printf("\n");
70: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.