Newbie question, please forgive!

In Tutorial 3, the following two commands were issued:-
push  hInstance
pop  wc.hInstance

Why is push/pop from the stack needed?
Why can't we simply do the following command?
mov wc.hInstance, hInst or
mov wc.hInstance, hInstance or
another mov command?

You help is much appreciated. Thank you in advance.
Posted on 2006-12-17 23:19:10 by tornado
We can move data 'from memory to register',
We can move data 'from register to memory',
We can move data 'from register to register'.

There's no way to move data 'FROM memory, TO memory' with your x86 processor... such an opcode does not exist.

Pushing and popping is just one way around this problem :)

Don't feel ashamed to ask 'newbie questions' - we were ALL 'newbies' once .. instead, feel sorry for those who choose to REMAIN IGNORANT !!

Have a nice day :)
Posted on 2006-12-17 23:26:27 by Homer
Moving the data from memory to memory would require either of the following:
1) Additional DRAM command ("copy the value of cell XXXX to cell YYYY"), which would increase the cost of DRAMs significantly.
2) Additional instruction which would perform a 'read from and then write to memory'. This one would increase the cost of CPU insignificantly, but...

...Both of them aren't very necessary. The only situation where such stuff would be nice is when you need large amounts of data to be copied from one place to another. But that's what (U)DMA is for.
Posted on 2006-12-18 04:58:01 by ti_mo_n