Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
MOVEMEM.C
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
/* MOVEMEM.C illustrates direct memory access using functions:
* movedata FP_SEG FP_OFF
*
* Also illustrated:
* #pragma pack
*
* See COPY2.C, ALARM.C, and SYSCALL.C for more examples of FP_SEG
* and FP_OFF.
*/
#include <memory.h>
#include <stdio.h>
#include <dos.h>
#pragma pack( 1 ) /* Use pragma to force packing on byte boundaries. */
struct LOWMEMVID
{
char vidmode; /* 0x449 */
unsigned scrwid; /* 0x44A */
unsigned scrlen; /* 0x44C */
unsigned scroff; /* 0x44E */
struct LOCATE
{
unsigned char col;
unsigned char row;
} csrpos[8]; /* 0x450 */
struct CURSIZE
{
unsigned char end;
unsigned char start;
} csrsize; /* 0x460 */
char page; /* 0x462 */
} vid;
struct LOWMEMVID _far *pvid = &vid;
void main()
{
int page;
/* Move system information into uninitialized structure variable. */
movedata( 0, 0x449, FP_SEG( pvid ), FP_OFF( pvid ), sizeof( vid ) );
printf( "Move data from low memory 0000:0449 to structure at %Fp\n\n",
(void _far *)&vid );
printf( "Mode:\t\t\t%u\n", vid.vidmode );
printf( "Page:\t\t\t%u\n", vid.page );
printf( "Screen width:\t\t%u\n", vid.scrwid );
printf( "Screen length:\t\t%u\n", vid.scrlen );
printf( "Cursor size:\t\tstart: %u\tend: %u\n",
vid.csrsize.start, vid.csrsize.end );
printf( "Cursor location:\t" );
for( page = 0; page < 8; page++ )
printf( "page:\t%u\tcolumn: %u\trow: %u\n\t\t\t",
page, vid.csrpos[page].col, vid.csrpos[page].row );
}