Question
ARM Assembly for Embedded Applications Q5 Background A sliding puzzle is a combination puzzle that challenges a player to move tiles on a two-dimensional array
ARM Assembly for Embedded Applications Q5
Background A sliding puzzle is a combination puzzle that challenges a player to move tiles on a two-dimensional array of cells so as to establish a certain end-configuration. Finding moves and the paths opened up by each move within the two-dimensional confines of the array are important parts of solving sliding block puzzles.
Assignment: The puzzle is displayed within a 44 array of 16 cells. An image has been divided into 16 tiles of 6060 pixels each with 15 of the tiles placed into the array. Each pixel is stored as a 32-bit value containing 8 bits each of its red, blue, green and intensity components. Create an assembly language file containing translations of the following two C functions. CopyCell copies all the pixels of one cell to another and FillCell fills a cell with white pixels. Parameters dst and src contain the address of the pixel in the top left corner of a cell.
Tiles may be moved only if they are moved to an adjacent empty cell. When the program starts, it performs a sequence of random moves and then displays the scrambled image that results. The objective is to use the fewest number of moves to unscramble the tiles so that the image is displayed correctly. Touching a tile that is adjacent to an empty cell will move the tile into the empty cell. The program records a history of up to 1000 such moves; touching the empty cell undoes the most recently recorded move. Pressing the blue pushbutton will undo all moves to display the original (unscrambled) image.
void CopyCell(uint32_t *dst, uint32_t *src) void Filicell(uint32_t *dst, uint32_t pixel) uint32_t row, col ; for (row = 0; rowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started