(Assembly MIPS)
draw random pixels on the screen continuously. When the user presses a key, you change the color of the pixel.
You will set the Bitmap Display to the following
1. Unit Width and Height will be 8 pixels
2. Display Width and Height will be 1024
3. Base Address will be 0x10010000 (static data)
The currentColor to draw will start as Blue 0x0000FF00
Remember that the color written is 0x00RRGGBB
do {
Generate a number X between 0 and the number of rows for the display
Generate a number Y between 0 and the number of columns for the display
Write the currentColor to that location in memory.
Check to see if a Key is pressed.
0 turns Red off, 1 turns Red on
2 turns Green off, 3 turns Green on
4 turns Blue off, 5 turns Blue on
9 exits the program
}
Part 2. For the second part of the program, modify how you monitor the Keypad.
0 Toggles Red
2 Toggles Green
3 Toggles Blue
For example in a 32 bit RGBA image each pixel is made up from 4 parts
red = 8 bi
green = 8 bit
blue = 8 bit
alpha = 8 bit
Each can be set to a value between 0 and 255
So you and just treat the image as an array of bytes and change each pixels color value
Image image = CreateImage(
for(int i = 0; i < image.size(); i+
image[i] = RandomNumberBetween(0, 255)
Or create the image from an array of byte
int byteArray[width * height * 4
for(int i = 0; i < width * height * 4; i+
image[i] = RandomNumberBetween(0, 255)
Image image = createImageFromByteArray(byteArray
You could also create a simple opengl scene and do it in a shader
float rand(vec2 co
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453)
void main(void
gl_FragColor = rand(gl_TexCoord[0].xy)
};){};){.);;+)];s;+));s.;sssts
Get Answers For Free
Most questions answered within 1 hours.