Jnuw
20th May 2005, 22:02
I'm looking for a good way to reverse the order of everything in the stack. The the hard part is I may not know how many items are in the stack when I need it reversed. I tested the below code when I know I have only 5 items in the stack. Is there a better way?
OutFile Test.exe
Section ""
Push 1
Push 2
Push 3
Push 4
Push 5
Exch 4
Exch 1
Exch 3
Exch 1
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
SectionEnd
OutFile Test.exe
Section ""
Push 1
Push 2
Push 3
Push 4
Push 5
Exch 4
Exch 1
Exch 3
Exch 1
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
SectionEnd