home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* XBBS SOURCE CODE copyright (c) 1990 by M. Kimes */
- /* All Rights Reserved */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the in the file LICENSE.XBS. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* XBBS LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT M. KIMES */
- /* AT THE ADDRESS LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO USE */
- /* THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE XBBS LICENSING */
- /* AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH */
- /* M. KIMES */
- /* */
- /* */
- /* You can contact M. Kimes at the following address: */
- /* */
- /* M. Kimes 1:380/16.0@FidoNet */
- /* 542 Merrick (318)222-3455 data */
- /* Shreveport, LA 71104 */
- /* */
- /* */
- /* Please feel free to contact me at any time to share your comments about */
- /* my software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
- /*======================================================================*/
- /* XBBS Bulletin Board System.....Functions using inline assembly */
- /* */
- /* These functions use TC's inline for speed and ease of maintenance */
- /*======================================================================*/
-
- #include "msg.h"
- #include "xext.h"
-
-
-
- void pascal checkpos (void) { /* KEEP STATUS LINE CLEAN */
-
- asm mov ah,3;
- asm mov bh,0;
- asm int 16;
- if (_DH>22) { /* Reposition cursor to protect */
- if(_DH>23) redraw_stat(NULL); /* status lines */
- asm mov ah,6;
- asm mov al,1;
- asm mov bh,7;
- asm mov ch,0;
- asm mov cl,0;
- asm mov dh,22;
- asm mov dl,79;
- asm int 16;
- asm mov ah,2;
- asm mov bh,0;
- asm mov dl,0;
- asm mov dh,22;
- asm int 16;
- }
- }
-
-
-
- void pascal cls (void) { /* MIMICS BASIC'S CLS FUNCTION LOCAL & REMOTE */
-
- lines=0;
- if (user.scrnclr) printm("\n");
- else {
- if (user.graphics) mprint("\x1b[2J");
- else mprint("\xa");
- asm mov ah,6;
- asm mov al,0;
- asm mov bh,7;
- asm mov ch,0;
- asm mov cl,0;
- asm mov dh,22;
- asm mov dl,79;
- asm int 16;
- asm mov ah,2;
- asm mov bh,0;
- asm mov dh,0;
- asm mov dl,0;
- asm int 16;
- }
- lines=0;
- }
-
-
-
- char pascal inkey (void) { /* MIMICS BASIC'S INKEY$ FUNCTION */
-
- register word x;
- char arg;
-
- r.h.ah=1;
- int86(22,&r,&r);
- if (!(r.x.flags & 64)) {
- whotyped=0;
- r.h.ah=0;
- int86(22,&r,&r);
- if (!r.h.al) return (specialkey(r.h.ah));
- else if (!disablejump && !leaving) if (*conf.jumpkey[0]) {
- for (x=0;x<10;x++) {
- if(!*conf.jumpkey[x]) break;
- if(r.h.al==*conf.jumpkey[x]) if(safe)longjmp(envbuf,(int)(x+1));
- }
- }
- return r.h.al;
- }
- if (baud) {
- Again:
- r.x.dx=conf.commport;
- r.h.ah=GETSTAT;
- int86(20,&r,&r);
- if (!(r.h.al & 128)) carrchk();
- if (!(r.h.ah & 1)) return 0;
- _DX=conf.commport;
- _AH=RECVWAIT;
- asm int 20;
- arg = _AL;
- if(!arg) {
- for(x=0;x<1024;x++);
- r.x.dx=conf.commport;
- r.h.ah=GETSTAT;
- int86(20,&r,&r);
- if (!(r.h.al & 128)) carrchk();
- if (!(r.h.ah & 1)) return 0;
- whotyped=1;
- _DX=conf.commport;
- _AH=RECVWAIT;
- asm int 20;
- arg = _AL|128;
- }
- if (arg!='\x1b') {
- if (!disablejump && !leaving) if (*conf.jumpkey[0]) {
- for (x=0;x<10;x++) {
- if(!*conf.jumpkey[x]) break;
- if(arg==*conf.jumpkey[x]) if(safe)longjmp(envbuf,(int)(x+1));
- }
- }
- return arg;
- }
- return(specialmod());
- }
- return (0);
- }
-
-
-
- char pascal lprint (char *text) {
-
- char mmore;
- char *p;
-
-
- while ((p=strstr(text,"\x1b[2J"))!=NULL) {
- memmove(&p[1],&p[4],strlen(&p[4])+1);
- *p='\xc';
- }
- while ((p=strchr(text,'\x7')) && !conf.sysopin) memmove(p,&p[1],strlen(&p[1])+1);
- while (p=strchr(text,'\r')) *p='\n';
- if (!*text) {
- fast=0;
- return 0;
- }
- if (fast) {
- if (!conf.dvideo) directvideo=0;
- textattr(GREEN | BLACK * 16);
- highvideo();
- cputs(text);
- cputs("\r");
- asm mov ah,3;
- asm mov bh,0;
- asm int 16;
- if (_DH>22) checkpos();
- fast=0;
- goto CheckPause;
- }
-
- while(*text) {
- if (*text=='\xc') { /* Clear screen */
- lines=0;
- asm mov ah,6;
- asm mov al,0;
- asm mov bh,7;
- asm mov ch,0;
- asm mov cl,0;
- asm mov dh,22;
- asm mov dl,79;
- asm int 16;
- asm mov ah,2;
- asm mov bh,0;
- asm mov dh,0;
- asm mov dl,0;
- asm int 16;
- text++;
- continue;
- }
- if (conf.bioswrites) {
- Again:
- asm mov ah,14;
- asm mov bh,0;
- _AL=*text;
- asm int 16;
- if (*text=='\n') {
- *text='\r';
- goto Again;
- }
- }
- else if (conf.fastANSI) {
- Again1:
- _AX=*text;
- asm int 0x29;
- if (*text=='\n') {
- *text='\r';
- goto Again1;
- }
- }
- else {
- Again2:
- _DL=*text;
- asm mov ah,2;
- asm int 33;
- if (*text=='\n') {
- *text='\r';
- goto Again2;
- }
- }
- text++;
- asm mov ah,3;
- asm mov bh,0;
- asm int 16;
- if (_DH>22) checkpos();
- }
-
- CheckPause:
-
- if ((!pauser) || (user.more)) {
- lines=0;
- return 0;
- }
- if (pauser == 2) return 0;
- if (++lines>=user.length-1) {
-
- long tempprompt=0;
- long tempindex=0;
-
- pauser=0;
- if(indexhandle!=-1 && prompthandle!=-1) {
- tempprompt=tell(prompthandle);
- tempindex=tell(indexhandle);
- }
- say_prompt(18);
- fossil(FLUSHOUT,0);
- fossil(PURGEIN,0);
- mmore = *genin(1,0,1,1,YESNOM);
- say_prompt(276);
- if(tempprompt) {
- lseek(prompthandle,tempprompt,SEEK_SET);
- lseek(indexhandle,tempindex,SEEK_SET);
- }
- if (mmore == 'N') {
- printm("\n");
- return (1);
- }
- pauser=1;
- }
- return (0);
- }
-
-
- void pascal redraw_stat (char *tracetext) { /* Prints nice status lines */
-
- char temp[133];
- static char mbl1[80]="";
- static char mbl2[80]="";
- char currx;
- char curry;
- char *a;
- word temptime;
- register word x;
-
- if(conf.trace && !tracetext) return;
- if(conf.promptsay) if(conf.whichstat==3) conf.whichstat=0;
- if (!conf.dvideo) directvideo=0;
- temptime=(word)(timelimit-(getxbbstime()/60));
- asm mov ah,3; /* Set up to print on 2nd line from bottom */
- asm mov bh,0; /* In reverse video */
- asm int 16;
- curry=_DH;
- currx=_DL;
- asm mov ah,6;
- asm mov bh,112;
- asm mov al,0;
- asm mov ch,23;
- asm mov cl,0;
- asm mov dh,24;
- asm mov dl,79;
- asm int 16;
- asm mov ah,2;
- asm mov bh,0;
- asm mov dh,23;
- asm mov dl,0;
- asm int 16;
- textbackground(7);
- textcolor(0);
- if(conf.trace) {
- a=strdup(tracetext);
- if(a) {
- x=0;
- while(a[x]) {
- if(a[x]=='\n') a[x]='|';
- x++;
- }
- cprintf("%-1.158s",a);
- free(a);
- }
- }
- else if (conf.whichstat==1) { /* Status line #1 */
- sprintf(temp,"%u Bd\x4%s %s %s \x4TC: %u\x4",baud,user.city,user.state,user.zip,user.times);
- if (conf.sysopin) strcat(temp,"IN\x4");
- else strcat(temp,"OUT\x4");
- if (user.arq) strcat(temp,"ARQ\x4");
- if (user.twit) strcat(temp,"TWT\x4");
- if (!user.ansimenus) strcat(temp,"AMU\x4");
- if (user.gen1) strcat(temp,"G1\x4");
- if (user.gen2) strcat(temp,"G2\x4");
- if (user.gen3) strcat(temp,"G3\x4");
- if (user.commodore) strcat(temp,"SPC\x4");
- if (pages) strcat(temp,"Cht?");
- temp[78]=0;
- cputs(temp);
- sprintf(temp,"%s\x4%s%cAge:%hu\x4#U:%u Uk: %lu #D: %u Dk: %lu",user.phone1,user.phone2,4,age,user.upno,user.upk,user.downno,user.downk);
- temp[78]=0;
- a=temp;
- }
- else if (conf.whichstat==2) { /* Status line #2 */
-
- int allocleft=0;
- int fileleft=0;
-
- for(x=0;x<MAXFPHANDLES;x++) {
- if(fphandles[x]==-1) fileleft++;
- }
- for(x=0;x<MAXALLOCHANDLES;x++) {
- if(allochandles[x]==NULL) allocleft++;
- }
- sprintf(temp,"Last: %02u/%02u/%04u \x4 %lu bytes free \x4 CT: %hu / %d %d / \x4 [",user.lastdate.da_mon,user.lastdate.da_day,user.lastdate.da_year,coreleft(),user.comptype,fileleft,allocleft);
- for (x=0;x<16;x++) {
- (user.attr2 & (1<<x)) ? strcat(temp,"X") : strcat(temp,"-");
- }
- strcat(temp,"]");
- temp[78]=0;
- cputs(temp);
- sprintf(temp,"XBBS v%s copyright (c) 1990 by M. Kimes \x4 (Compiled: %s %s)",XVERSION,__DATE__,__TIME__);
- a=temp;
- }
- else if (conf.whichstat==3) { /* Mike Berry Official Recliner Stat */
-
- char tempo[512];
-
- if(!*mbl1 && !*mbl2) {
-
- long tempprompt=0;
- long tempindex=0;
-
- if(indexhandle!=-1 && prompthandle!=-1) {
- tempprompt=tell(prompthandle);
- tempindex=tell(indexhandle);
- }
- if(!*mbl1 && !*mbl2) {
- strncpy(mbl1,say_prompt(400),78);
- mbl1[78]=0;
- strncpy(mbl2,say_prompt(401),78);
- mbl2[78]=0;
- if(tempprompt>0) {
- lseek(prompthandle,tempprompt,SEEK_SET);
- lseek(indexhandle,tempindex,SEEK_SET);
- }
- }
- }
- strcpy(tempo,cvstr);
- a=convertstring(mbl1);
- a[78]=0;
- cprintf("%-79.79s",a);
- a=convertstring(mbl2);
- a[78]=0;
- strcpy(temp,a);
- a=temp;
- strcpy(cvstr,tempo);
- }
- else { /* Status line #0 */
- sprintf(temp,"%-36s\x4%-36s\x4#%u",user.name,user.handle,userno);
- temp[78]=0;
- cputs(temp);
- sprintf(temp,"%u/%u/%u/%u/%u/%u/%u/%u/%u/%u\x4%u mins",user.stat[0],user.stat[1],user.stat[2],user.stat[3],user.stat[4],user.stat[5],user.stat[6],user.stat[7],user.stat[8],user.stat[9],temptime);
- a=fidodate();
- a[16]=0;
- a[9]=0;
- sprintf(&temp[strlen(temp)-1],"\x4%s %s",a,&a[11]);
- temp[78]=0;
- a=temp;
- }
- if(!conf.trace) {
- asm mov ah,2; /* Set up to print on last line */
- asm mov bh,0;
- asm mov dh,24;
- asm mov dl,0;
- asm int 16;
- cprintf("%-79.79s",a);
- }
- _DL=currx;
- if (curry<23) _DH=curry;
- else _DL=22;
- asm mov ah,2;
- asm mov bh,0;
- asm int 16;
- }
-
-
- void pascal blank_stat (void) {
-
- char currx;
- char curry;
-
- asm mov ah,3; /* Blank bottom two lines of screen */
- asm mov bh,0;
- asm int 16;
- curry=_DH;
- currx=_DL;
- asm mov ah,6;
- asm mov bh,7;
- asm mov al,0;
- asm mov ch,23;
- asm mov cl,0;
- asm mov dh,24;
- asm mov dl,79;
- asm int 16;
- _DH=curry;
- _DL=currx;
- asm mov ah,2;
- asm mov bh,0;
- asm int 16;
- }
-
-