Reference no: EM132354470
Its masm kib Irvine lib32-bits not using 64. It must be written according to the details provided and more importantly it needs to match a beginner's level For all of the problems, a right-side column of comments must be included to explain the logic of the code.
You will ask the user for a String which will be a maximum of 40 characters long. You will then generate two random numbers between 0 and 15 inclusive. Save the numbers as the foreground and background colours.
You will also set to variables called row and col to 10 - which will be the row and col numbers where the text printing will start. Then, loop 300 times and inside the loop:
a) set the cursor at row and col;
b) set the text colour;
c) write the string;
d) advance the foreground colour and every time it reaches zero, decrement the background colour;
e) rotate the string one character to the left - the first character will become the last character;
f) advance the row value until it reaches 31 and then reset it back to 10 and increase the col value; and
g) delay the program 1/5 of a second. When the loop is done, set the cursor to row 35, and column 0.
Here is an algorithm defining this problem which will give you an example of how to create a comment-based algorithm to solve the problems.
More comments may be necessary and you can add them as required. ; collect a string from user (max 40 char) ; generate random foreground and background colour, store in vars ; clear the screen ; set row, column variables initially to 5 and 5 respectively ; loop 300 times, and for each iteration ; --> set cursor at (row, col) ; --> combine and set the colour for the text ; --> write the string ; --> advance foreground colour, if the foreground hits zero, decrease background colour (wraps around) ; --> rotate string to left, first char goes to the end ; --> advance cursor row value and if the row hits 25, reset the row to 5 and also increment the col value (col increases only when row hits 25) ; --> delay 1/20 second before the next iteration ;after the loop, set cursor to row 30, column zero.
2. Program with Small Parts Create a program which adds the following functionality, in the order described:
a) [10] Create an array that will hold 10 SDWORDS. Ask the user for a low and high number (verify the relationship of these value and swap if necessary) and then use low and high to generate random numbers to populate the array.
Finally, print the array as a comma separated list surrounded by square brackets (just like Arrays.toString() method).
This program must have separate procedures for populating the random numbers and printing the array - neither of which can reference the name of the array. Your program should work if the size of the array is simply changed in the .data section.
b) [20] Add a menu to the program from part which provides: 1 - Print the array; 2 - Total the array; 3 - Average value in array; 4 - Maximum value in the array; 5 - Minimum value in the array; and 0 - Exit.
The printing will now happen only if the user selects option 1, but the array will still be populated with random numbers as before. Options 2, 3, 4 and 5 must be separate methods - none of which can use the directive USES and none of which can use the name of the array.
c) [10] Add two more options: 6 - Multiply the array; 7 - Divide the array, and 8 - Mod the array.
For each, ask the user for the value of the multiplier or divisor as appropriate. The answer will be calculated for each element of the array and the result stored back in the array.
None of the array elements will be printed unless the user selects option 1 to print the array. Again, each of these options must have separate procedures - but all of them MUST use the USES directive to preserve registers as well as preserve flag values. Also, they must use indexed addressing (along with the actual array name).
d) Add four final options to the menu:
A - Arithmetic Shift the array values N to the right;
B - Shift the array value N to the left;
C - Rotate the array values N bits to the right; and
D - Rotate with Carry the array values N bits to the left.
For each, the user must be asked for the value of N. Use either indirect or Indexed addressing and preserve all appropriate registers and flags using whatever method you like. All four options must have separate procedures
When I read your comments, I should clearly see your algorithm - not a description of each assembly instruction. Also, there must be proper comments at the start of every procedure