home *** CD-ROM | disk | FTP | other *** search
/ Executor 2.0 / executorv2.0.iso / pc / linux / extra / docs / maillist / text / archive.95 / text2366.txt < prev    next >
Encoding:
Text File  |  1996-04-02  |  8.2 KB  |  172 lines

  1. >>>>> "Colin" == Colin Irwin <cirwin@extro.ucc.su.OZ.AU> writes:
  2.  
  3.     Colin> However, when I ran Maelstrom (I know, I'm still trying to
  4.     Colin> get it to work :-)) it started fine but was extremely
  5.     Colin> jerking in gameplay. Now my question is this: Is there
  6.     Colin> something worng with my general setup, or is it a graphics
  7.     Colin> based problem (as I don't have an accelerated graphics
  8.     Colin> card).
  9.  
  10. If you're running under DOS, the short answer is "download and install
  11. UniVBE 5.1a, and run Executor under plain DOS" for your best chance of
  12. making Maelstrom run fast.  UniVBE is widely available; you may want
  13. to download it directly from the authors at ftp.scitechsoft.com.
  14.  
  15. The rest of this letter is a detailed explanation of what's going on.
  16. It's probably far more detail than you ever wanted, but others on this
  17. list may be interested.
  18.  
  19. The problem is that Maelstrom bypasses Quickdraw and writes directly
  20. to screen memory, which can force many Executor setups to run in a
  21. slower compatibility mode.
  22.  
  23. There are two graphics modes in which Executor can run:
  24.  
  25.    1) The "screen" presented to the app being emulated (e.g. Maelstrom)
  26.       is in fact the real hardware screen.  Pixels written to this
  27.       memory will instantly appear on the screen.
  28.  
  29.    2) The "screen" presented to the app is actually just normal RAM.
  30.       Special Executor code periodically copies rectangles from this
  31.       RAM to the real display.
  32.  
  33. (1) is *MUCH* faster than (2), so of course we always try to use mode
  34. (1) when possible.  Of course, it's often not possible.  For example,
  35. under X11 we are not able to get direct access to screen memory, and
  36. instead have to use X11 calls to copy rectangles to the screen.
  37.  
  38. In your case, your machine is running Maelstrom in mode (2), so it's
  39. really slow.  To make it run in mode (1) you need a VBE 2.0-compatible
  40. video driver, such as UniVBE 5.1a.  Of course, it's possible that
  41. UniVBE doesn't support your video card, in which case you won't be
  42. able to get mode (2) until we port to Win32/DirectDraw (assuming
  43. DirectDraw does what we want).
  44.  
  45. For normal programs that use Quickdraw (i.e. make toolbox calls to
  46. draw to the screen), Executor notes what parts of the screen have
  47. changed.  When it comes time to update the "real" screen, Executor
  48. knows how what changed so it only copies some minimal "dirty
  49. rectangles" from its internal screen to the real screen.
  50.  
  51. When programs bypass Quickdraw and write directly to screen memory,
  52. Executor has no easy way of knowing which pixels on the "real" screen
  53. are outdated.  Executor switches into a slow "refresh mode" where it
  54. does one of two things:
  55.  
  56.    A) Periodically compare the current internal screen to the last one
  57.       displayed, identify the smallest rectangle that encloses all
  58.       changed pixels, and copy that rectangle to the screen.
  59.  
  60.    B) Periodically copy the entire internal screen to the real screen,
  61.       and don't bother trying to figure out which pixels have changed.
  62.  
  63. Both will be fairly slow and lurchy.
  64.  
  65. So right now you're in mode (2) and you'd really like to be in mode
  66. (1).  Maelstrom blazes when it gets to write directly to your SVGA
  67. card's VRAM.  Unfortunately, DOS makes supporting this mode extremely
  68. difficult.
  69.  
  70. Many games originally written for the Macintosh expect that screen
  71. memory is a contiguous sequence of bytes, and that they can plot
  72. pixels at any location on the screen by writing to the appropriate
  73. memory location.  Unfortunately, because of the infamous 640K
  74. limitation on the 80286, the original SVGA boards could only make a
  75. 64K "window" into screen memory available at any given time.  This
  76. window could be "repositioned" to correspond to various places on the
  77. screen, but could not be enlarged.
  78.  
  79. Of course, most 256 color screens take much more than 64K.  For
  80. example, a 640x480x256 screen takes 300K.  DOOM uses a 320x200x256
  81. screen, which takes less than 64K and thus avoids many of the
  82. headaches that Executor encounters.
  83.  
  84. Anyway, back to our story.  Some programs originally written for the
  85. Mac expect a big block of memory to correspond to the screen.  Under
  86. the old svga model, there is no such block of memory for screens that
  87. take more than 64K.
  88.  
  89. Fortunately, with the advent of the 32-bit 80386, most svga boards
  90. gained a "linear frame buffer" option, which can give programs a
  91. single contiguous block of memory for the entire screen.  Yay.  This
  92. is exactly what we want.
  93.  
  94. The specifics of how to turn on "linear mode" vary by SVGA chipset.
  95. In general, these board-specific differences are handled by the video
  96. driver, so programs need not concern themselves with the details of
  97. every board ever made.
  98.  
  99. Unfortunately, the ROMs on most boards only support the "VBE 1.2"
  100. standard (VESA BIOS Extensions 1.2), which predates the widespread use
  101. of linear frame buffers and provides no way for programs to use them.
  102. VESA addressed this with the VBE 2.0 standard, which also allows
  103. programmers to take advantage of 8-bit DACs and do certain things more
  104. quickly in protected mode programs.
  105.  
  106. VBE 2.0 isn't built in to many boards, but UniVBE 5.1a knows how to
  107. provide a VBE 2.0 driver interface for most boards.  When UniVBE is
  108. installed on a well-supported board that actually has the hardware
  109. capability for linear frame buffers, Executor can enable linear frame
  110. buffer mode for faster graphics.
  111.  
  112. You hoped my explanation was complete and this letter was coming to an
  113. end, but nay.  There's more.
  114.  
  115. I'm sure you've stayed awake nights wondering how protected mode
  116. programs allocate memory from the system, patch into hardware
  117. interrupts, etc.  These days the standard way to do it is for the
  118. program to talk to a "DPMI server" which manages those resources.
  119. Windows, Warp, and DOSEMU all provide DPMI servers.  DOS does not,
  120. although several are available.  Executor/DOS comes with cwsdpmi.exe,
  121. a free DPMI server written by Charles Sandmann.  It only gets used
  122. when no other DPMI server is present.
  123.  
  124. The original DPMI standard was DPMI 0.9.  It provided enough basic
  125. mechanisms for unsophisticated programs to run well.  However, its
  126. limitations eventually resulted in the DPMI 1.0 standard.  DPMI 1.0
  127. provides programs with powerful new ways to manipulate virtual memory.
  128.  
  129. One important thing that DPMI 1.0 lets programs do is map physical
  130. memory into their address space.  Executor uses this feature, when
  131. available, to map a linear frame buffer into our address space.
  132. Without this feature, Executor needs a "far pointer" to reference even
  133. a linear screen, and so that memory cannot be made available to the
  134. application being emulated.
  135.  
  136. However, VBE 2.0 + DPMI 0.9 is still fast for programs that don't
  137. bypass Quickdraw, since our blitter knows how to draw directly to
  138. screen that requires a far pointer (a segment override).  On this
  139. setup, we don't keep a RAM virtual screen lying around in some
  140. graphics modes.  Our blitter just draws directly to the SVGA board.
  141.  
  142. Amazingly, Windows 3.1 and Windows '95 only provide DPMI 0.9!  I'm not
  143. sure about WinNT, but I'd guess it also provides 0.9.  OS/2 Warp
  144. provides something they call DPMI "0.95", but I haven't been able to
  145. get the DPMI 1.0 features I need (mostly DPMI function 0x508) to work
  146. under Warp.
  147.  
  148. In fact, there are very few DPMI 1.0 servers out there.  Fortunately,
  149. after ARDI and Id Software begged the author we were able to get
  150. cwsdpmi.exe to provide the DPMI 1.0 features we need to map the frame
  151. buffer into our address space.  Games like Maelstrom, Apeiron,
  152. Solarian, Space Madness, etc. *blaze* under DOS + UniVBE 5.1a.  But if
  153. you run under Windows or Warp, or you don't have a VBE 2.0 compatible
  154. driver, or your svga board doesn't support linear frame buffers, these
  155. games will be slow and lurchy.
  156.  
  157. After Executor 2 comes out, we plan to port Executor to Win32.  I have
  158. not yet read the documentation for Microsoft's "DirectDraw" package,
  159. but it sounds like it may give us the best of all worlds for Windows
  160. users.  Warp has something called DIVE which may provide similar
  161. functionality.  NEXTSTEP has Interceptor.  And then there's SciTech's
  162. "WinDirect" package, which allows Windows programs to shut down the
  163. Windows GDI and take over the entire screen.  That, combined with
  164. SciTech's UniVBE 5.2 (which will support the VBE/AF hardware
  165. acceleration video driver standard on some boards) might also make for
  166. a blazing Executor.
  167.  
  168. If you've read this far, I'm impressed.  :-)
  169.  
  170. -Mat
  171.  
  172.