home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20918 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  3.7 KB

  1. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!rpi!gatech!destroyer!cs.ubc.ca!unixg.ubc.ca!unixg.ubc.ca!rudolph
  2. From: rudolph@unixg.ubc.ca (Christopher E Rudolph)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Another StripAddress Question?
  5. Date: 7 Jan 93 20:30:41 GMT
  6. Organization: The University of British Columbia
  7. Lines: 84
  8. Message-ID: <rudolph.726438641@unixg.ubc.ca>
  9. NNTP-Posting-Host: unixg.ubc.ca
  10. Summary: I am having trouble w/ StripAddress () in 24 and 32 bit modes
  11. Keywords: Strip Address Question
  12.  
  13. Hello All,
  14.  
  15. This relates to a problem I posted yesterday, which Tim Dierks explained
  16. nicely to me (thanks).
  17.  
  18. However I see to be having trouble with this StipAddress () call.  It doesn't
  19. seem to be working the way I think it should (not that that means very much).
  20.  
  21. Okay, here goes again.
  22.  
  23. 1)  Assume the Mac is in 32 bit Addressing mode after startup.  Thus any call
  24.     to  StripAddress () will leave the address unchanged. 
  25.     I have a Handle to a 'icl8' that I pass to a function as a pointer to a
  26.     long. 
  27.     
  28.     >   Handle colorIconH; 
  29.     >    
  30.     >   Function ((long *)*colorIconH)      <Function (long *colorIconPtr)>  
  31.               
  32.     I make sure that the 'icl8' was properly loaded (ie !NIL)
  33.     before passing it. So I now a have pointer to a long that is the starting
  34.     address of the first byte of my 'icl8' 
  35.     So I call StripAddress () because I won't be able to know if the user is
  36.     in 24 or 32 bit mode 
  37.     
  38.     >   colorIconPtr = (long *)StripAddress(colorIconPtr); 
  39.     
  40.     I call SwapMMUMode (); 
  41.     
  42.     >   mmuMode = true32b; 
  43.     >   SwapMMUMode (&mmuMode); 
  44.     
  45.     I have previously figured out where the baseAddr of the mainscreen is etc
  46.     so that drawing directly to the screen is simply:  
  47.     
  48.     >   for (...;...;...)       /* basic looping stuff */ 
  49.     >   {
  50.     >       *screenPtr++ = *colorIconPtr1++; 
  51.     >       /* screenPtr is a pointer to the baseAddr of the mainscreen */ 
  52.     >       ... 
  53.     >       ... 
  54.     >       ...
  55.     >       ... 
  56.     >   } 
  57.     
  58.     Okay I don't think I have left anything out other calling SwapMMUMode
  59.     again. 
  60.     
  61.     PROBLEM: 
  62.     Since I am in 32 bit Addressing mode I don't need the StripAddress call,
  63.     but since StripAddress is supposed to return the address unchanged if 
  64.     we are already in 32 bit mode, it shouldn't matter (NOT). 
  65.     When I comment out the StripAddress () call I get the color Icon drawn
  66.     properly to the screen.  However, when I don't comment it out, I get
  67.     junk on the screen.   I don't understand why this is happening, because 
  68.     if StripAddress is supposed to  return the value unchanged, commenting 
  69.     or not commenting the call shouldn't make a difference ???????????????.
  70.      
  71. 2)  Assume the Mac is in 24 bit Addressing mode after startup.  Thus any call
  72.     to  StripAddress () will strip the high byte of the address. 
  73.     I figured that maybe I should see what is happening in 24 bit addressing
  74.     mode and see what happens now. 
  75.     
  76.     >   The code is the same as 1) 
  77.     
  78.     PROBLEM: 
  79.     Now when I comment out the StripAddress call I get a BusError.  I should
  80.     expect this since the value is probably garbage when switching to 32 bit
  81.     mode. But when I uncomment StripAddress () I still get garbage on the screen.
  82.  
  83.     FINAL QUESTION: 
  84.     So then why should I get the icon properly placed when in 32 bit mode and
  85.     not stripping the address, but garbage or a bus error in all the other 
  86.     cases.
  87.  
  88.     This is quite confusing to me, and I would really love to hear an
  89.     explanation on it.  I hope I have been clear and to the point.
  90.      
  91.  
  92. ---------------------------------------------- 
  93. Chris Rudolph (ComputerScience,UBC) <rudolph@unixg.ubc.ca>
  94. ----------------------------------------------
  95.  
  96.  
  97.