# need help understanding screen memory mapping

7 messages
Open this post in threaded view
|

## need help understanding screen memory mapping

 This post was updated on . please,with screen memory mapping the part that confuses me is "Set the (col % 16)*th* bit of word to 0 or 1" so if you were to do word= 32*(Row)1+(column) 2/16 therefore: 2/16=0.125 word=32+0=32 and since "col%16"=colmodulo 16 aka the remainder of col/16 you'd have to set the 125th bit of the 32nd memory address to zero or one? that obviously doesn't make sense so what am i misunderstanding.
Open this post in threaded view
|

## Re: need help understanding screen memory mapping

 Can you point us to the place where this is written?
Open this post in threaded view
|

## Re: need help understanding screen memory mapping

 elements of computing systems page 113 page 134 here https://drive.google.com/file/d/1HxjPmIZkFHl-BVW3qoz8eD9dqEuEyuBI/viewtimestamped link here https://youtu.be/gTOFd80QfBU?t=682
Open this post in threaded view
|

## Re: need help understanding screen memory mapping

 Let's say you want to make pixel with coordinates (40, 31) black. (IIRC 0 is white and 1 is black). First, we need to find which word in the video memory contains the corresponding pixel. The formula is SCREEN + 32*row + col/16, where SCREEN is the address of the first word in the video memory (16384). In our case row = 31 and col = 40. Note that the division here is an integer division, which seems to be one of the things that confused you. So the RAM address for the word containing this pixel is 16384 + 32 * 31 + 40 / 16 = 16384 + 992 + 2 = 17378. Next, you need to determine exactly which bit in this word corresponds to the pixel. For this we use col % 16 = 40 % 16 = 8. So the 9th bit (bits start from 0) is the one that you need to set to 1 to make it black.
Open this post in threaded view
|

## Re: need help understanding screen memory mapping

 This post was updated on . thank you,i see what the way to do it is now. (correct me if i'm wrong, and in the example you just gave wouldn't 40/16=2.5,so remainder AKA "40%16"=5.? but 6th bit because they start at zero )