Question

(Assembly MIPS) draw random pixels on the screen continuously. When the user presses a key, you...

(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

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Homework Draw class diagrams for your HW4 - the Tetris Game shown below: Part 1: UML...
Homework Draw class diagrams for your HW4 - the Tetris Game shown below: Part 1: UML As a review, Here are some links to some explanations of UML diagrams if you need them. • https://courses.cs.washington.edu/courses/cse403/11sp/lectures/lecture08-uml1.pdf (Links to an external site.) • http://creately.com/blog/diagrams/class-diagram-relationships/ (Links to an external site.) • http://www.cs.bsu.edu/homepages/pvg/misc/uml/ (Links to an external site.) However you ended up creating the UML from HW4, your class diagram probably had some or all of these features: • Class variables: names, types, and...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
Compile and execute the application. You will discover that is has a bug in it -...
Compile and execute the application. You will discover that is has a bug in it - the filled checkbox has no effect - filled shapes are not drawn. Your first task is to debug the starter application so that it correctly draws filled shapes. The bug can be corrected with three characters at one location in the code. Java 2D introduces many new capabilities for creating unique and impressive graphics. We’ll add a small subset of these features to the...
convert to python 3 from python 2 from Tkinter import * # the blueprint for a...
convert to python 3 from python 2 from Tkinter import * # the blueprint for a room class Room(object): # the constructor def __init__(self,name,image): # rooms have a name, exits (e.g., south), exit locations (e.g., to the south is room n), # items (e.g., table), item descriptions (for each item), and grabbables (things that can # be taken and put into the inventory) self.name = name self.image = image self.exits = {} self.items = {} self.grabbables = [] # getters...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT