home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / s / surfemu3.zip / EMULATT.PAS < prev    next >
Pascal/Delphi Source File  |  1988-02-02  |  8KB  |  167 lines

  1. {$R-,S-,I-,D-,T-,F+,V-,B+,N-,L+ }
  2. {$M 1024,0,0}
  3.  
  4. program EmulATT;
  5. uses dos;
  6. { Copyright 1988 University of Saskatchewan Computing Services }
  7. { All rights reserved                                          }
  8.  
  9.  
  10. {**************************************************************************}
  11. { Program Name : EMULATT                                                   }
  12. { VERSION:       1.00c (Completed)                                         }
  13. { DATE:          02 February 1988                                          }
  14. { Author:        Kevin Lowey                                               }
  15. {                Department of Computing Services                          }
  16. {                Room 56 Physics Building                                  }
  17. {                University of Saskatchewan                                }
  18. {                Saskatoon Saskatchewan                                    }
  19. {                S7N 0W0                                                   }
  20. {                                                                          }
  21. {                LOWEY@SASK.BITNET                                         }
  22. {                ...!ihnp4!sask!lowey.uucp                                 }
  23. {                Phone: (306) 966-4826                                     }
  24. {                                                                          }
  25. { Description:                                                             }
  26. {                                                                          }
  27. { This program is a memory resident (TSR) utility which makes the VAXmate  }
  28. { 640x400x2 graphics mode emulate the AT&T 640x400x2 graphics mode.  The   }
  29. { only difference between the AT&T and VAXmate is that the mode number used}
  30. { by the SET MODE function (Interrupt $10 function $00) and the REPORT MODE}
  31. { function (Interrupt $10 function $F0) is $D0 in the VAXmate and $40 in   }
  32. { the AT&T 6300 (Olivetti). The memory map, etc. are all identical.        }
  33. {                                                                          }
  34. { This emulation allows software which supports the AT&T computer to use   }
  35. { the high resolution 640x400x2 mode on the VAXmate, even if the VAXmate   }
  36. { is not supported by the software.  Simply tell the software it is using  }
  37. { an AT&T graphics display.                                                }
  38. {                                                                          }
  39. { This program finds an empty interrupt vector, and moves interrupt $10    }
  40. { into this unused vector.  It then places its own procedure (INT10HANDLER)}
  41. { into interrupt $10.  INT10HANDLER passes all $10 interrupt calls to the  }
  42. { "real" interrupt $10.  If function $00 or $F0 is called, INT10HANDLER    }
  43. { substitutes the VAXmate $D0 graphics mode for the AT&T $40 mode number.  }
  44. {                                                                          }
  45. { This can cause problems if software expecting to see the AT&T mode number}
  46. { (like the AT&T graphics.com program) receives the VAXmate mode number.   }
  47. { Thus I also implemented the following extra functions for interrupt $10  }
  48. {                                                                          }
  49. {  Registers                          Description                          }
  50. {  AX = $FF00      Signature function.  Returns $FF42 if EMULATT is loaded }
  51. {  AX = $FF01      Makes function $F0 return the AT&T $40 mode, not $D0    }
  52. {  AX = $FF02      Makes function $F0 return the VAXmate $D0, not $40      }
  53. {                  This is the default setting                             }
  54. {  AX = $FF03      Returns AX=$FF40 if ATTMODE set, AX=$FFD0 if not set    }
  55. {                                                                          }
  56. { The companion program EMATTSET uses the above interrupts to change how   }
  57. { EMULATT behaves.                                                         }
  58. {**************************************************************************}
  59.  
  60. var
  61.     int10save : pointer;        {Saves a pointer to the old INT10 routine}
  62.     regs      : registers;      {registers for INTR function}
  63.     oldah     : byte;           {Stores AH so appropriate actions can be }
  64.                                 {taken after calling INT10               }
  65.  
  66. CONST
  67.     newintr   : byte = $59;      {Starting interrupt to install in          }
  68.     ATTmode   : boolean = FALSE; {True if function $0F returns AT&T mode $40}
  69.                                  {False if function $0F returns DEC mode $D0}
  70.     VERSION   = '1.00c';
  71.     VERSDate  = '02 Feb. 1988';
  72.  
  73. procedure INT10HANDLER (FLAGS,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP:word);
  74. interrupt;
  75.  
  76. begin {INT10HANDLER}
  77.   { Process My extensions to the interrupt, function $FFxx }
  78.  
  79.   { Return signature }
  80.   if AX = $FF00  then
  81.     ax := $FF42 {Why 42? read Hitchiker's Guide to the Galaxy :-)}
  82.  
  83.   {Make function $0F (what mode are you in) say AT&T if applicable}
  84.   else if AX = $FF01 then begin
  85.     ATTMODE := TRUE;
  86.     AX := $FFFF
  87.   end
  88.  
  89.   {Make function $0F (what mode are you in) say VAXmate if applicable}
  90.   else if AX = $FF02 then begin
  91.     ATTMODE := false;
  92.     AX := $FFFF;
  93.   end
  94.  
  95.   else if AX = $FF03 then begin  {return current setting of ATTMODE}
  96.     IF ATTMODE then
  97.       AX := $FF40  {AT&T mode}
  98.     else
  99.       AX := $FFD0  {VAXmate mode}
  100.   end
  101.  
  102.   { Call normal interrupt $10 routines }
  103.   else begin
  104.  
  105.     {trap AT&T enter hires mode $40 interrupt and change to DEC's $D0}
  106.     if ax = $0040 then begin {AT&T 640x400x2}
  107.       regs.ax := $00D0 {Vaxmate AT&T compatible mode}
  108.     end
  109.     else {Don't do anything special}
  110.       regs.aX := AX;
  111.  
  112.     {save the old function number so we can check for modification}
  113.     {of returned parameters later}
  114.     oldah := regs.ah;
  115.  
  116.     {Put the parameters into the registers}
  117.     regs.bx := BX;
  118.     regs.cx := CX;
  119.     regs.dx := DX;
  120.     regs.es := es;
  121.     regs.bp := bp;
  122.  
  123.     {Call the interrupt}
  124.     intr (newintr,regs);
  125.  
  126.     { If the function is $0F (what mode are you in), and we are in the DEC }
  127.     { 640x200x2 mode, and the ATTMODE switch is set, then return $40, the  }
  128.     { equivalent AT&T mode.  This is so programs which ask what mode you   }
  129.     { are in, like GRAPHICS.COM, will operate properly.  The default is to }
  130.     { return the DEC mode, so that DEC's GRAPHICS.COM program will work.   }
  131.  
  132.     if (ATTMODE) and (oldah = $0F) and (regs.al = $D0) then {Return AT&T}
  133.       regs.al := $40;  {AT&T equivalent mode }
  134.  
  135.     {Move the register results back to the parameters}
  136.     ax := regs.ax;
  137.     bx := regs.bx;
  138.     cx := regs.cx;
  139.     dx := regs.dx;
  140.   end; {else call old interrupt }
  141. end; {INT10HANDLER}
  142.  
  143. begin {EMULATT}
  144.   Writeln ('AT&T Graphic emulator for the Vaxmate');
  145.   Writeln ('Version ',version,', ',versdate);
  146.   writeln ('Copyright 1988 University of Saskatchewan');
  147.   { Check to see if already installed }
  148.   regs.ax := $FF00;
  149.   intr($10,regs);
  150.   if regs.ax = $FF42 then begin {Signature found}
  151.     writeln ('EMULATT already installed, Aborting');
  152.     halt(1);
  153.   end
  154.   else begin {install}
  155.     {find a free interrupt}
  156.     newintr := $5F; {first application available interrupt}
  157.     repeat
  158.       newintr := succ(newintr);
  159.       getintvec(newintr,int10save);
  160.     until byte(int10save^) = $CF; {interrupt return}
  161.  
  162.     getintvec ($10,int10save);
  163.     setintvec (newintr,int10save);
  164.     setintvec ($10,@int10handler);
  165.     keep (0);
  166.   end; {install}
  167. end. {EmulATT}