home *** CD-ROM | disk | FTP | other *** search
- {▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒C▒O▒M▒P▒I▒L▒E▒R▒▒▒▒▒▒▒▒▒▒▒S▒O▒F▒T▒W▒A▒R▒E▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ ▒▒
- ▒▒ MODOX.INC ▒▒
- ▒▒ ▒▒
- ▒▒ 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 directiva entre ▒▒
- ▒▒ llaves : ▒▒
- ▒▒ ▒▒
- ▒▒ $I MODOX.INC ▒▒
- ▒▒ ▒▒
- ▒▒ Set_320x200X --> Establece modo 320x200x4 planos ▒▒
- ▒▒ Set_320x240X --> Establece modo 320x240x4 planos ▒▒
- ▒▒ PutPixelX --> Pone un punto en la coord x,y de color 'color' ▒▒
- ▒▒ GetPixelX --> Devuelve el color de la coordenada x, y ▒▒
- ▒▒ ▒▒
- ▒▒ 1996 Compiler SoftWare. Para dudas y contactos leer el fichero de ▒▒
- ▒▒ texto COMPILER.NFO del subdirectorio INFO. ▒▒
- ▒▒ ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒;-)▒▒▒▒}
-
- Uses crt, dos;
-
- CONST
- SEQU_ADDR = $3c4;
- CRTC_ADDR = $3d4;
- GRAC_ADDR = $3ce;
-
- {
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ DECLARACIONES DE FUNCIONES ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- }
-
- {
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ Set_320x200X; ▒▒
- ▒▒ ▒▒
- ▒▒ Inicializa el Modo 13X de 320x200 a 256 colores en sistema 1x4. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- }
-
- Procedure Set_320x200X;
- Begin
- asm mov ax , 13h { inicializamos modo 13h estándar }
- int 10h
- end;
-
- portw[ SEQU_ADDR] := $0604; { ponemos el bit CHAIN-4 a 0 }
- portw[ CRTC_ADDR] := $E317; { ajuste del modo de palabras }
- portw[ CRTC_ADDR] := $0014; { ajuste del modo de dobles palabras }
- portw[ SEQU_ADDR] := $0F02; { seleccionar los cuatro planos para...}
-
- asm { ...borrar la pantalla }
- mov ax , $A000
- mov es , ax
- xor di , di
- xor ax , ax
- mov cx , 32000
- rep stosw
- end;
- end;
-
-
- {
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ Set_320x240X; ▒▒
- ▒▒ ▒▒
- ▒▒ Inicializa el Modo X de 320x240 a 256 colores en sistema 1x4. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- }
-
- Procedure Set_320x240X;
- Begin
- Set_320x200X; { primero inicializamos 13X }
-
- port [$3C2] := $E3;
- portw[CRTC_ADDR] := $2C11; { permitir escritura }
- portw[CRTC_ADDR] := $0D06; { Total vertical }
- portw[CRTC_ADDR] := $3E07; { Overflow Register }
- portw[CRTC_ADDR] := $EA10; { Vertical retrace start }
- portw[CRTC_ADDR] := $AC11; { Vertical retrace end y Write prot. }
- portw[CRTC_ADDR] := $DF12; { Vertical display enable end }
- portw[CRTC_ADDR] := $E715; { Start vertical blanking }
- portw[CRTC_ADDR] := $0616; { End vertical blanking }
-
- end;
-
-
- {
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ PutPixelX (integer x, integer y, byte color); ▒▒
- ▒▒ ▒▒
- ▒▒ Coloca un punto en (X,Y) de color color. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- }
-
- Procedure PutPixelX( x, y : integer;color : byte ) ;
-
- Var offs : word;
-
- Begin
- port[ SEQU_ADDR] := $02 ; { función seleccionar plano }
- port[ SEQU_ADDR+1] := 1 shl ( x and 3 ) ; { esto calcula automáticamente
- el plano a partir de los 2
- últimos bits de la coord.x}
-
- offs := (y shl 6) + (y shl 4) + (x shr 2); { calculamos el offset }
- { esta línea equivale a
- off = (80*y) + (x/4) ;
- pero es MUCHO más rápida.}
- asm
- mov ax , $a000
- mov es , ax
- mov di , offs
- mov al , color
- stosb { ponemos el punto }
- end;
- end;
-
- {
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒▒ GetPixelX(integer x, integer y); ▒▒
- ▒▒ ▒▒
- ▒▒ Devuelve el color de un pixel en (X,Y) en sistema 1x4. ▒▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- }
-
- Function GetPixelX(x, y : integer) : byte;
-
- Var offs : word;
- valor : byte;
- Begin
- port[GRAC_ADDR] := $04;
- port[GRAC_ADDR+1] := x and 3 ; { nº de plano }
-
- offs := (y shl 6) + (y shl 4) + (x shr 2); { calculamos el offset }
- { esta línea equivale a
- off = (80*y) + (x/4) ;
- pero es MUCHO más rápida.}
- asm
- mov ax , $a000
- mov es , ax
- mov di , offs { lo leemos }
- mov al, es:[di]
- mov [valor], al
- end;
-
- GetPixelX := valor; { y lo devolvemos }
- end;
-
-