Function Global_Dos_Alloc (Len : longint) : longint;
Global_Dos_Alloc allocates a block of memory with length Len from the DOS memory pool, i.e. memory below the 1 MB boundary that is controlled by DOS. Such memory blocks are typically used to exchange data with real mode programs, TSRs, or device drivers.
The function returns both the real mode segment base address of the block and one or more descriptors that can be used by protected mode applications to access the block. The high word is the selector to this block, and the low word the DOS real mode segment. The offset of this block is always zero.
Notes:
None.
uses go32; procedure dosalloc (var selector : word; var segment : word; size : longint); var result : longint; begin result := global_dos_alloc(size); selector := word(result); segment := word(result shr 16); end; procedure dosfree(selector : word); begin global_dos_free(selector); end; var selector : word; segment : word; r : trealregs; begin fillchar(r, sizeof(r), 0); fillchar(any_record, sizeof(any_record), 0); dosalloc(selector, segment, sizeof(VBE_vgainfo)); { allocate a real mode memory block } any_record.any_entry := 1000; dosmemput(segment, 0, any_record, sizeof(any_record)); { copy the record to real mode memory } r.realeax := $0000; r.reales := segment; r.realedi := 0; realintr(IntNr, r); { do our interrupt } dosmemget(segment, 0, any_record, sizeof(any_record)); { get the record from real mode memory } dosfree(selector); { free selector afterwards } end.