home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / msdos / programm / 39 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  2.3 KB

  1. Xref: sparky comp.msdos.programmer:39 comp.graphics:9016 comp.sys.ibm.pc.programmer:345
  2. Path: sparky!uunet!seismo!darwin.sura.net!nih-csl!alw.nih.gov!gregh
  3. From: gregh@alw.nih.gov (Gregory Humphreys)
  4. Newsgroups: comp.msdos.programmer,comp.graphics,comp.sys.ibm.pc.programmer
  5. Subject: Direct SVGA memory access
  6. Message-ID: <1992Aug20.141357.20611@alw.nih.gov>
  7. Date: 20 Aug 92 14:13:57 GMT
  8. Sender: postman@alw.nih.gov (AMDS Postmaster)
  9. Organization: National Inst. of Health, DCRT, CSL
  10. Lines: 74
  11.  
  12. Okay.  I want to write to SVGA memory without using BIOS calls on my 486.  I can do it great with int 10, but it's slow as all hell.  What is happening is after I calculate the address for the VRAM, everything is getting modded into the top 64k of VRAM (one display pages worth, I guess).  Imagine the 1024x768x256 screen sectioned into 12 horizontal bars, and anything that you write is put into the TOP one.  ANyhow, I think this is because I'm not changing display pages.  So I tried Three things:
  13.  
  14. 1)
  15.  
  16. void Plot(x,y,Color)
  17. int x,y,Color
  18. {
  19.  
  20.     int Page
  21.     long offset;
  22.     char far *address;
  23.  
  24.     Page = y/64;
  25.     outport(0x3CD,Page);
  26.  
  27.     offset = 1024*y + x;
  28.     address = (0xA0000000L + offset);
  29.     *address = Color;
  30. }
  31.  
  32.  
  33. 2) 
  34.  
  35.  
  36. void Plot(x,y,Color)
  37. int x,y,Color
  38. {
  39.  
  40.     int Page
  41.     long offset;
  42.     char far *address;
  43.     char far *PageAddress;
  44.  
  45.     Page = y/64;
  46.     PageAddress = MK_FP(0000,0x462); /* The Low Memory address of the current
  47.                         Page Number */
  48.  
  49.     *PageAddress = Page;    
  50.  
  51.     offset = 1024*y + x;
  52.     address = (0xA0000000L + offset);
  53.     *address = Color;
  54. }
  55.  
  56. 3)
  57.  
  58. void Plot(x,y,Color)
  59. int x,y,Color
  60. {
  61.  
  62.     int Page
  63.     long offset;
  64.     char far *address;
  65.     
  66.     Page = y/64;
  67.     
  68.     _AH = 5;
  69.     _AL = Page;
  70.  
  71.     geninterrupt(0x10);
  72.  
  73.     offset = 1024*y + x;
  74.     address = (0xA0000000L + offset);
  75.     *address = Color;
  76. }
  77.     
  78. The Third one at least gave me some results - everything I had drawn got moved to the bottom half of the screen and above it was about 300 horizontal blue bars that flickered a lot.  Any ideas?  This is a Trident 8900 card w/ 1 meg VRAM on a 486/33 using Borland C++ 3.0.  HELP ME DAMMIT!  Can you tell I'm frustrated? YES!!!!
  79.  
  80.  
  81. -- 
  82. Greg Humphreys    |  "Playing not to win is like sleeping with your 
  83. gregh@alw.nih.gov |  sister - sure, she's a great piece of tail, 
  84.                   |  and she's got a bag full of goodies, but it's 
  85. (301) 402-1817    |  just plain illegal."  -Charlie Sheen, "Hotshots"
  86.