home *** CD-ROM | disk | FTP | other *** search
- /*
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒C▒O▒M▒P▒I▒L▒E▒R▒▒▒▒▒▒▒▒▒▒▒S▒O▒F▒T▒W▒A▒R▒E▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ ▒▒
- ▒▒ MODOX.h ▒▒
- ▒▒ ▒▒
- ▒▒ Esta librería es introductoria y a partir del próximo número estará ▒▒
- ▒▒ completamente optimizada para 286+ usando assembler en su mayor ▒▒
- ▒▒ parte. Para usarla en tus programas debe estar en el directorio ac- ▒▒
- ▒▒ tual en el momento de la compilación e incluir la línea: ▒▒
- ▒▒ ▒▒
- ▒▒ #include "MODOX.h" ▒▒
- ▒▒ ▒▒
- ▒▒ 1996 Compiler SoftWare. Para dudas y contactos leer el fichero de ▒▒
- ▒▒ texto COMPILER.NFO ▒▒
- ▒▒ ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- */
-
- #include <dos.h> /* outport */
-
- #define SEQU_ADDR 0x3c4
- #define CRTC_ADDR 0x3d4
- #define GRAC_ADDR 0x3ce
-
- /*
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ DECLARACIONES DE FUNCIONES ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- */
-
- void Set_320x200X ( void );
- void Set_320x240X ( void );
- void PutPixelX( int, int, char );
- unsigned char GetPixelX( int, int );
-
- /*
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ Set_320x200X(); ▒▒
- ▒▒ ▒▒
- ▒▒ Inicializa el Modo 13X de 320x200 a 256 colores en sistema 1x4. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- */
-
- void Set_320x200X ( )
- {
- asm mov ax , 13h /* inicializamos modo 13h estándar */
- asm int 10h
-
- outport( SEQU_ADDR , 0x0604 ); /* ponemos el bit CHAIN-4 a 0 */
- outport( CRTC_ADDR , 0xE317); /* ajuste del modo de palabras */
- outport( CRTC_ADDR , 0x0014); /* ajuste del modo de dobles palabras */
- outport( SEQU_ADDR , 0x0F02); /* seleccionar los cuatro planos para...*/
-
- asm { /* ...borrar la pantalla */
- mov ax , 0xA000
- mov es , ax
- xor di , di
- xor ax , ax
- mov cx , 0x8000
- rep stosw
- }
- }
-
-
- /*
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ Set_320x240X(); ▒▒
- ▒▒ ▒▒
- ▒▒ Inicializa el Modo X de 320x240 a 256 colores en sistema 1x4. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- */
-
- void Set_320x240X( )
- {
-
- Set_320x200X( ); /* primero inicializamos 13X */
-
- outportb(0x3C2, 0xE3);
- outport(CRTC_ADDR, 0x2C11); /* permitir escritura */
- outport(CRTC_ADDR, 0x0D06); /* Total vertical */
- outport(CRTC_ADDR, 0x3E07); /* Overflow Register */
- outport(CRTC_ADDR, 0xEA10); /* Vertical retrace start */
- outport(CRTC_ADDR, 0xAC11); /* Vertical retrace end y Write prot. */
- outport(CRTC_ADDR, 0xDF12); /* Vertical display enable end */
- outport(CRTC_ADDR, 0xE715); /* Start vertical blanking */
- outport(CRTC_ADDR, 0x0616); /* End vertical blanking */
-
- }
-
-
- /*
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ PutPixelX(); ▒▒
- ▒▒ ▒▒
- ▒▒ Coloca un punto en la primera página en (X,Y) de color color. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- */
-
- void PutPixelX( int x, int y, char color )
- {
- unsigned int offs;
-
- outportb( SEQU_ADDR , 0x02 ); /* función seleccionar plano */
- outportb( SEQU_ADDR+1, 0x01 << ( x & 3 ) ); /* esto calcula automáticamente
- el plano a partir de los 2
- últimos bits de la coord.x*/
-
- offs = (y<<6) + (y<<4) + (x>>2); /* calculamos el offset */
- /* esta línea equivale a
- off = (80*y) + (x/4) ;
- pero es MUCHO más rápida.*/
- asm {
- mov ax , 0xa000
- mov es , ax
- mov di , offs
- mov al , color
- stosb /* ponemos el punto */
- }
- }
-
- /*
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ GetPixelX(); ▒▒
- ▒▒ ▒▒
- ▒▒ Devuelve el color de un pixel en (X,Y) en sistema 1x4. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- */
-
- unsigned char GetPixelX(int x, int y)
- {
- unsigned int offs;
-
- outport(GRAC_ADDR, 0x04);
- outport(GRAC_ADDR+1, x & 3 ); /* nº de plano */
-
- offs = (y<<6) + (y<<4) + (x>>2); /* calculamos el offset */
- /* esta línea equivale a
- off = (80*y) + (x/4) ;
- pero es MUCHO más rápida.*/
- asm {
- mov ax , 0xa000
- mov es , ax
- mov di , offs /* lo leemos */
- mov al, es:[di]
- }
-
- return( _AL ); /* y lo devolvemos */
- }
-
-