/**************************************************************************/ /* Demostracion de la Clase XmsSupp */ /* */ /* Compilar en Modo Compact, Large o Huge */ /* Linkar con XMSSUPP.OBJ */ /**************************************************************************/ #include #include #include #include #include #include #include #include #include "XMSSUPP.H" void SetVideoMode(unsigned char Mode) { _asm{ mov ah,0x00; mov al,Mode; int 0x10; } } void main() { XmsSupp TestXms; // Clase de Soporte XMS. unsigned char *Pantalla; // Puntero a Memoria Convencional. int Cnt; // Contador para bucle while(kbhit()) getch(); // Errores en Inicializacion XMS. TestXms.lError=0; // Indicador de Error a cero InitXms(&TestXms); // Inicializa XMS. GetInfo(&TestXms); // Informe de estado. while(!kbhit()); getch(); // Xms_Init(&TestXms); if(TestXms.lError) { printf("%s\n",TestXms.cError); return; } // Reservamos 64K. Si hay Error lo Visualizamos. AllocXms(64, &TestXms); if(TestXms.lError) printf("%s\n",TestXms.cError); // Reservamos Memoria Convencional. if(!(Pantalla=new unsigned char [64000])) printf("ERROR en Reserva de Memoria Convencional.\n"); else { // Construimos Pantalla for(Cnt=0;Cnt<200;Cnt++) memset((Pantalla+(Cnt*320)),Cnt,320); // Asignamos Puntero a Memoria convencional y miramos si // hay ERROR. SetConPntr(Pantalla, &TestXms); if(TestXms.lError) printf("%s\n",TestXms.cError); // Movemos a XMS y si hay ERROR lo Visualizamos. Move2Xms(&TestXms); if(TestXms.lError) printf("%s\n",TestXms.cError); SetConPntr(MK_FP(0xA000,0), &TestXms); // Activamos Video MCGA. SetVideoMode(0x13); // Movemos a Convencional y si hay ERROR lo Visualizamos. Move2Con(&TestXms); if(TestXms.lError) { SetVideoMode(0x3); printf("%s\n",TestXms.cError); } getch(); SetVideoMode(0x3); // Liberamos XMS si hay ERROR lo Visualizamos. FreeXms(&TestXms); if(TestXms.lError) printf("%s\n",TestXms.cError); } // Liberamos Memoria Convencional. delete Pantalla; return; }