.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
array dword 1,2,3,4,5,6,7,8 #array of elements
.code
main proc
mov esi, OFFSET array #move the all index values to the esi
register
mov ecx, LENGTHOF array -1 #move the lenght of the array to the ecx
register
myLoop: #loop start
MOV eax,[esi] #move the index of array value to the eax
XCHG eax,[esi+4] #exchanging the two value pairs by
adding bytes 4 then the address will be change
MOV [esi],eax #swap the value pairs
add esi, TYPE array #first swapped value add to the array
add esi, TYPE array # second swapped value add to the array
loop myLoop # iterate loop
invoke ExitProcess,0 # exit process
main endp
end main #end of the program
another method simply understands:
dwarray dword 0,2,5,9,10,12
.code
main proc
mov ebx, OFFSET dwarray
mov ecx,
3
# THE ARRAY CONTAINS 6 ELEMENTS, BUT THEY ARE PROCESSED
IN PAIRS, SO THE LOOP SHOULD REPEAT HALF 6 (3).
L1: ;cmp ebx,
ecx
#UNNECESSARY?
mov eax, [ebx]
mov edx,
[ebx+4]
#THE NEXT ELEMENT IS 4 BYTES AWAY.
mov [ebx+4],
eax
#AGAIN, THE NEXT ELEMENT IS 4 BYTES.
mov [ebx], edx
add ebx,
8
#INCREASE BY 8 (THE SIZE OF 2 ELEMENTS PROCESSED).
loop L1
This is Assembly Language...please i want you to give proper documentation or comment of every code...
Please use java language in an easy way and comment as much as you can! Thanks (Write a code question) Write a generic method called "findMin" that takes an array of Comparable objects as a parameter. (Use proper syntax, so that no type checking warnings are generated by the compiler.) The method should search the array and return the index of the smallest value.
Task is to implement the following algorithms in Assembly language for x86 processor1) Insertion sort Demonstrate Sorted Array of 10 elements in Watch Window for each one Running time of each algorithmsample bubble sort code:;----------------------------------------------------------BubbleSort PROC USES eax ecx esi,pArray:PTR DWORD, ; pointer to arrayCount:DWORD ; array size;; Sort an array of 32-bit signed integers in ascending; order, using the bubble sort algorithm.; Receives: pointer to array, array size; Returns: nothing;-----------------------------------------------------------mov ecx,Countdec ecx ; decrement count by 1L1: push ecx ; save outer...
how to write assembly language for x86 and where do I put the code under as? please give me answer as soon as possible. ZOOMt COSC 2325.S01 Kxtra Credit l'rogram Problem: Starting wilh the following C+program #includes iostream > using cspace sld; cxlem'C" long Average (long, long LD; void main long Arrayl Г 101-1, 2, 3. 4, 5, 6, 7, 8. 9. 103; long Aray2 111」 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; coul <'': "Average...
I posted the question for this and I want to make sure that this answers the question 1.a) The pseudo code for the closest pair problem is as illustrated below: Closest pair (K, i, j) input: Array K is indexed from i to j. closest pair returns the indices of the closest pairs. diff = K[2] - K[1] // This is the initial difference between the first two numbers. This is shown through the array and these differences. example: K[2]...
can you comment so that I may understand how it works. 3. Write a C++ program that does the following: Write a function (smallestindex) that has two parameters: an array containing elements of type int and the length of the array. The function returns the index of the array's smallest element. ii. Use the main function to call the smallestindex function
simple PYTHON 3 language. please comment each line I want to understand. I know the picture says java but please complete code in PYTHON. please use menu driven [E] The "back" button used in a web browser is a great example of how stacks may be used. When a user visits a new web page, the current page gets pushed onto the stack. When the user clicks the back button, the last page pushed onto the stack is popped off...
You want to design a digital watch using the private timer. Write the code with ARM assembly and C. Make your own decision on the language selection (Assembly and C). The followings are the coding requirements: Every second, the time information (hour minute second) should be sent to the UART terminal on PC The time starts from 00: 00: 00 Use some special ASCII characters to return back the cursor to the first column, when you display a new time....
(f) and (g) please f and g please letters Question 2 Indirect addressing mode in assembly language is sanilar to pointers in C. Answer the following questions: (1 point) a) How many 8-bit registers can a FSR access in the PICI8F452 MCU? b) Write the assembly language command to load the address of the variable with name: PVal into one of the FSR? (2 points) (2 points) (2 points) c) What is the meaning of: movf PREINC2, F? d) What...
Array manipulation (a) Write Java code for a method exchange (int [] a, int i, int j) that exchanges the values stored at indices i and j in the array a. You do not need to worry about cases where either i or j is an invalid index. Give the best estimate you can for its time complexity (b) In an ordered array of n items, how can we determine whether or not an item belongs to the list using...
***** please answer all questions and type it all please, specially the code you create. I really need the help. Thank you so much, if you help by answer all questions, ill give you a good rating! The language used is C IW7-3] Write a code which prints the dynamical matrix for a chain of N masses co by springs k to a file. Write it in a way that "jacobi" can read it in: each line contains all the...