80 likes | 90 Views
This text explores the concepts of block collision and destruction in a screen or display, including screen/display coordinates, memory addressing, and bit shifting. It discusses how these concepts are applied to a memory block structure and the process of identifying collisions and removing blocks.
E N D
Three Concepts • Screen or Display coordinates • Memory Addressing • Bit Shifting
01010000000 11 bits 11 bits 00111100000 Display Concepts 640 (x,y) 480
Memory Memory 10-bit Address Bus 1-bit Data 1024 bits of memory
Bit Shifting • Blocks are 32 by 16 or … 2^5 by 2^4 • Can fit 20 blocks across the top of the display and stack them 30 deep 32 (100000) 16 (10000)
11 bits Ball X coordinate 00010100110 Address 0010100000 10 bits Combining it All • Ignore the 5 least significant bits of the X coordinate of the ball. • Take the remaining next 5 bits of the ball X coordinate and map them to the top five bits of the memory address
11 bits Ball Y coordinate 00110100010 Combining it All • Ignore the 4 least significant bits of the Y • Map the next 5 bits of Y coordinate to the bottom 5 bits of the memory address Address 0010100110 10 bits
Collision • Use the address to access memory • If the Data is one, there is a block in the same space as the ball • Signal a collision and write a ‘0’ to remove the block