Starting from:

$35

HW # 6: Theme: Arithmetic and Procedures Solution

    1. [Arithmetic Expression] Write a program that prints out five rows of asterisks, each row containing five of them. You have to implement this using nested loops. Submit code, lst file and screenshot of output. Use the WriteChar function in the lib to print out characters.

Hints: The ascii code for asterisk is 2Ah; The ascii code for newline is 0Ah;


    
    2. [Arrays] Write a program that:

    1) Prompts the user for integer input 6 times
    2) Stores these inputs in a stack
    3) Displays the stored values on the screen using WriteInt (not DumpRegs). 

In your submission, please embed the full program (.asm and .lst file) and one screen shot with at least one positive and one negative input value. Use the following:

.data
PromptUser BYTE "Please enter a value:", 0


    3. [Compares, Procedures] Write a procedure, findMinor, that finds the element whose value is closest to zero from the values that are stored in the stack in the previous program.   Write a main program that calls findMinor and prints the values found.   Also, print the indices at which the values were found, assuming that the first value has the index 0.  

For example, if the inputs are 3,-1,2,4,8,-4:
The expected output of your code is:

The target value is -1, and is located at index:1

In cases where more than one element have the same absolute value, you only have to output one of them.
    
    
Use the following:
.data
prompt      BYTE "Please input a value: ", 0
spacing     BYTE ", ",0; 
String2    BYTE "The target value is,” 0
String2    BYTE “and is located at index: ",0


In your submission, please embed the full program (.asm and .lst file) and one screen shot showing the values found.  Please test several sets of positive and negative values
    

More products