Can you make this a MIPS assembly code : *display an image at a given location a
ID: 3667411 • Letter: C
Question
Can you make this a MIPS assembly code:
*display an image at a given location any necessary orientation, and possibly animation
*store any data necessary to achieve this orientation as well as a way to correctly display the image
} Sprite;
where 'data' points to the image data, x and y are the location of the sprite, and h and w are the height and width so that you can print the image correctly and other things (like collision detection).
his is my code so far but it loop is infinity
syscall
main:
load the immediate value 0x0eeeeeee into register $s2
load the immediate value 0 into register $s3
loop:
rotate the contents of $s2 right four bits
save the value in InArr
branch back to loop: if the register $s2 is not equal to $s3
The infinite loop is caused by the fact that $s3 contains a value of 0 and you make no change to this.
What you should have (again written in English) is this
main:
load the immediate value 0x0eeeeeee into register $s2
load the immediate value 7 into register $s3
loop:
rotate the contents of $s2 right four bits
save the value in InArr
subtract 1 from $s3
branch back to loop: if the register $s2 is not equal to $s3
Dry running this gives you the following results
$s2 $s3
1 0x0eeeeeee 7
2 0xe0eeeeee 6
3 0xee0eeeee 5
4 0xeee0eeee 4
5 0xeeee0eee 3
6 0xeeeee0ee 2
7 0xeeeeee0e 1
8 0xeeeeeee0 0