Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.os.msdos.programmer Subject: Re: XMS transfer troubles with Turbo C Date: Sat, 26 Jul 2014 13:21:23 -0400 Organization: Aioe.org NNTP Server Lines: 48 Message-ID: References: <53d13fd3$0$2229$426a74cc@news.free.fr> <53d3bc6c$0$2043$426a74cc@news.free.fr> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.os.msdos.programmer:1453 On Sat, 26 Jul 2014 10:34:20 -0400, Mateusz Viste wrote: > That's what I did today - I removed my C operations on registers, and > replaced them with inline ASM. So far, thing didn't changed, but I am > not really sure what such thing mean: > > call [dword cs:XMSDriver] > > Specifically, what's the "cs:" for? XMSDriver is a DWORD that contains > the address of an external function. CS is a code segment override. It tells the processor to use the code segment register for the segment (in RM, descriptor in PM). Normally, the processor uses the data segment register for the segment for data, except for a few instructions. In 16-bit RM, this has to do with the segment:offset addressing: address = segment * 16 + offset So, if the CS segment and DS segment are both 0 then the then CS:0 and DS:0 point to the same address. But, if the CS segment and DS segment are different, then their addresses would be different. I suspect that you don't want CS here. CS is the CS of your code, not the CS of the XMSDriver. You want the segment of the XMSDriver which was returned by Int 2fh, AH=4310h. It also takes a jump to set CS. You can't move a value into CS like you can with DS, ES, FS, GS. If you need to set the segment for the call to the XMSDriver, you probably want to use a segment register other than CS, and the appropriate segment register override. You can use DS temporarily, but I'd suggest ES if it's not in use. For 386 (or 486?) or later, you can use FS or GS (on processors where PM is available). Assuming you've saved the segment and offset from Int 2fh, AH=4310h like in the XMS 3.0 specification, you'd do something like: mov es, [XMSDriver+2] ; saved segment call [dword es:XMSDriver] You can push and pop es, if needed. Rod Pemberton