Question
a) Write a program in Assembly for P3 Assembler and Simulator that for any given puzzle calculates the Manhattan distance from the empty space to
a) Write a program in Assembly for P3 Assembler and Simulator that for any given puzzle calculates the Manhattan distance from the empty space to the inferior right corner. The program should have has an entry a vector of 16 positions, wich representes a given puzzle , showed in memory sequence , from the position 8000h. The exit of the program, i.e the Manhattan distance asked , should be in R1. If there is an error , should be returned in R1 the value of FFFFh.
b) Write a program in Assembly for P3 Assembler and Simulator that takes a given puzzle as an entry , in the same format as the previous point , and returns in R2 the total number of inversions of each of the 16 positions of the puzzle board till the final position. In case there is an error shoud be returned in R2 the value of FFFFh.
Step 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