home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / MODSUNKN.ZIP / ELRIC16.MOD < prev    next >
Text File  |  1989-12-17  |  10KB  |  334 lines

  1. Welcome to Elric's Mod #16. This mod is currently as complete as
  2. I can make it, however, look for updates soon.
  3.  
  4. EGA 43 Line mode BBS, V2.0
  5. --------------------------
  6.  
  7. (Note. The first version of this was buggy as all hell. This is a replacement
  8. for the buggy first version.)
  9.  
  10. WARNING: This mod does some low-level Dos stuff involving the EGA card.
  11. In theory, it should also work on a VGA monitor, however, since I don't have
  12. one, I can't really try that out. What I can tell you is it works with a
  13. few minor problems for me. If you do not have an EGA/VGA card,
  14.  
  15. DO NOT INSTALL THIS MOD!!!!!!!
  16.  
  17. While in theory, all cards have hardware protection to prevent software
  18. from destroying them, it isn't always true. Anything you do is purely at
  19. your own risk. Don't come crying on my shoulder, "I tried this on my
  20. Hercules card and the monitor imploded and blew a hole in Mom's favorite
  21. painting and opened a space-time door to Venus." Because you have been
  22. warned.
  23.  
  24. Many thanks to Shai-Hulud, #1 @3101, for pointing out the flaws in the
  25. previous version of this particualr piece of code. I slightly changed his,
  26. so you are not required to have TASM to compile this. Instead, I just
  27. called the interrupts directly from C.
  28. Of course, now that I am using his code, it does not correctly turn the
  29. cursor on. So, I adapted a Pascal routine I had used in a different program
  30. to turn the cursor on, regardless of the display type.
  31.  
  32. By the way, this works on my machine...as to yours....well, good luck.
  33.  
  34. Now, on with the mod.
  35.  
  36. 1. Load up Turbo C. Hit Alt-F for the file menu, and select new.
  37. Block read in this stuff, EGA.C
  38.  
  39. --------------------------ega.c------------------------------------------
  40. /*   ega.c */
  41.  
  42. #include <dos.h>
  43. #include <conio.h>
  44.  
  45. extern void outs(char *s);
  46.  
  47. void cursoron()
  48. {
  49. union REGS regs;
  50. int a,c;
  51.  
  52.   regs.x.ax=0x1a00;
  53.   int86(0x10,®s,®s);
  54.   if (regs.h.al==0x1a)
  55.   {
  56.     switch (regs.h.bl)
  57.     {
  58.       case 0: a=0;
  59.               break;
  60.       case 1: a=2;
  61.               break;
  62.       case 2: a=1;
  63.               break;
  64.       case 4:
  65.       case 5:
  66.       case 7:
  67.       case 8:
  68.       case 0x0a:
  69.       case 0x0c:
  70.       case 0x0b: a=3;
  71.                  break;
  72.     }
  73.   }
  74.   else
  75.   {
  76.     regs.h.ah=0x12;
  77.     regs.x.bx=0x10;
  78.     int86(0x10,®s,®s);
  79.     if (!(regs.x.bx==0x10))
  80.       a=3;
  81.     else
  82.     {
  83.       int86(0x11,®s,®s);
  84.       if (((regs.h.al & 0x30) >> 4)==3)
  85.         a=2;
  86.       else
  87.         a=1;
  88.     }
  89.   }
  90.  
  91.   switch (a)
  92.   {
  93.     case 1:  c=8;
  94.              break;
  95.     case 2:  c=14;
  96.              break;
  97.     default:{
  98.              regs.x.ax=0x1130;
  99.              regs.h.bl=0;
  100.              int86(0x10,®s,®s);
  101.              c=regs.x.cx;
  102.             }
  103.   }
  104.   pokeb(0x40,0x87,(peekb(0x40,0x87) | 0x01));
  105.   regs.x.ax=0x0100;
  106.   regs.h.ch=c-3;
  107.   regs.h.cl=c-1;
  108.   int86(0x10,®s,®s);
  109.  
  110. }
  111.  
  112.  
  113. void set_43()  {
  114.  
  115. union REGS regs;
  116. char temp;
  117.  
  118. regs.x.ax=0x1112;
  119. regs.h.bl=0;
  120. int86(0x10,®s,®s);
  121. regs.x.ax=0x0100;
  122. regs.x.cx=0x0607;
  123. int86(0x10,®s,®s);
  124. cursoron();
  125. }
  126.  
  127.  
  128. void set_25()
  129. {
  130. union REGS regs;
  131. char temp;
  132.  
  133. regs.x.ax=0x3;
  134. int86(0x10,®s,®s);
  135. cursoron();
  136. }
  137.  
  138. void clearbottom()
  139. {
  140. int i;
  141. /* cheap fix for this for now....should be better soon */
  142. outs("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  143. clrscr();
  144. }
  145.  
  146. -----------------------------------------------------------------------------
  147.  
  148. Now, hit Alt-F again, and select Write To. Call the file EGA.C.
  149.  
  150. Step 2. Load up FCNS.H. Add this to the file somewhere, I just put
  151. it at the top.
  152.  
  153.  
  154.  
  155. /*   ega.c   */                   /* add this line */
  156. void set_43();                    /* add this line */
  157. void set_25();                    /* add this line */
  158. void clearbotom();
  159.  
  160. /*  CONNECT1.C  */
  161. void read_call_out_list();
  162. void write_call_out_list();
  163. void read_bbs_list();
  164.  
  165. (By the way, a good tip, which I have mailed off to Wayne Bell.
  166. Print out FCNS.H.
  167. Each block of functions corresponds to one source code file.
  168. Load up each one of the C source files, and figure out which block goes
  169. with which file, and label it in FCNS.H. Then, print it out again. Then,
  170. when you are looking for a function, just look on your printout, and the
  171. comment at the top of the block will tell you which file it is in.)
  172.  
  173. Step 3. Load up BBS.C. Scan down to void end_bbs. Add this line.
  174.  
  175.   outs(VERSION_NUMBER);
  176.   outs(" run complete.\r\n\r\n");
  177.   set_25();             /** add me **/
  178.   exit(lev);
  179.  
  180.  
  181.  
  182. Step 4. Scan down to void main, and add this line.
  183.  
  184.  
  185.     case 'M':
  186.           ok_modem_stuff=0;
  187.           break;
  188.       }
  189.     }
  190.   }
  191.  
  192.   set_43();       /* add me please */
  193.   init(1);
  194.  
  195.  
  196.   if (restoring_shrink) {
  197.     restoring_shrink=0;
  198.  
  199.  
  200.  
  201. Step 5. Load up EXTRN.C, and look for do_it. Add these lines there.
  202.  
  203.     if (s[i1]==32) {
  204.       s[i1]=0;
  205.       ss[i++]=&(s[i1+1]);
  206.     }
  207.   ss[i]=NULL;
  208.   clearbottom();           /** add me **/
  209.   i=spawnvpe(P_WAIT,ss[0],ss,xenviron);
  210.   set_43();                /** add me **/
  211.   return(i);
  212. }
  213.  
  214.  
  215.  
  216. Step 7. If you are compiling from the editor/compiler,
  217. then load up your project file (BBS.PRJ). Add this line...
  218.  
  219. connect1.c    (fcns.h, vardec.h, net.h)
  220. sr.c        (fcns.h, vardec.h)
  221. xfer.c        (fcns.h, vardec.h)
  222. bbsutl.c    (fcns.h, vardec.h)
  223. bbsutl1.c    (fcns.h, vardec.h)
  224. utility.c    (fcns.h, vardec.h)
  225. com.c        (fcns.h, vardec.h)
  226. conio.c        (fcns.h, vardec.h)
  227. extrn.c        (fcns.h, vardec.h)
  228. newuser.c    (fcns.h, vardec.h)
  229. msgbase.c    (fcns.h, vardec.h)
  230. msgbase1.c    (fcns.h, vardec.h, net.h)
  231. sysopf.c    (fcns.h, vardec.h)
  232. sysopf1.c    (fcns.h, vardec.h, net.h)
  233. /* add the line below, but not the comment */
  234. ega.c
  235. bbs.c        (fcns.h, vardec.h, vars.h, net.h)
  236. shrink.c        (fcns.h, vardec.h)
  237.  
  238.  
  239.  
  240. Step 8. If you are using the Make utility, you will need to make
  241. these changes. First, load up Makelf.bat, and add ega to one of the lines...
  242. Mine looks like this now. Don't just copy this into yours, I have a few other
  243. things in there that will screw you up. Just make sure you add +%2ega.obj
  244. to one of the lines.
  245.  
  246.  
  247. echo off
  248. echo (Re-)creating linkfile...
  249. echo %1\lib\c0l.obj+%2bbs.obj+%2bbsutl.obj+ > linkfile
  250. echo %2com.obj+%2conio.obj+%2connect1.obj+ >> linkfile
  251. echo %2msgbase.obj+%2msgbase1.obj+ >> linkfile
  252. echo %2shrink.obj+%2sr.obj+%2sysopf.obj+ >> linkfile
  253. echo %2utility.obj+%2xfer.obj+%2wwivbank.obj+ >> linkfile
  254. echo %2ega.obj+%2bbsutl1.obj+%2extrn.obj+ >> linkfile
  255. echo %2newuser.obj+%2sysopf1.obj+%2sysopf2.obj >> linkfile
  256.  
  257. Now, load up makefile.mak, and make a few changes there. There should be
  258. a block that looks like this. Once again, do not just copy this one in, just
  259. add what I tell you to.
  260.  
  261. $(EXE)bbs.exe: $(OBJ)bbs.obj $(OBJ)bbsutl.obj $(OBJ)bbsutl1.obj $(OBJ)com.obj\
  262.                $(OBJ)conio.obj $(OBJ)connect1.obj $(OBJ)extrn.obj\
  263.                $(OBJ)msgbase.obj $(OBJ)msgbase1.obj $(OBJ)newuser.obj\
  264.                $(OBJ)shrink.obj $(OBJ)sr.obj $(OBJ)sysopf.obj\
  265.                $(OBJ)sysopf1.obj $(OBJ)sysopf2.obj $(OBJ)utility.obj\
  266.            $(OBJ)xfer.obj $(OBJ)wwivbank.obj $(OBJ)ega.obj linkfile
  267.   tlink /c @linkfile,$(EXE)bbs,bbs.map,$(TC)\lib\$(LIB87)+$(TC)\lib\mathl+$(TC)\lib\cl
  268.  
  269. Somewhere after the $(EXE)bbs.exe: and before the line that says tlink, add
  270.  
  271.   $(OBJ)ega.obj
  272.  
  273.  
  274. If it is at the end of a line, but not the last line before the tlink,
  275. put a backslash after it  like this
  276.  
  277.   stuff stuff stuff $(OBJ)ega.obj\
  278.   more stuff more stuff
  279.  
  280. Now go down to the bottom of the file, and add these two lines. It is
  281. important to put two spaces at the front of the second line.
  282.  
  283. $(OBJ)ega.obj : ega.c
  284.   $(TCC)
  285.  
  286. That should take care of it.
  287.  
  288.  
  289.  
  290.  
  291. That's about it. Just re-compile the BBS.
  292.  
  293. Some problems I am having.
  294. 1. 2-way chat only uses the top 25 lines. Looks shitty, but I can live
  295.    with it.
  296. 2. Some games re-set the screen, some don't. I tried putting a call to
  297.    set_25 in before the chain was run. The screen re-set to 25 lines, but
  298.    the games tried to use all 43 lines, which meant it scrolled off the bottom
  299.    of my monitor. Made it VERY hard to read the game.
  300. 3. Now switches reliably to 25 line mode when the BBS quits, but does not
  301.    reliably restore the cursor.
  302.  
  303. The advantages to doing this.
  304. 1. Allows BoardEdit, Diredit, Chainedit, and Gfileedit to use all 43 lines,
  305.    which makes editing much easier.
  306. 2. Long messages (like this one) don't scroll off the screen nearly as fast.
  307. 3. Just looks neat.
  308.  
  309. Also, be aware that the screen will flash when it switches modes. This is
  310. normal, IF YOU HAVE AN EGA/VGA card. If not, you shouldn't have put this in,
  311. and that screen flashing was probably the card melting. If you do have
  312. EGA/VGA, then the flash is due to the card momentarily switching modes to
  313. reset itself.
  314.  
  315. WARNING: If after reading all this, you don't want to chance things,
  316. then just leave it alone, and hope Turbo C comes with a standard way to turn
  317. on 43 line mode (which I have not found, let me know if there is).
  318.  
  319.  
  320. If you use this, the only payment I ask is that you send me a
  321. note through WWIVNet to 1@8251 saying you are using it...not too much to
  322. ask is it?
  323.  
  324. If you have any problems, you can reach me through WWIV-Net, 1@8251, or call
  325. my BBS.
  326. The Kingdom of Melnibone
  327. 812-877-3488  24 Hrs a day
  328. 3/12/2400/4800/9600/12,000/14,400 baud HST MNP5
  329. Auto-validation of WWIV sysops on first call
  330. Xmodem, Ymodem, DSZ Zmodem with retry, Ymodem-G, Y/Z/Y-G batch
  331.  
  332. Lord Elric
  333.  
  334.