CS 1105-01 – AY2026-T3 Assignment Activity Unit 7 | Actual
verified study complete Solutions | A+ Graded | 2026 Updated |
100% correct
Bijay Krushna Mohapatra
Department of Computer Science
CS 1105-01 - AY2026-T3-Assignment Activity Unit 7
Assembly Language Implementation of a Stack for String Reversal
Being new to assembly language programming, this project is intended for me to show an
understanding of lower-level concepts by creating a stack data structure in an assembly
language to reverse a string, a common programming task. The following describes the design,
development, and advantages of an assembly language program.
1. An Assembly Language String Reversal Program Using a Stack
Due to the difficulty of providing a complete assembly program which is executable with this
response, here is a summary of the important components and logic. The program has a
simplified assembly language target environment (for example: an x86 architecture with a
nofrills assembler) and the organization for instructional clarity and value rather than the
ultimate in optimization.
Data Segment: An area defining memory locations for the string to reverse, the stack, and
variables needed including the stack pointer.
, • original_string: db “Hello World”, 0 ; Null-terminated string
• reversed_string: db 20 dup(0) ; Buffer for reversed string
• stack: db 10 dup(0) ; Stack (limited size for simplicity)
• stack_pointer: dw stack ; Pointer to the top of the stack
The Code Section is where the logic for the program is located.
• Push Function: This subroutine accepts a character and pushes it to the stack.
* Verify that the stack has not overflowed (the stack pointer is not past the stack
boundary).
* Set the character in memory, at the address pointed to by the stack pointer.
* Increment the stack pointer.
• Pop Function: This subroutine pops a character off the stack.
* Verify the stack has not underflowed (the stack pointer is greater than the stack's
base address).
* Decrement the stack pointer.
* Get the character from memory, at the address pointed to by the stack pointer.
• Main Program Logic:
* Load the address of the original string.
* Loop through string, and pushing it to the stack, character by character.
* Load address for the reversed string.
* Loop to pop off the stack and store them in the reversed string buffer.
* Null terminate the reversed string.
* (Optional) Print the reversed string (requires special calls depending on the system).
verified study complete Solutions | A+ Graded | 2026 Updated |
100% correct
Bijay Krushna Mohapatra
Department of Computer Science
CS 1105-01 - AY2026-T3-Assignment Activity Unit 7
Assembly Language Implementation of a Stack for String Reversal
Being new to assembly language programming, this project is intended for me to show an
understanding of lower-level concepts by creating a stack data structure in an assembly
language to reverse a string, a common programming task. The following describes the design,
development, and advantages of an assembly language program.
1. An Assembly Language String Reversal Program Using a Stack
Due to the difficulty of providing a complete assembly program which is executable with this
response, here is a summary of the important components and logic. The program has a
simplified assembly language target environment (for example: an x86 architecture with a
nofrills assembler) and the organization for instructional clarity and value rather than the
ultimate in optimization.
Data Segment: An area defining memory locations for the string to reverse, the stack, and
variables needed including the stack pointer.
, • original_string: db “Hello World”, 0 ; Null-terminated string
• reversed_string: db 20 dup(0) ; Buffer for reversed string
• stack: db 10 dup(0) ; Stack (limited size for simplicity)
• stack_pointer: dw stack ; Pointer to the top of the stack
The Code Section is where the logic for the program is located.
• Push Function: This subroutine accepts a character and pushes it to the stack.
* Verify that the stack has not overflowed (the stack pointer is not past the stack
boundary).
* Set the character in memory, at the address pointed to by the stack pointer.
* Increment the stack pointer.
• Pop Function: This subroutine pops a character off the stack.
* Verify the stack has not underflowed (the stack pointer is greater than the stack's
base address).
* Decrement the stack pointer.
* Get the character from memory, at the address pointed to by the stack pointer.
• Main Program Logic:
* Load the address of the original string.
* Loop through string, and pushing it to the stack, character by character.
* Load address for the reversed string.
* Loop to pop off the stack and store them in the reversed string buffer.
* Null terminate the reversed string.
* (Optional) Print the reversed string (requires special calls depending on the system).