The Commodore 64, a popular home computer in the 1980s, was able to display 320
ID: 3755973 • Letter: T
Question
The Commodore 64, a popular home computer in the 1980s, was able to display 320 x 200 pixels in its “hi-res” graphics mode. In this problem, and one in next week’s written homework assignment, we will explore the mathematics of how the Commodore 64 stores pixels in video memory.
I don't understand how to solve this problem. I need help on a) and b) and c). Please show work so I can understand!
3. The Commodore 64, a popular home computer in the 1980s, was able to display 320 x 200 pixels in its "hi-res" graphics mode. In this problem, and one in next week's written homework assignment, we will explore the mathematics of how the Commodore 64 stores pixels in video memory. Pixel coordinates on the screen are counted from the upper left to the lower right. This means that the upper left pixel is (0,0), the upper right pixel is (319,0), the lower left pixel is (0,199), and the lower right pixel is (319,199) The hi-res display s subdivided into ells of size 8x8 pixels, and cells are numbered consecutively, starting at zero, horizontally from left to right, then vertically from top to bottom. Observe that this means that there are 40 columns of cells, and 25 rows. The diagramillustrates the cell numbering. 38 39 Suppose a pixel P with coordinates x and y is given. This means thatx and y are integers with 0 Sx S 319 and 0 s y 199. Suppose p is the number of the column of the cell P is in, counting columns from left to right, starting at 0. Suppose q is the number of the row of the cell P is in, counting rows from the top down, starting at 0. 40 | 41 | 42 | .. | 78 | 79 960 961 962 998 999 Observe that this means that p and q are integers with 0 S p S 39 and 0 S q S 24. a) Express p and q in terms of x and y. b) What is the position (a,b) of P within its cell, in terms of x and y? In these relative coordinates, the top left pixel is (0,0), the bottom right pixel is (7,7) What is the cell number c of the cell that contains P in terms of p and q? c) Use the notations div and mod as needed. You do not need to give explanations here.Explanation / Answer
Hi,
In the below diagram, 0,1,2 …. indicates cell numbers.
0
1
2
……
38
39
40
41
42
……
78
79
.
.
960
961
962
…….
998
999
In the below diagram(0,0) (0,1) …. indicates cell coordinates represented with(p,q).
(0,0)
(0,1)
(0,2)
……
(0,38)
(0,39)
(1,0)
(1,1)
(1,2)
……
(1,38)
(1,39)
.
.
(39,0)
(39,1)
(39,2)
…….
(39,38)
(39,39)
Because each cell divided into 8x8 pixels. then pixel diagram looks like below. In the below diagram (0,312) (0,319) etc… indicates pixel coordinates(x,y).
(0,0)
(0,0)
(0,7)
(7,0)
(7,7)
(0,1)
(0,2)
……
(0,38)
(0,39)
(0,312)
(0,319)
(7,312)
(7,319)
(1,0)
(1,1)
(1,2)
……
(1,38)
(1,39)
.
.
(39,0)
(39,1)
(39,2)
…….
(39,38)
(39,39)
Now we look at the given questions
solution: p=x div 8
q= y div 8
example take (7,312) in above diagram. here x=7 and y 312
p= 7 div 8 = 0
q= 312 div 8 = 39
a= (x div 8) mod 8.
b= (y div 8) mod 8.
explanation:multiplying with 40 because each row contains 40 cells
0
1
2
……
38
39
40
41
42
……
78
79
.
.
960
961
962
…….
998
999
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.