Link to home
Start Free TrialLog in
Avatar of Adun
Adun

asked on

How to make a "call es:bx" in Turbo C in-line assembly? thanks

Hi there,
I want to insert a call function in Turbo C like this, CALL ES:BX
but seems it does not work.
what is the correct syntax pls?
thanks!
Avatar of dbrunton
dbrunton
Flag of New Zealand image

If you don't have Turbo Assembler in your system assembly won't work.

Assuming you do then try

asm   call   es:bx
Avatar of Adun
Adun

ASKER

Hi dbrunton,
Thanks for ur reply.
I do have tasm.exe and i tried

asm call es:bx

the tasm issued me a warning saying:
":" operator ignored.
then i run the generated exe file. it just hangs...

Below is what i typed in Turbo C 2.0 IDE

#include ....
void main(void)
{
int i;
asm mov ax, 0x4310
asm int 0x2F
asm mov ah,0x00
asm call es:bx
asm mov i,ax
printf("%X",i);
}

the INT 2FH with AX=4310H is to put Dos Extended Memory Driver Control address into ES:BX
then calling ES:BX with AH=0x00 means to get XMS driver version into AX.
but against all that, it simply hangs...
pls HELP!
ASKER CERTIFIED SOLUTION
Avatar of dbrunton
dbrunton
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adun

ASKER

Hi, thanks again for ur help.
I tried the first bit and the AL does return 80H, which means Extended memory is installed.
But when i tried to set AX=4310H then call es:bx, it hangs...
Maybe i should use call [es]:[bx] or call [es]:bx or something?
Thanks.
Try storing the es and bx address into a variable and then call that.

This is what the second code fragment I posted is doing.  Now why you have to do that I don't know.

The method you show "seemingly" should work but isn't.