For Programmers: Free Programming Magazines  


Home > Archive > ASM370 > September 2006 > Re: call instruction









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: call instruction
Wendy E. McCaughrin

2006-09-14, 6:56 pm

CN99 <leon800219@yahoo.com.cn> wrote:
: Hi all:

: Can anybody tell me what the value will be in ax, after the 'call' excuted,
: and why? Thanks!
: To me:
: pop ax // ax = 8
: add ax, ax // ax = 16
: pop bx // bx = 1000
: add ax, bx // ax = 1000 + 16 -> 1016?

Looks like you are at segment = 10x1000, but at what offset?
I am guessing this is a DOS program, with origin offset = 0x100.

: 1000:0 b8 00 00 mov ax, 0
: 1000:3 9A 09 00 00 10 call far ptr s

This sets [stack-top] = return-address 0x0100 + 8 = 0x0108.

: 1000:8 8 40 inc ax
: 1000:9 9 58 s:pop ax
: add ax, ax
: pop bx
: add ax, bx

At label s, the return-address (0x0108) is popped into AX. What
was [stack-top] before the call? That determines contents of BX.

Sven Pran

2006-09-14, 6:56 pm

Wrong group - this is for S/370 /IBM mainframes)
Sven

"Wendy E. McCaughrin" <wemccaug@bluestem.prairienet.org> wrote in message
news:eec6fq$n02$1@wildfire.prairienet.org...
> CN99 <leon800219@yahoo.com.cn> wrote:
> : Hi all:
>
> : Can anybody tell me what the value will be in ax, after the 'call'
> excuted,
> : and why? Thanks!
> : To me:
> : pop ax // ax = 8
> : add ax, ax // ax = 16
> : pop bx // bx = 1000
> : add ax, bx // ax = 1000 + 16 -> 1016?
>
> Looks like you are at segment = 10x1000, but at what offset?
> I am guessing this is a DOS program, with origin offset = 0x100.
>
> : 1000:0 b8 00 00 mov ax, 0
> : 1000:3 9A 09 00 00 10 call far ptr s
>
> This sets [stack-top] = return-address 0x0100 + 8 = 0x0108.
>
> : 1000:8 8 40 inc ax
> : 1000:9 9 58 s:pop ax
> : add ax, ax
> : pop bx
> : add ax, bx
>
> At label s, the return-address (0x0108) is popped into AX. What
> was [stack-top] before the call? That determines contents of BX.
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com