🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2770

Re: Int 10H Function 13H - How Do I access BP from C ?

#2770
From: Gordon Day
Date: Tue, 23 Oct 1990 09:50
27 lines
1942 bytes
In article <1990Oct21.204236.22011@nada.kth.se>, d87-vik@dront.nada.kth.se (Ville K{rkk{inen) writes:
> 
> My problem is that Int10h-Func13h requires the offset of my data to be stored
> in BP,that is, the BasePointer. Note this,BP is a pointer, not a register
> defined in the REGS union. 

Unfortunately, you can't do this from Microsoft C (at least, not without some
inline assembler).  The value of a specific register cannot be read or changed
from C on the PC which is why the interrupt-type functions provided by the MSC
libraries are implemented in assembly.  The reason is that the definition 
of the language doesn't support the idea of "named" registers, that is, a 
mapping of a special variable name directly to a physical machine register.  
There is nothing stopping a compiler implementor from doing this (e.g. the 
VAX based BSD4.3 C compiler), but no compilers (to my knowledge) on the PC do,
as it is both easier and much less of a bad hack to provide an assembly 
based library routine to do it.  

So, you'll have to grit your teeth and write a new "int86x()" that takes a 
REGS-type struct that includes a value to/from the BP register.  It's not a
terribly difficult thing to do, just remember not trash your stack frame.

> So please have patience with me and give it a little thought.

Consider it done.


Gordon W. Day
Technical Details
Message-ID: <685@digigw.digital.co.jp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cs.utexas.edu!sun-barr!ccut!wnoc-tyo-news!astemgw!icspub!creamy!oucom2!digigw!gday
References: <1990Oct19.202013.28397@nada.kth.se> <1990Oct21.204236.22011@nada.kth.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cs.utexas.edu!sun-barr!ccut!wnoc-tyo-news!astemgw!icspub!creamy!oucom2!digigw!gday
From: gday@digigw.digital.co.jp (Gordon Day)
Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer
Subject: Re: Int 10H Function 13H - How Do I access BP from C ?
Summary: Some Assembly required.
Message-ID: <685@digigw.digital.co.jp>
Date: 23 Oct 90 09:50:45 GMT
References: <1990Oct19.202013.28397@nada.kth.se> <1990Oct21.204236.22011@nada.kth.se>
Followup-To: comp.os.msdos.programmer
Organization: Digital Electronics Corp., Osaka, Japan
Lines: 27