home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18682 < prev    next >
Encoding:
Text File  |  1992-11-19  |  2.4 KB  |  75 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!apple!mumbo.apple.com!gallant.apple.com!seuss.apple.com!user
  3. From: absurd@apple.apple.com (Tim Dierks, software saboteur)
  4. Subject: Re: Is this a BaseAddress problem with the Quadra .?.?.?.
  5. Sender: news@gallant.apple.com
  6. Message-ID: <absurd-191192162053@seuss.apple.com>
  7. Date: Fri, 20 Nov 1992 00:38:14 GMT
  8. References: <1992Nov18.232653.13027@news.vanderbilt.edu>
  9. Organization: MacDTS Marauders
  10. Followup-To: comp.sys.mac.programmer
  11. Lines: 62
  12.  
  13. In article <1992Nov18.232653.13027@news.vanderbilt.edu>,
  14. BLOOMDA@ctrvax.vanderbilt.edu (_creative_output_) wrote:
  15. > 8-bit mode.  That's when I learned about incorporating the slot
  16. > number of the video card into the base address:
  17. >      ( ( baseAddr >> 24 ) | something ) << 20 | baseAddr, or somesuch
  18. > - Dave    =(^;|=                Dave Bloom, JSPS
  19. >                     bn: bloomda@vuctrvax
  20. >                     in: bloomda@ctrvax.vanderbilt.edu
  21. > "Mekka Lekka Hai, Lekka Heinie Ho"
  22.  
  23. Here's the right way to get the slot number of a monitor, given its
  24. GDevice:  (as a bonus, this also gets the name of the card in
  25. question; to just get the slot, chop off all the lines after the
  26. *slot = ... line.
  27.  
  28. OSErr
  29. GetSlotAndName(GDHandle gDev,short *slot,char *name)
  30. {   OSErr       err;
  31.     short       refNum;
  32.     SpBlock     spb;
  33.     
  34.     refNum = (**gDev).gdRefNum;    // video driver refNum for this GDevice
  35.     *slot = (**(AuxDCEHandle)GetDCtlEntry(refNum)).dCtlSlot;
  36.                                    // slot in which this video card sits
  37.     
  38.     spb.spSlot = *slot;         // In the slot we're interested in
  39.     spb.spID = 0;
  40.     spb.spExtDev = 0;
  41.     spb.spCategory = 1;         // Get the board sResource
  42.     spb.spCType = 0;
  43.     spb.spDrvrSW = 0;
  44.     spb.spDrvrHW = 0;
  45.     spb.spTBMask = 0;
  46.     
  47.     err = SNextTypeSRsrc(&spb);
  48.     if (err)
  49.         return err;
  50.     
  51.     
  52.     spb.spID = 2;               // Getting the description string
  53.                                 // spSPointer was set up by
  54. SNextTypesResource
  55.     err = SGetCString(&spb);
  56.     if (err)
  57.         return err;
  58.     
  59.     strcpy(name,(char *)spb.spResult);  // Get the returned string
  60.     DisposPtr((Ptr)spb.spResult);    // Undocumented; we have to dispose of
  61. it
  62.     
  63.     c2pstr(name);
  64.     
  65.     return noErr;
  66. }
  67.  
  68. You should also be very careful to use SwapMMUMode() to switch into
  69. 32-bit mode any time you write to the framebuffer, regardless of what
  70. bitdepth it is at.
  71.  
  72. Tim Dierks
  73. MacDTS, but what?
  74.