Mail Archives: djgpp/2001/04/30/06:28:00
On Sun, 29 Apr 2001, Rafal Maj wrote:
> I'm using modem, so I REALY can't read online documentation or FAQ
> for DJGPP.
Download faq230b.zip, and you will be able to read it on your local
machine.
> How can I write code like this :
>
> mov AX,0x10
> int 0x13
#include <dpmi.h>
__dpmi_regs r;
r.x.ax = 0x10;
_dpmi_int (0x13, &r);
> I want to use assembler direct inside my C++ functions like:
> int main() { _asm { mov AX,0x10 } }
What do you need assembly for? Issuing real-mode interrupts from a
protected-mode program has a large overhead (due to the need to switch
the CPU from protected to real mode and back), so any advantages of
doing so with inline assembly are null and void.
See section 17.8 of the FAQ for more details.
> How can I fill memory from A000:0000 to A000:0FFF with pattern of increasing
> bytes ? Something like this :
>
> mov cx,0x0FFF
> xor dl,dl
> begin :
> mov bx:cx, dl
> inc dl
> dec cx
> loop begin
Use the _farpokeb/_farnspokeb library functions. Example (untested):
#include <sys/farptr.h>
_farsetsel (_dos_ds);
for (i = 0; i < 0x1000; i++)
_farnspokeb (i + 0xa0000, i);
When compiled with -O2, this loop will expand into inline assembly
with only a couple of instructions in the body of the loop. See
sections 18.4 and 18.6 of the FAQ for more details.
- Raw text -