View Single Post
Old 22 November 2019, 15:05   #17
deimos
Registered User

 
Join Date: Jul 2018
Location: France
Posts: 536
Quote:
Originally Posted by geldo79 View Post
Ok. So, my next question is : If i would like to set a graphic of 3x3 pixel size, how can I set it properly if it overlaps two bytes? Of course, i could calculate the fraction which is in the first byte and set it, and calculate the fraction for the second byte and set it. But is there an easier way to do it? Would be nice if i could just set a word, and if the shift to e.g. the right side is big enough to show the graphic completely on the next byte, i would set the word on the next byte location. But this is not allowed it it is an odd number.....
You can do byte accesses to memory at any address. On a 68000 words accesses always need to be aligned to an even address. On 68020 or higher this restriction is lifted, but comes with a performance penalty (2 memory accesses). Access to memory is always according to the width of the bus. Probably oversimplified, but whatever.

No matter whether you access memory 8, 16, 32 bits at a time, you will have to account for your objects wrapping past the edge of your words. For such small objects I would consider pre-calculating the shifts across a word - there's only 16 of them, and only 2 of them involve overlapping into a second word.

Edit: You'd probably get some savings by making your objects 4x4, even if you never used that last pixel.

Last edited by deimos; 22 November 2019 at 18:09.
deimos is offline  
 
Page generated in 0.04095 seconds with 11 queries