The following code is to be executed from the current IP up to and including the ret instruction. Note: for simplicity we assume that each instruction takes 2 bytes, which is not necessarily the case for the
8086.
Code Address Instruction
3096 mov ax, 1
3098 pop ax
4000 pop bx
4002 pop bp
4004 ret
On 26 Nov 2006 20:51:11 -0800, "2005" wrote in comp.arch.embedded:
What possible justification do you think there is for posting this to comp.dsp, since the 8086 is NOT a DSP and the code does no digital signal processing?
In fact, it is not really relevant to comp.arch.embedded, either. There is nothing particularly "embedded" about it.
If you had to post this (a homework assignment?) to a newsgroup at all, the moderated group news:comp.lang.asm.x86 would be appropriate.
But how lame can you be? If you translate the values from decimal to hex (and the Windows calculator applet can do that), you can enter them into the Windows debug program and actually single step the code to see exactly what is in the registers at the end.
It may be a generational thing. I had desktop systems with 8080 or 6502. Now a dedicated embedded system may have a 80386 or higher processor. And DSP chips are "known" to be trivial small dedicated thingys ;>
I agree with the previous posters. This should not be posted in the DSP newsgroup or even the embedded newsgroup. There are other groups more suited to this, search.
This is a fairly simple sequence. In any case you know your IP = 4000 and you SP = 2004. You also have your instructions and the contents of the stack Now the trick here to remember is that on the 8086 there is a decrement before a PUSH and an increment after POP. Most microprocessors do the exact same when it comes to manipulating stacks. The only processor I have come across that doesn't is the HC11 (and possibly the others in the series, but never coded those in assembly).
Since you say the IP is at 4000, the above 2 instructions are obviously not executed.
This instruction reads the 16-bit value at SP (which is 2004) in this case and transfers it to BX. After that, it adds 2 to the SP (it becomes 2006). After this instruction BX = 0500
This instruction does the same as above, but takes the value at 2006 and places it in BP. SP then becomes 2008. BP = 0400
Now the operation of this instruction is different depending on the memory model. Since you have already stated that the program is in small memory model. I will assume that the RET is a NEAR return (in that the stack segment register isnt popped, just the IP). So after this near return (a return that does not change the SS register).
IP = 0300 SP = 2010
So after all this is done, simply compile the results.
We try not to do homework for those who haven't at least tried to do it themselves. 2005 (a distant relative of 7of9?) hasn't a clue how to start. just giving him answers won't help.
jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
I never stop finding it hilarious how people carefully point out that it was wrong to post such question in here, yet they continue to give a detailed answer.
Even worse in this case, a question so absurd that it can not be more obvious that it is homework --- but you go ahead and spell out all the details of his homework, so that he doesn't even have to bother to try to understand; just take what you wrote and submit it as his solution, for full marks...
So, he got this homework done by someone else, will get a degree with fuckall knowledge, and will be designing your mad house heater. Rejoice, though, it could yet be your car's steering and brakes.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.