|
|
1.06a MS-DOS
#include <conio.h>
#include <stdio.h>
extern unsigned int riobp;
int rioini(int,int);
int setbaud(int);
int incom(void);
int outcom(int);
void bblst(void);
int dtr(int);
main() {
unsigned int j,c,*pci;
unsigned char *pc;
directvideo=0;
printf("rioini() returned %d, ",rioini(2,0)); /* com 3, irq 4 */
printf("setbaud() returned %d\n",setbaud(2400));
printf("b"); bblst();
system("ios");
outcs("\015ready\015\012");
printf("\na"); bblst();
printf("Any key to start, then escape exits, ");
printf("backquote drops dtr, ctrl-r dials Rob.\n");
while (!bioskey(1)); c=getch();
printf("+"); bblst();
while (1) {
c=0;
if (bioskey(1)) c=getch();
if (c==0x1b) break;
if (c==0x60) {
printf("\n*** dtr() returned %d\n",dtr(2)); c=0; }
if (c==0x12) { outcs("atdt 17145299525\015"); c=0; }
if (c==0x7e) {
outcsi("Here's a test string what tries to overf");
outcsi("low the transmit buffer, yessiree.\015");
c=0; }
if (c) outcom(c);
if ((c=incom())!=0x100) putch(c);
}
printf("\n-"); bblst();
printf("done\n");
pci=&riobp; pc=pci; pc+=24; printf("rxb ");
for (j=0; j<24; j++) printf("%02X ",0xff&*(pc+j));
printf("\ntxb ");
pc+=*(pci+5);
for (j=0; j<24; j++) printf("%02X ",0xff&*(pc+j));
printf("\n");
outcs("ath\x0d");
system("ios");
rioini(0,0);
}
int outcs(char *str) {
int i=0;
while(str[i]!=0) outcom(str[i++]);
}
int outcsi(char *str) {
int c,i=0;
while(str[i]!=0) {
outcom(str[i++]);
if (i>4)
if ((c=incom())!=0x100) putch(c); }
}
void bblst(void) {
unsigned int *pv;
int i;
pv=&riobp;
printf("%Fp",pv);
for (i=0; i<12; i++) printf(".%04X",*(pv+i));
printf("\n");
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.