Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assembly Language X86 Write a complete program that: 1. Prompts the user to ente

ID: 3605743 • Letter: A

Question

Assembly Language X86
Write a complete program that:
1. Prompts the user to enter 5 numbers then 5 letters.
2. Saves the numbers to a 32-bit integer array, numArr.
3. Saves the letters to charArr where each element reserves one byte.
4. Prints the numbers and letters.
5. prints the mean of the number array,numArr
6. copy all the elements from the numArr and the charArr
to a quadword array, newArr in a reverse order.
where each qword in newArr contains a letter that occupies
4 bytes and a number that occupies 4 bytes,
7. Prints out the newArr.
8. dumps out the memory for each array. This is done for you.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
You MUST use loop and indirect addressing.
You MUST use the SIZEOF, TYPE, and LENGTHOF operators to make the program
as flexible as possible if the arrays' size and type should be
changed in the future. NO IMMEDIATATE NUMBERS AT ALL IN THE CODE SEGMENT.
Add comments to make your program easy to read. Your lines must not
   exceed 80 columns.
   Look at the sample run for clarification.
   Don't delete anything already written for you.      
   Copy paste 2 of your runs and paste them at the end of your code
  
   !
  

include irvine32.inc

.data
string1 byte 0Ah,0Dh,"Dumping out charArr",0
string2 byte 0Ah,0Dh,"Dumping out numArr", 0
string3 byte 0Ah,0Dh,"Dumping out newArr", 0

charArr byte 5 dup (?)
numArr dword 5 dup (?)
newArr qword 5 dup (?)

; add your data here


.code
main proc
   ;----------------------------Your Code starts Here-----------------------

     
     
   ; ---------------------------Your Code Ends Here-------------------------


       mov edx, offset string1
   call writeString
mov esi,OFFSET charArr
mov ecx,LENGTHOF charArr
mov ebx,TYPE charArr
call DumpMem
     
   mov edx, offset string2
   call writeString
mov esi,OFFSET numArr
mov ecx,LENGTHOF numArr
mov ebx,TYPE numArr
call DumpMem
     
   mov edx, offset string3
   call writeString
mov esi,OFFSET newArr
mov ecx,LENGTHOF newArr
mov ebx,TYPE numArr   
call DumpMem
   mov esi,OFFSET newArr + Type numArr * LENGTHOF newArr
mov ecx,LENGTHOF newArr
mov ebx,TYPE numArr   
call DumpMem
exit
main endp
end main

sample run:

Please enter a number:
3
Please enter a number:
55
Please enter a number:
6
Please enter a number:
7
Please enter a number:
3

The integer array you entered is:
3 55 6 7 3
Please enter five characters:

The characters you entered are:
a l a m e
The mean of the integer array is:
14 4/5
The elements in the new array are:
e3 m7 a6 l55 a3

Dumping out charArr
Dump of offset 00406040
-------------------------------
61 6C 61 6D 65

Dumping out numArr
Dump of offset 00406045
-------------------------------
00000003 00000037 00000006 00000007 00000003

Dumping out newArr

Dump of offset 00406145

-------------------------------

00000065 00000003 0000006D 00000007 00000061

Dump of offset 00406159

-------------------------------

00000006 0000006C 00000037 00000061 00000003

Explanation / Answer

oid changeCase (char char_array[], int array_size ) {

__asm{
        // BEGIN YOUR CODE HERE

    mov eax, char_array;        //eax is base image
    mov edi, 0;

readArray:
    cmp edi, array_size;
    jge exit;
    mov ebx, edi;           //using ebx as offset
    shl ebx, 2;
    mov cl, [eax + ebx];    //using ecx to be the storage register

check:
    //working on it
    cmp cl, 0x41;       //check if cl is <= than ASCII value 65 (A)
    jl next_indx;
    cmp cl, 0x7A;       //check if cl is >= than ASCII value 122 (z)
    jg next_indx;
    cmp cl, 'a';
    jl convert_down;
    jge convert_up;


convert_down:
    or cl, 0x20;        //make it lowercase
    jmp write;

convert_up:
    and cl, 0x20;       //make it uppercase
    jmp write;

write:
    mov byte ptr [eax + ebx], cl    //slight funky town issue here,

next_indx:
    inc edi;

exit:
    cmp edi, array_size;
    jl readArray;

mov char_array, eax;
        // END YOUR CODE HERE
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote