Dec 052017
 
Turbo Pascal Source to store data in XMS with ASM source. Gives example which stores 1 MB array of 126 character strings in memory.
File XMSDATA2.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Turbo Pascal Source to store data in XMS with ASM source. Gives example which stores 1 MB array of 126 character strings in memory.
File Name File Size Zip Size Zip Type
READ.ME 1642 823 deflated
XMM.ASM 19029 3650 deflated
XMM.OBJ 824 450 deflated
XMS.EXE 6642 6323 deflated
XMS.PAS 19023 3497 deflated

Download File XMSDATA2.ZIP Here

Contents of the READ.ME file


Not long ago I wrote a dumb little article on assembler interfacing in
which I included an example to access the XMS control function. Here
are the completed functions for Turbo Pascal which I am now using in my
programs. I uploaded another version of this code which was limited in
error checking and did not give a very good example of the XMS memory
move function.

This example shows how to move a 1 MB array of 127 character strings to
XMS and back to a string in base memory. Since XMS does not like odd
length moves, I am really moving only 126 bytes into a 127 character
string variable. Change the length in the MoveRec.Len function to 127
and you'll get an A7 error for invalid move length.

A couple of difficult concepts are covered in this code particularly for
Pascal programmers. Turbo Pascal does not have "Assembler like" types,
so a few fudge factors have been inserted. First, I have moved the data
to and from XMS from a Pointer calculated 1 byte past the address of the
string. This is to bypass the length byte of Pascal strings. I have
used the FILLCHAR proceedure of Pascal like a Malloc in C to allocate
the space for the move from XMS filling the string with spaces. Last, I
have used the PTR proceedure of pascal to calculate a true 32 bit
pointer offset from the XMS Handle. Those who are used to 20 bit
pointers of 8086 may be confused for a bit like I was, but will have a
working example here to study for a few minutes. It took me more than a
few minutes to get used to a true 32 bit pointer, but arrays much larger
than this are possible by the same means. Have fun.




 December 5, 2017  Add comments

Leave a Reply