home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 21275 < prev    next >
Encoding:
Text File  |  1993-01-12  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!sunic!kth.se!hemul.nada.kth.se!d88-jwa
  3. From: d88-jwa@hemul.nada.kth.se (Jon WΣtte)
  4. Subject: Re: Direct screen writing; getting to (x,y)
  5. Message-ID: <1993Jan12.130357.8697@kth.se>
  6. Sender: usenet@kth.se (Usenet)
  7. Nntp-Posting-Host: hemul.nada.kth.se
  8. Organization: Royal Institute of Technology, Stockholm, Sweden
  9. References: <1993Jan11.235448.22675@afterlife.ncsc.mil>
  10. Date: Tue, 12 Jan 1993 13:03:57 GMT
  11. Lines: 33
  12.  
  13. In <1993Jan11.235448.22675@afterlife.ncsc.mil> mssmith@afterlife.ncsc.mil (M. Scott Smith) writes:
  14.  
  15. >   Anyway, this code seems to work.  I'd like a few suggestions on better ways
  16. >of doing this.  Do I have the right idea, or did I miss the boat completely?
  17.  
  18. You're not calling SwapMMUMode. That's bad. You should, before
  19. changing the address (swap to 32bit mode) and set it back
  20. afterwards (to what it was)
  21.  
  22. >   That is, say the monitor is 480 lines vertical; I'd then make an array
  23. >480 long and manually compute row_bytes*y for each y position, plugging the
  24. >value into the array.  Then I could simply do something like:
  25. >base_addr + x + line[y]
  26.  
  27. Ah, but better yet you could create an array of pointers to
  28. each and every row, so the affected address is
  29.  
  30.     row_address [ y ] + x
  31.  
  32. >expensive part of this routine.  But, on second thought, C is really doing
  33. >multiplication anytime you access a subscript of an array, right?  (For
  34. >example, if you want line[50], then it does some multiplication to go from
  35. >the base address -- line -- up 50*sizeof(line) to get the value, right?)
  36.  
  37. Ah, enter the MC68k instruction set! They thought of this, and
  38. provide instructions that do the multiplication (bit-shift really)
  39. implicitly; this works especially well with 68020 code generation.
  40. Since you use color QD, you have a68020 and better; turn it on!
  41.  
  42. -- 
  43.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  44.    This signature is kept shorter than 4 lines in the interests of UseNet
  45.    S/N ratio.
  46.