Assignment Unit 7CS
Assignment Unit 7CS
CS 1105-01
In this assignment, I developed a simple assembly language program that utilizes a stack
data structure to reverse a string. The program is designed for the x86 architecture
using NASM (Netwide Assembler) syntax. The stack is an ideal choice for this task
because it operates on a Last In, First Out (LIFO) principle, which aligns perfectly with
the requirements for reversing a string.
```assembly
section .data
str db 'Hello, World!', 0 ; null-terminated string
len equ $ - str ; length of the string
section .bss
stack resb len ; reserve space for the stack
section .text
global _start
_start:
; Push characters onto the stack
mov ecx, len ; set counter to length of string
lea esi, str ; load address of the string
push_loop:
dec ecx ; decrement counter
mov al, esi + ecx ; load character from string
push eax ; push character onto stack
test ecx, ecx ; check if counter is zero
jnz push_loop ; repeat until all characters are pushed
pop_loop:
pop eax ; pop character from stack
mov edi, al ; store character back to string
inc edi ; move to next position
dec ecx ; decrement counter
3
; Exit program
mov eax, 1 ; syscall: exit
xor ebx, ebx ; return 0
int 0x80
```
The design process began with identifying the problem: reversing a string using a stack. I
chose to implement this in assembly language to deepen my understanding of low-level
programming concepts, particularly how data structures operate at the hardware level.
Using assembly language to implement high-level data structures offers several benefits:
In summary, this assembly language project not only provided practical experience in
implementing a high-level data structure but also significantly enhanced my
understanding of low-level programming concepts, demonstrating the value of assembly
language in developing efficient and controlled software solutions.
###
References:
Andreasson, J., Ahlstrom, L., Eriksson, A., & Dellve, L. (2016). The importance of
healthcare managers’ organizational preconditions and support resources for their
appraisal of planned change and its outcomes. Journal of Hospital Administration, 6(1),
25. https://doi.org/10.5430/jha.v6n1p25
Bolanakis, D., Evangelakis, G., Glavas, E., & Kotsis, K. (2011). A teaching approach for
bridging the gap between low‐level and high‐level programming using assembly
language learning for small microcontrollers. Computer Applications in Engineering
Education, 19(3), 525-537. https://doi.org/10.1002/cae.20333
Kuziemsky, C. (2015). Decision-making in healthcare as a complex adaptive system.
Healthcare Management Forum, 29(1), 4-7.
https://doi.org/10.1177/0840470415614842
Menachemi, N. and Collum, T. (2011). Benefits and drawbacks of electronic health
record systems. Risk Management and Healthcare Policy, 47.
https://doi.org/10.2147/rmhp.s12985
Omaghomi, T. (2024). Patient experience and satisfaction in healthcare: a focus on
managerial approaches - a review. International Medical Science Research Journal, 4(2),
194-209. https://doi.org/10.51594/imsrj.v4i2.812
Salleh, K. (2023). New demand on assembly language proficiency in performing binary
reverse engineering tasks. International Journal on Perceptive and Cognitive Computing,
9(2), 8-13. https://doi.org/10.31436/ijpcc.v9i2.397
Stoumpos, A., Kitsios, F., & Talias, Μ. (2023). Digital transformation in healthcare:
technology acceptance and its applications. International Journal of Environmental
Research and Public Health, 20(4), 3407. https://doi.org/10.3390/ijerph20043407
Woo-Garcia, R. (2024). Evaluation of assembler and c programming languages on
pic16f877 microcontroller. Journal of Physics Conference Series, 2699(1), 012013.
https://doi.org/10.1088/1742-6596/2699/1/012013