>>I have a simple question about the PUSH instruction on 386.
Quote:>>I should have posted this to some assembly group, but I think someone
>>reading these groups I am posting to can help me.
>First this group is absolutl wrong for this kind of questions.
>However you have to keep in mind that push/pop handles the stack-
>pointer. I am not sure that there is a instruction to increment/decrement
>the stack-pointer. But this is necessary for stacks! If there is
If you consider it is so important, why do you think there is no
instructions to modify the stack pointer. Do you think there
is a magic switch that put everything in order when the machine boots,
and then you can write C programs?
Quote:>such a instruction, I am not sure if the needed two instructions, the mov
>and the stack-ptr-instruction together as fast as PUSH/POP.
>Assuming that PUSH/POP, MOV and this anknown stack-ptr-instruction are
>as fast as possible your solution will be more slowly as one more
>decode-cycle is necessary.
This is just your pure imagination.
I received a lot of detailed and technical responses from this group,
which showed the question is indeed not so simple and deserves some
Quote:>And please do not send such questions to comp.lang.c because they are
First, I think the question I am asking is relavent to C programming.
At an advanced level, a C programmer will inevitably encounter machine
instructions, if you write a operating system, a compiler or a device
driver, you do need to know some lower level stuff. I am not an assembly
programmer, what I need to know is how to setup paging(and things like that),
using a few assembly codes in my C program, then the magic can begin.
Isn't asm a keyword of C and C++, why can't we discuss it for a brief moment?
If all we talk about is
stdio.h, life will be too boring. And I do believe that the power of C
originates from its ability to directly address the lower level stuff.
I thought I could have interesting discussion with more intelligent
and knowlegeble people in comp.lang.c. I have no intention to start
a flame war here.
Thanks for all the help,