home *** CD-ROM | disk | FTP | other *** search
-
-
- #include <regs.h > /* or however you generate interrupts */
- #define TEXTSPACE ???? /* however long the total text is */
- #define SCREENCOUNT ???
- unsigned scrseg;
- char *charptr,*place[SCREENCOUNT], /* place[] = pointers to screens */
- buff[4000],texthold[TEXTSPACE];
- main()
- {
- struct regs rr;
- int i,fhand;
-
- interrupt(0x11,rr); /* equipment check interrupt */
- scrseg=((rr.ax >> 4) & 3 == 3) ? 0xb000 : 0xb800; /* which CRT adapter? */
- fhand=open("text.txt",0); /* load text area from word processor file */
- read(fhand,texthold,TEXTSPACE);
- close(fhand);
- place[0]=charptr=texthold;
- for(i=1;i<SCREENCOUNT;i++){ /* setting addresses of screens */
- while(*charptr++ != '~'); /* tilde divides screens */
- place[i] = charptr;
- }
- * * * * * * /* this is the area where the program */
- text(QQ); /* would do something useful. */
- * *
- text (RR);
- * * * * * *
- }
- /***************/
- text(nn)
- int nn;
- {
- char att,*wptr;
- int y,i,*iptr;
-
- for(i=0,iptr=buff;i<2000;i++) 0x0720; /* blank screen buffer */
- for(charptr = place[nn]; *charptr != 0xa ;) if(*charptr++ == 26) return;
- /* to end of line: this gives me an area for comments */
- for(att=0x7,y=0,wptr=buff;;charptr++) switch(*charptr){
- case 0xa: wptr = &buff[++y*160];
- /* point pointer to beginning of new line */
- if(y<25) break; /* fall through if screen too large */
- case '~': longmove(scrseg,0,buff,4000);
- /* End of screen. You could use port calls to the 6845 to
- blank the screen and avoid flicker. If you do, remember
- that the control port is 0x3d8 for color/graphics and
- 0x3b8 for monochrome. More hardware dependencies! */
- return;
-
- case 0xd: break; /* some WP's don't include 0xd's */
- case '^': att ^= 8; /* toggling intensity bit: 0xf<->0x7*/
- break;
- default: *wptr++ = *charptr; /*insert character */
- *wptr++ = att; /*and attribute */
- break;
- }
- }
- /******************/
- longmove(segment,offset,buffer,count)
- unsigned seg,offset,ct;
- char *buffer;
- {
- /* This one depends on
- a. How your version of C handles the stack.
- b. What sort of assembler you are using.
-
- I'll just give assembly pseudocode. You'd probably be
- using [BP+?] addressing */
- #asm
- mov es,segment
- mov di,offset
- mov si,buffer ;ds is already set
- mov cx,count
- cld ;increment si & di with each loop
- rep movsb
- #endasm
- }
-