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