(Solved) : Write Complete Program Assembly Language Exchangeelementsasm Effectively Uses Iteration Po Q42678555 . . .

Write a complete program in Assembly Language (Exchange_Elements.asm) that effectively uses iteration and pointers to swap th

Write a complete program in Assembly Language (Exchange_Elements.asm) that effectively uses iteration and pointers to swap the first element with the last element of an array, the second element with the second-to-last element, and so on. The array has twenty-five 8-bit elements and is stored at $1000. Some of the HCS12 Instruction set that you will likely use in this assignment, in the IMM, EXT and IDX addressing modes are: Idx, Idy, Idaa, Idab, staa, stab, cpx, bne. As such, you should review their use as taught in class and in the Almy Text and the S12CPUV2 Reference Manual. Pre-Program Run Memory Map – Original Array ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F 1000 21 6e 75 46 20 73 69 20 65 67 61 75 67 6e 61 40 1010 20 79 60 62 64 65 73 73 41 Post-Program Run Memory Map – Elements Exchanged ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F 1000 41 73 73 65 60 62 6c 79 20 40 61 6e 67 75 61 67 1010 65 20 69 73 20 46 75 6e 21 Constraints: • The following code must be used in your solution to create the array elements and to dynamically determine the length of the array. org $1000 Elements db 033, 110, 117, 070, 032, 115, 105, 032, 101, 103, 097 db 117, 103, 110, 097, 076, 032, 121, 108, 098, 109, 101 db 115, 115, 065 EndElements Len equ EndElements-Elements ; sizeof() = Length of the array Your solution must be implemented in HCS12 Assembly Language using structured programming methods Create a constant called STACK that has the value of $2000 Your program code must commence at $2000, and the first line of code should initialize the stack to a value of $2000 using lds #STACK. You may NOT use the Stack to simply push the values onto the Stack and then pull them off backwards You may NOT use another array in your solution Except for org and equ statements, do not hard-code any addresses – use Labels as appropriate Since the length of the destination array has been dynamically calculated, there is no requirement to hardcode any of the array lengths, nor is there any requirement to have a counter for iteration Use other equate (equ) statements for any other dynamically created values you may need Use the provided array Labels for iteration purposes – no absolute memory addresses are to be used in any comparison Iteration and pointers must be used Use appropriate CONSTANTS and Labels Show transcribed image text Write a complete program in Assembly Language (Exchange_Elements.asm) that effectively uses iteration and pointers to swap the first element with the last element of an array, the second element with the second-to-last element, and so on. The array has twenty-five 8-bit elements and is stored at $1000. Some of the HCS12 Instruction set that you will likely use in this assignment, in the IMM, EXT and IDX addressing modes are: Idx, Idy, Idaa, Idab, staa, stab, cpx, bne. As such, you should review their use as taught in class and in the Almy Text and the S12CPUV2 Reference Manual. Pre-Program Run Memory Map – Original Array ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F 1000 21 6e 75 46 20 73 69 20 65 67 61 75 67 6e 61 40 1010 20 79 60 62 64 65 73 73 41 Post-Program Run Memory Map – Elements Exchanged ADDR 0 1 2 3 4 5 6 7 8 9 A B C D E F 1000 41 73 73 65 60 62 6c 79 20 40 61 6e 67 75 61 67 1010 65 20 69 73 20 46 75 6e 21 Constraints: • The following code must be used in your solution to create the array elements and to dynamically determine the length of the array. org $1000 Elements db 033, 110, 117, 070, 032, 115, 105, 032, 101, 103, 097 db 117, 103, 110, 097, 076, 032, 121, 108, 098, 109, 101 db 115, 115, 065 EndElements Len equ EndElements-Elements ; sizeof() = Length of the array Your solution must be implemented in HCS12 Assembly Language using structured programming methods Create a constant called STACK that has the value of $2000 Your program code must commence at $2000, and the first line of code should initialize the stack to a value of $2000 using lds #STACK. You may NOT use the Stack to simply push the values onto the Stack and then pull them off backwards You may NOT use another array in your solution Except for org and equ statements, do not hard-code any addresses – use Labels as appropriate Since the length of the destination array has been dynamically calculated, there is no requirement to hardcode any of the array lengths, nor is there any requirement to have a counter for iteration Use other equate (equ) statements for any other dynamically created values you may need Use the provided array Labels for iteration purposes – no absolute memory addresses are to be used in any comparison Iteration and pointers must be used Use appropriate CONSTANTS and Labels

Expert Answer


Answer to Write a complete program in Assembly Language (Exchange_Elements.asm) that effectively uses iteration and pointers to sw…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?