My book said:"when you use "CALL" instruction! it's same as the following instruction:
push cs
push ip
jmp far ptr badge"
One thing! I don't understand
when i use CALL instruction
and pop data to ax register
the data is ....
For example:
in debug!
first !use -R and IP=0000
then use -t and IP=0003
-t IP=0009
-t ax=0008 ;right here
why is 0008?
I want know how to get this address!
when I ask my friend this question ,they said!just remember:IP is always point to next instruction's address!
it make very helpless
so ! here's master. tell me please!
I think(just conjecture):
CALL occupied 2 byte
far occupide 1byte
ptr occupide 1byte
"some badge" 1byte
so IP=IP+2+1+1+1=0008!
Is right? master!!!
push cs
push ip
jmp far ptr badge"
One thing! I don't understand
when i use CALL instruction
and pop data to ax register
the data is ....
For example:
code segment
start: mov ax,0000h
call far ptr s
inc ax
s: pop ax
pop bx
mov ax,4c00h
int 21h
code ends
end start
end start
in debug!
first !use -R and IP=0000
then use -t and IP=0003
-t IP=0009
-t ax=0008 ;right here
why is 0008?
I want know how to get this address!
when I ask my friend this question ,they said!just remember:IP is always point to next instruction's address!
it make very helpless
so ! here's master. tell me please!
I think(just conjecture):
CALL occupied 2 byte
far occupide 1byte
ptr occupide 1byte
"some badge" 1byte
so IP=IP+2+1+1+1=0008!
Is right? master!!!
When you stop the execution and see that ax is 8, the "pop ax" instruction, which is -apparently- located at address 8, has already been executed. So, at this exact point, IP points to the NEXT instruction. IP, indeed, points to the instruction which is about to be executed.
Try stopping the execution BEFORE the "pop ax". You'll see that IP points to this instruction (should be 8, from what I see) and 'ax' still holds the value of 0. Now execute this single instruction. The contents of ax will change and IP will increase to point to the following instruction.
I hope it's clear enough now ^^
And 1 more thing:
"call far address" does "push cs; push ip", while "call near address" does "push ip" (no cs). Never forget this difference.
Try stopping the execution BEFORE the "pop ax". You'll see that IP points to this instruction (should be 8, from what I see) and 'ax' still holds the value of 0. Now execute this single instruction. The contents of ax will change and IP will increase to point to the following instruction.
I hope it's clear enough now ^^
And 1 more thing:
"call far address" does "push cs; push ip", while "call near address" does "push ip" (no cs). Never forget this difference.
thanks for your help!