How to read from stack without popping?
I tried this:
mov dx, [ss:sp]
and got an error:
“error: invalid effective address”
I’m using NASM and my program is 16-bit for DOS.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
16 bit addressing doesn’t support
[sp]you can only address using a limited combination ofbx,bp,si,diand an displacement. That means you have to movespto one of the aforementioned registers, the usual one beingbpwhich even has thesssegment associated as default. Function prologue typically sets this up, so you can access your parameters and locals easily: