Your assignment is to write an assembly program that takes a series of characters from the keyboard until a '$' character is entered. These characters must be saved in a stack. Then the program is to print all these characters backwards.

I would like to know ,How to push the charachters which you entered in the stack and pop it from the stack

An easy implementation of a stack is simply an array which you only access at one end.

How to push the value in the stack

this is a code that shows how to push somethin on a stack, and then pop it out reversed, hope it helps u... enjoy...

; This program reverses a string.
aName BYTE "Abraham Lincoln",0
nameSize = ($ - aName) - 1
main PROC
; Push the name on the stack.
 mov ecx,nameSize
 mov esi,0
L1: movzx eax,aName[esi] ; get character
 push eax ; push on stack
 inc esi
 Loop L1
; Pop the name from the stack, in reverse,
; and store in the aName array.
 mov ecx,nameSize
 mov esi,0
L2: pop eax ; get character
 mov aName[esi],al ; store in string
 inc esi
 Loop L2
; Display the name.
 mov edx,OFFSET aName
 call Writestring
 call Crlf
main ENDP
END main
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.