Assembly Language:
Reverse an array.
Use a loop with indirect or indexed addressing to reverse the elements of an integer array in
place. Do not copy the elements to any other array. Do not use stack operations. Use the
SIZEOF, TYPE, LENGTHOF operators.
Fibonacci Numbers.
Write a code that fills the array of 15 elements with consecutive Fibonacci numbers: Fib(1) =
Fib(2) = 1; Fib (n) = Fib(n-1) + Fib(n-2) for each N > 2.
corrent code:
Solution
data barray BYTE 6 DUP (?) dwarray DWORD 3 DUP (?) TOTAL_LENGTH = $-barray
bdmessage BYTE "Today as stored in a double word", 0dh, 0ah, 0 dwmessage BYTE 0dh,
0ah, "Seeing bytes in a single word", 0dh, 0ah, 0 lengthmessage BYTE 0dh, 0ah, "total bytes
used: ", 0 finalmessage BYTE 0dh, 0ah, "Press any key to continue ...", 0 .code main PROC
CALL Crlf MOV edx, OFFSET bdmessage CALL WriteString MOV eax, DWORD
PTR [barray + 2] CALL WriteDec MOV edx, OFFSET dwmessage CALL WriteString
MOVZX eax, WORD PTR [dwarray + 6] CALL WriteDec MOV edx, OFFSET
lengthmessage CALL WriteString MOV eax, TOTAL_LENGTH CALL WriteDec
MOV edx, OFFSET finalmessage CALL WriteString CALL ReadChar INVOKE
ExitProcess, 0 main ENDP END main

Assembly LanguageReverse an array.Use a loop with indirect or i.pdf

  • 1.
    Assembly Language: Reverse anarray. Use a loop with indirect or indexed addressing to reverse the elements of an integer array in place. Do not copy the elements to any other array. Do not use stack operations. Use the SIZEOF, TYPE, LENGTHOF operators. Fibonacci Numbers. Write a code that fills the array of 15 elements with consecutive Fibonacci numbers: Fib(1) = Fib(2) = 1; Fib (n) = Fib(n-1) + Fib(n-2) for each N > 2. corrent code: Solution data barray BYTE 6 DUP (?) dwarray DWORD 3 DUP (?) TOTAL_LENGTH = $-barray bdmessage BYTE "Today as stored in a double word", 0dh, 0ah, 0 dwmessage BYTE 0dh, 0ah, "Seeing bytes in a single word", 0dh, 0ah, 0 lengthmessage BYTE 0dh, 0ah, "total bytes used: ", 0 finalmessage BYTE 0dh, 0ah, "Press any key to continue ...", 0 .code main PROC CALL Crlf MOV edx, OFFSET bdmessage CALL WriteString MOV eax, DWORD PTR [barray + 2] CALL WriteDec MOV edx, OFFSET dwmessage CALL WriteString MOVZX eax, WORD PTR [dwarray + 6] CALL WriteDec MOV edx, OFFSET lengthmessage CALL WriteString MOV eax, TOTAL_LENGTH CALL WriteDec MOV edx, OFFSET finalmessage CALL WriteString CALL ReadChar INVOKE ExitProcess, 0 main ENDP END main