home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PAGES.ZIP / PAGES.DOC next >
Text File  |  1988-10-20  |  4KB  |  82 lines

  1.                 OS/2 VIDEO PAGES
  2.  
  3.     This program runs under OS/2 and DOS, and demonstrate the use
  4. of video paging under both operating systems.
  5.  
  6.     The OS/2 programming API did not go overboard in its support of 
  7. advanced VGA features, such as video paging, and the VIO subsystem for
  8. IBM ver. 1.0 does not support paging at all.
  9.  
  10.     Also, OS/2 is much more aggressive in its management and structure
  11. of memory than was DOS, not to mention the fact that you cannot directly
  12. address the VGA card's registers at all from ring 3 applications level.
  13.  
  14.     There are two basic barriers to low level video programming under
  15. OS/2:  (1) you must get access to the video buffer ram, and OS/2 has 
  16. various requirements that you must meet, but ultimately you can do it
  17. from ring 3, and (2) you must get access to the VGA registers, and you 
  18. cannot do this from ring 3, but must write a DLL - like a companion prog-
  19. ram to your main .exe file - which runs in ring 2 and which contains 
  20. routines that your program can call.
  21.  
  22.     The next thing you have to consider is how aggressive you want
  23. to be in dealing with the OS.  Under DOS, or more correctly, under the IBM
  24. BIOS ROM, you get 8 video pages supported with the VGA.  I was inspired to
  25. do this program by an article by Abrash, Vol 6.5 Programmer's Journal pg 22
  26. (1988) where he presented a program for DOS that got up to 32 pages with the
  27. VGA !  I wondered how many pages OS/2 would allow, so here it is.  Under OS/2
  28. you get none explicitly, but if you are clever, you can get at least 8, and
  29. as this program shows, you can get 15 with a little work.  
  30.  
  31.     For various reasons, I was unable to get nearly as many pages out
  32. of OS/2 as Abrash got from DOS.  It seems like OS/2 simply reserves parts of
  33. the video buffer to itself, it is not just the tabla rasa that it was under
  34. DOS.  It appears that you get 4 usable pages, then 4 unusable, then 4 usable,
  35. etc.
  36.  
  37.     I used the same techniques that he used, relocating the text buffer
  38. to 0A000H from 0B800H, getting 64 K ram instead of 32 K, and flipping the
  39. page bit in the miscellaneous register.  I got all of these techniques to
  40. work but not as freely as they did under DOS.  Thus, some of the program
  41. is devoted to avoiding unusable memory and making this technique look
  42. mor or less practical.  I actually don't like writing directly to the 
  43. video buffer myself.
  44.  
  45.     This program is presented as a demo of possibilities for page
  46. flipping under OS/2, and not as a full fleged utility.
  47. I left the Codeview material in it, so you can run it thru CVP (if nothing
  48. else, it shows the way CVP handles direct screen writes).   I originally had
  49. the code for locking the screen in the program, but it works better if you
  50. do not lock the screen. 
  51.  
  52.     One thing I had hoped was that by relocating the video buffer, any
  53. direct screen writes by the program would not 'bleed' over into other screen
  54. groups, a bug that presently affects OS/2 (notably the M editor).
  55.  
  56.     I also replaced the stub loader with Abrash's program (I added an
  57. ESC key exit to his), so you can run this under DOS and see what it looks
  58. like to get 32 pages.
  59.  
  60.     To run this program, copy xpage.dll to the directory that contains
  61. your dll files ( c:\os2 by default ) before running the program, and put the
  62. statement "iopl=yes" into your config.sys. To see the code, have xpage.dll 
  63. and pages.exe in the same directory, and load them into CVP with this command 
  64. line: "cvp /L xpage.dll pages".
  65.     
  66.     If you have any questions or comments, I can be reached at: 
  67. Compuserve 72261,347.
  68.  
  69.     =Harve=
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.     
  77.  
  78.  
  79.  
  80.  
  81.  
  82.