d87-vik@dront.nada.kth.se (Ville K{rkk{inen) (10/20/90)
Organization: Royal Institute of Technology, Stockholm, Sweden I'm trying to access the Int 10 Function 13 ( Write string in teletype mode ) from Microsoft C 5.10. Everything has worked out fine so far, but today I found out that the calling convention requires the offset of the string to be stored in the BP register ! (BasePointer actually). Now I wonder, is there a way to set the BP from C, or do I have to write a .asm-hack that first saves the BP before the actual call, and then restores it.(Which if I'm not wrong requires an update to MSC 6.0) Any comments appreciated ! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ----- We are confronted with vaste quantities of plastic people. F Zappa ------ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Ville.
gday@digigw.digital.co.jp (Gordon Day) (10/23/90)
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