@node _go32_dpmi_get_free_memory_information, dpmi @subheading Syntax @example #include int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs); @end example @subheading Description @xref{DPMI Overview}. This function simulates a real-mode far call to a function that returns with a far return. The registers are set up from @var{regs}, including @code{CS} and @code{IP}, which indicate the address of the call. Any registers the function modifies are reflected in @var{regs} on return. If @code{SS} and @code{SP} are both zero, a small temporary stack is used when in real mode. If not, they are used @emph{as is}. It's a good idea to use @code{memset} to initialize the register structure before using it. @subheading Return Value Zero on success, nonzero on failure. @subheading Portability @portability !ansi, !posix @subheading Example @example _go32_dpmi_registers r; r.x.ax = 47; r.x.cs = some_segment; r.x.ip = some_offset; r.x.ss = r.x.sp = 0; _go32_dpmi_simulate_fcall(&r); printf("returns %d\n", r.x.ax); @end example @c ---------------------------------------------------------------------- @node _go32_dpmi_simulate_fcall_iret, dpmi @subheading Syntax @example #include int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs); @end example @subheading Description @xref{DPMI Overview}. This function simulates a real-mode far call to a function that returns with an @code{iret} instruction. The registers are set up from @var{regs}, including @code{CS} and @code{IP}, which indicate the address of the call. Any registers the function modifies are reflected in @var{regs} on return. If @code{SS} and @code{SP} are both zero, a small temporary stack is used when in real mode. If not, they are used @emph{as is}. It's a good idea to use @code{memset} to initialize the register structure before using it. @subheading Return Value Zero on success, nonzero on failure. @subheading Portability @portability !ansi, !posix @subheading Example @example _go32_dpmi_registers r; r.x.ax = 47; r.x.cs = some_segment; r.x.ip = some_offset; r.x.ss = r.x.sp = 0; _go32_dpmi_simulate_fcall_iret(&r); printf("returns %d\n", r.x.ax); @end example @c ---------------------------------------------------------------------- @node _go32_dpmi_simulate_int, dpmi @subheading Syntax @example #include int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs); @end example @subheading Description @xref{DPMI Overview}. This function simulates a real-mode interrup. The registers are set up from @var{regs}, including @code{CS} and @code{IP}, which indicate the address of the call. Any registers the function modifies are reflected in @var{regs} on return. If @code{SS} and @code{SP} are both zero, a small temporary stack is used when in real mode. If not, they are used @emph{as is}. It's a good idea to use @code{memset} to initialize the register structure before using it. @subheading Return Value Zero on success, nonzero on failure. @subheading Portability @portability !ansi, !posix @subheading Example @example _go32_dpmi_registers r; r.h.ah = 0x08; r.h.dl = 0x80; /* drive C: */ r.x.ss = r.x.sp = 0; _go32_dpmi_simulate_int(0x13, &r); printf("disk is %d cyl, %d head, %d sect\n", r.h.ch | ((r.x.cl<<2)&0x300), r.h.dh, r.h.cl & 0x3f)); @end example @c ---------------------------------------------------------------------- @node _go32_my_cs, go32 @subheading Syntax @example #include u_short _go32_my_cs(); @end example @subheading Description Returns the current @code{CS}. This is useful for setting up interrupt vectors and such. @subheading Return Value @code{CS} @subheading Portability @portability !ansi, !posix @c ---------------------------------------------------------------------- @node _go32_my_ds, go32 @subheading Syntax @example #include u_short _go32_my_ds(); @end example @subheading Description Returns the current @code{DS}. This is useful for moving memory and such. @subheading Return Value @code{DS} @subheading Portability @portability !ansi, !posix @c ---------------------------------------------------------------------- @node _go32_my_ss, go32 @subheading Syntax @example #include u_short _go32_my_ss(); @end example @subheading Description Returns the current @code{SS}. This is useful for moving memory and such. @subheading Return Value @code{SS} @subheading Portability @portability !ansi, !posix @c ---------------------------------------------------------------------- @node _go32_conventional_mem_selector, go32 @subheading Syntax @example #include u_short _go32_conventional_mem_selector(); @end example @subheading Description This function returns a selector which has a physical base address corresponding to the beginning of conventional memory. This selector can be used as a parameter to @code{movedata} (@pxref{movedata}) to manipulate memory in the conventional address space. @subheading Return Value The selector. @subheading Portability @portability !ansi, !posix @subheading Example @example short blank_row_buf[ScreenCols()]; /* scroll screen */ movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2, _go32_conventional_mem_selector(), 0xb8000, ScreenCols() * (ScreenRows()-1) * 2); /* fill last row */ movedata(_go32_my_ds, (int)blank_row_buf, _go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*(ScreenRows()-1)*2, ScreenCols() * 2); @end example