diff --git a/bin/SDL_image.dll b/bin/SDL_image.dll index 9b371caf..f6fde646 100644 Binary files a/bin/SDL_image.dll and b/bin/SDL_image.dll differ diff --git a/bin/libpng13.dll b/bin/libpng13.dll deleted file mode 100644 index e328d395..00000000 Binary files a/bin/libpng13.dll and /dev/null differ diff --git a/bin/libpng14-14.dll b/bin/libpng14-14.dll new file mode 100644 index 00000000..fdad385e Binary files /dev/null and b/bin/libpng14-14.dll differ diff --git a/doc/COMPILING.txt b/doc/COMPILING.txt index a5c3c0f4..271c656a 100644 --- a/doc/COMPILING.txt +++ b/doc/COMPILING.txt @@ -125,7 +125,7 @@ Zlib: Libpng Requires: Zlib http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/l/li/libpng/ - libpng-1.0.23.tar.gz + libpng-1.4.2.tar.gz (Before June 2010, we were using libpng-1.0.23.tar.gz) Uncompress in temporary directory ./configure make diff --git a/doc/PF_fonts.txt b/doc/PF_fonts.txt new file mode 100644 index 00000000..ce31cde6 --- /dev/null +++ b/doc/PF_fonts.txt @@ -0,0 +1,21 @@ +Fonts by Yusuke Kamiyamane +http://p.yusukekamiyamane.com/fonts/ + +License: "The fonts can be used free for any personal or commercial projects." + +- Arma Five +- Ronda Seven +- Easta Seven +- Westa Seven +- Tempesta Seven +- Tempesta Five + + + +Converted to Sfont format by yrizoud +Changed filenames for better sorting: + for Compressed +_ for Condensed +__ for Normal +___ for Extended + diff --git a/doc/README-SDL.txt b/doc/README-SDL.txt index 21be0145..88914419 100644 --- a/doc/README-SDL.txt +++ b/doc/README-SDL.txt @@ -1,16 +1,16 @@ -The following file: - - SDL.dll - -is the runtime environment for the SDL library. - -The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library -designed to make it easy to write multi-media software, such as games and -emulators. - -The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ - -This library is distributed under the terms of the GNU LGPL license: -http://www.gnu.org/copyleft/lesser.html - +The following file: + + SDL.dll + +is the runtime environment for the SDL library. + +The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library +designed to make it easy to write multi-media software, such as games and +emulators. + +The Simple DirectMedia Layer library source code is available from: +http://www.libsdl.org/ + +This library is distributed under the terms of the GNU LGPL license: +http://www.gnu.org/copyleft/lesser.html + diff --git a/doc/README-SDL_image.txt b/doc/README-SDL_image.txt index 052582ac..3b57d56b 100644 --- a/doc/README-SDL_image.txt +++ b/doc/README-SDL_image.txt @@ -1,19 +1,19 @@ -The following file - - SDL_image.dll - -is the runtime environment for the library SDL_image 1.2.8 by Sam Lantiga and Mattias Engdegård. - -This library is distributed under the terms of the GNU LGPL license: -http://www.gnu.org/copyleft/lesser.html - -The source is available from the libraries page at the SDL website: -http://www.libsdl.org/ - -========================= - -Compiled by yrizoud on 21/10/2009 with static builds of : - libjpeg (JPEG library http://www.ijg.org/ release 6b of 27-Mar-1998 : jpegsr6.zip) - libtiff (TIFF library ftp://ftp.sgi.com/graphics/tiff/ : tiff-v3.4-tar.gz) -And dynamic version of : - libpng (http://www.libpng.org/pub/png/libpng.html) --> libpng13.dll requirement +The following file + + SDL_image.dll + +is the runtime environment for the library SDL_image 1.2.10 by Sam Lantiga and Mattias Engdegård. + +This library is distributed under the terms of the GNU LGPL license: +http://www.gnu.org/copyleft/lesser.html + +The source is available from the libraries page at the SDL website: +http://www.libsdl.org/ + +========================= + +Compiled by yrizoud on 16/06/2010 with static builds of : + libjpeg (JPEG library http://www.ijg.org/ release 6b of 27-Mar-1998 : jpegsr6.zip) + libtiff (TIFF library ftp://ftp.sgi.com/graphics/tiff/ : tiff-v3.4-tar.gz) +And dynamic version of : + libpng (http://www.libpng.org/pub/png/libpng.html) v1.4.2 --> libpng14-14.dll requirement diff --git a/doc/README-SDL_ttf.txt b/doc/README-SDL_ttf.txt index c59d613b..176bb6f6 100644 --- a/doc/README-SDL_ttf.txt +++ b/doc/README-SDL_ttf.txt @@ -1,12 +1,12 @@ -The following files: - - SDL_ttf.dll - libfreetype-6.dll - -are the runtime environment for the library SDL_ttf 2.0 by Sam Lantiga. - -This library is distributed under the terms of the GNU LGPL license: -http://www.gnu.org/copyleft/lesser.html - -The source is available from the libraries page at the SDL website: -http://www.libsdl.org/ +The following files: + + SDL_ttf.dll + libfreetype-6.dll + +are the runtime environment for the library SDL_ttf 2.0 by Sam Lantiga. + +This library is distributed under the terms of the GNU LGPL license: +http://www.gnu.org/copyleft/lesser.html + +The source is available from the libraries page at the SDL website: +http://www.libsdl.org/ diff --git a/doc/README-lua.txt b/doc/README-lua.txt index 2d8a0b44..43eee2a9 100644 --- a/doc/README-lua.txt +++ b/doc/README-lua.txt @@ -1,24 +1,24 @@ -The Windows distribution of Grafx2 is compiled and statically linked with -Lua v5.1.4 - -Lua is licensed with the MIT license: - -Copyright © 1994-2008 Lua.org, PUC-Rio. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The Windows distribution of Grafx2 is compiled and statically linked with +Lua v5.1.4 + +Lua is licensed with the MIT license: + +Copyright © 1994-2008 Lua.org, PUC-Rio. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/doc/README-zlib1.txt b/doc/README-zlib1.txt index 5c1ac22e..02f90d30 100644 --- a/doc/README-zlib1.txt +++ b/doc/README-zlib1.txt @@ -1,53 +1,53 @@ - -What's here -=========== - The official ZLIB1.DLL - - -Source -====== - zlib version 1.2.3 - available at http://www.gzip.org/zlib/ - - -Specification and rationale -=========================== - See the accompanying DLL_FAQ.txt - - -Usage -===== - See the accompanying USAGE.txt - - -Build info -========== - Contributed by Gilles Vollant - - Compiler: Microsoft Visual C++ Toolkit 2003 - Library: Microsoft Visual C++ 6.0 (to link with MSVCRT.DLL) - - -Copyright notice -================ - (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - + +What's here +=========== + The official ZLIB1.DLL + + +Source +====== + zlib version 1.2.3 + available at http://www.gzip.org/zlib/ + + +Specification and rationale +=========================== + See the accompanying DLL_FAQ.txt + + +Usage +===== + See the accompanying USAGE.txt + + +Build info +========== + Contributed by Gilles Vollant + + Compiler: Microsoft Visual C++ Toolkit 2003 + Library: Microsoft Visual C++ 6.0 (to link with MSVCRT.DLL) + + +Copyright notice +================ + (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + diff --git a/doc/tech_eng.txt b/doc/tech_eng.txt index c6aeecb6..621d0a9e 100644 --- a/doc/tech_eng.txt +++ b/doc/tech_eng.txt @@ -1,732 +1,732 @@ -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³°±²Û Technical documentation for GrafX 2.00 - Version 1.08 (10/05/1997) Û²±°³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - -This file deals with: - - - the PKM picture format - - the values to send to the CRTC to access all the amazing video modes - available in GrafX 2.00 - - - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ °±²Û The PKM picture format - by Karl Maritaud Û²±° ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - - First of all, I'd like to say that I made this file format some years ago - when I didn't knew how to load any good format (eg. GIF) and wanted to have - my own format. - PKM format was designed to be very simple, easy to encode and decode. Its - header is very simple (short) and evolutive. - The only real default I can find in this format is that you can only save - 256-color pictures. - I know that you will think: - "Oh no just another fucking format! I'll never use it! Its compression - is too poor and I prefer GIF!". - And I'll answer: - "Yeah! You're right. But if you dunno how to load GIF and want a simple - format with a quite good compression rate (on simple pictures at least), - it could be useful." - - So, here comes the format documentation... - - - -The HEADER: -ÍÍÍÍÍÍÍÍÍÍÍ - - The header is the following 780-byte-structure. (Don't worry about the size. - That's just because the palette is considered as a part of the header). - - - ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ³ Pos ³ Field ³ Type ³ Size ³ Description ³ - ÆÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͵ - ³ 0 ³ Signature ³ char ³ 3 ³ Constant string "PKM" (with NO size ³ - ³ ³ ³ ³ ³ delimitation '\0' or so...) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 3 ³ Version ³ byte ³ 1 ³ For the moment, it can take only the ³ - ³ ³ ³ ³ ³ value 0. ³ - ³ ³ ³ ³ ³ Other packing methods may change this ³ - ³ ³ ³ ³ ³ field but there is only one for now... ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 4 ³ Pack_byte ³ byte ³ 1 ³ Value of the recognition byte for color ³ - ³ ³ ³ ³ ³ repetitions that are coded on 1 byte. ³ - ³ ³ ³ ³ ³ (See the picture packing section for a ³ - ³ ³ ³ ³ ³ better explanation) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 5 ³ Pack_word ³ byte ³ 1 ³ Value of the recognition byte for color ³ - ³ ³ ³ ³ ³ repetitions that are coded on 2 bytes. ³ - ³ ³ ³ ³ ³ (See the picture packing section...) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 6 ³ Width ³ word ³ 2 ³ Picture width (in pixels) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 8 ³ Height ³ word ³ 2 ³ Picture height (in pixels) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 10 ³ Palette ³ byte ³ 768 ³ RGB palette (RGB RGB ... 256 times) with ³ - ³ ³ ³ ³ ³ values from 0 to 63. I know the standard ³ - ³ ³ ³ ³ ³ in picture files is 0 to 255 but I find ³ - ³ ³ ³ ³ ³ it stupid! It is really easier to send ³ - ³ ³ ³ ³ ³ the whole palette in port 3C9h with a ³ - ³ ³ ³ ³ ³ REP OUTSB without palette convertion. ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 778 ³ PH_size ³ word ³ 2 ³ Post-header size. This is the number of ³ - ³ ³ ³ ³ ³ bytes between the header and the picture ³ - ³ ³ ³ ³ ³ data. This value can be equal to 0. ³ - ÀÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - Data of type "word" are stored with Intel conventions: lower byte first. - - - -The POST-HEADER: -ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ - - The post-header has a variable size. It was designed to support new features -for this file format without changing the whole format. - - It consists in field identifiers followed by their size and their value. - A field identifier is coded with 1 byte and a field size also. - - - These field identifiers are: (this list may be updated...) - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - - 0 : Comment on the picture - 1 : Original screen dimensions - 2 : Back color (transparent color) - - If you encounter a field that you don't know just jump over it. But if a - field tells you to jump to a position that is over the beginning of the - picture data, there is an error in the file. - - - The fields: - ÄÄÄÄÄÄÄÄÄÄÄ - - * Comment: - - With this field, artists will be able to comment their pictures. - Note that GrafX 2 has a comment size limit of 32 chars. But you can - comment a picture with up to 255 chars if you make your own viewer - since GrafX 2 will just ignore extra characters. - - Example: [0],[16],[Picture by X-Man] - This sequence means: - - the field is a comment - - the comment takes 16 characters (there is no end-of-string character - since you know its size) - - the comment is "Picture by X-Man" - - * Original screen dimensions: - - Since GrafX 2 supplies a huge range of resolutions, it seemed convenient - to add a field that indicates what were the original screen dimensions. - - Example: [1],[4],[320],[256] - This sequence means: - - the field is a screen dimensions descriptor - - the dimensions are 2 words (so this value must be always equal to 4) - - the original screen width was 320 pixels - - the original screen height was 256 pixels - - Note that words stored in fields are written Intel-like. The 90% BETA - version did not respect this norm. I'm really sorry about this. This is - not very serious but pictures saved with version 90% and loaded with a - latest version (91% and more) won't set the right resolution. - - * Back color: - - Saving the back color (transparent color) is especially useful when you - want to save a brush. - The size of this field is 1 byte (index of the color between 0 and 255). - - Example: [2],[1],[255] - This sequence means: - - the field is a screen dimensions descriptor - - the value takes 1 byte - - the transparent color is 255 - - -The PICTURE PACKING METHOD: -ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ - - The PKM compression method is some sort of Run-Length-Compression which is -very efficient on pictures with long horizontal color repetitions. - Actually, the compression is efficient if there are often more than 3 times -the same color consecutively. - - I think that it would be better to give you the algorithm instead of swim- -ming in incomprehensible explanations. - - - BEGIN - /* - functions: - Read_byte(File) reads and returns 1 byte from File - Draw_pixel(X,Y,Color) draws a pixel of a certain Color at pos. (X,Y) - File_length(File) returns the total length in bytes of File - - variables: - type of Image_size is dword - type of Data_size is dword - type of Packed_data_counter is dword - type of Pixels_counter is dword - type of Color is byte - type of Byte_read is byte - type of Word_read is word - type of Counter is word - type of File is - */ - - /* At this point you've already read the header and post-header. */ - - Image_size <- Header.Width * Header.Height - Data_size <- File_length(File) - (780+Header.PH_size) - - Packed_data_counter <- 0 - Pixels_counter <- 0 - - /* Depacking loop: */ - WHILE ((Pixels_counterHeader.Pack_byte) AND (Byte_read<>Header.Pack_word)) - THEN - { - Draw_pixel(Pixels_counter MOD Header.Width, - Pixels_counter DIV Header.Width, - Byte_read) - - Pixels_counter <- Pixels_counter + 1 - Packed_data_counter <- Packed_data_counter + 1 - } - ELSE /* Is the number of pixels to repeat coded... */ - { /* ... with 1 byte */ - IF (Byte_read = Header.Pack_byte) THEN - { - Color <- Read_byte(File) - Byte_read <- Read_byte(File) - - FOR Counter FROM 0 TO (Byte_read-1) STEP +1 - Draw_pixel((Pixels_counter+Counter) MOD Header.Width, - (Pixels_counter+Counter) DIV Header.Width, - Color) - - Pixels_counter <- Pixels_counter + Byte_read - Packed_data_counter <- Packed_data_counter + 3 - } - ELSE /* ... with 2 bytes */ - { - Color <- Read_byte(File) - Word_read <- (word value) (Read_byte(File) SHL 8)+Read_byte(File) - - FOR Counter FROM 0 TO (Word_read-1) STEP +1 - Draw_pixel((Pixels_counter+Counter) MOD Header.Width, - (Pixels_counter+Counter) DIV Header.Width, - Color) - - Pixels_counter <- Pixels_counter + Word_read - Packed_data_counter <- Packed_data_counter + 4 - } - } - } - END - - - For example, the following sequence: - (we suppose that Pack_byte=01 and Pack_word=02) - 04 03 01 05 06 03 02 00 01 2C - will be decoded as: - 04 03 05 05 05 05 05 05 03 00 00 00 ... (repeat 0 300 times (012Ch=300)) - - Repetitions that fit in a word must be written with their higher byte first. - I know that it goes against Intel standard but since I read bytes from the - file thru a buffer (really faster), I don't care about the order (Sorry :)). - But words in the header and post-header must be written and read Intel-like! - - - Packing advices: - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - - * As you can see, there could be a problem when you'd want to pack a raw - pixel with a color equal to Pack_byte or Pack_word. These pixels should - always be coded as a packet even if there is only one pixel. - - Example: (we suppose that Pack_byte=9) - 9 will be encoded 9,9,1 (The 1st 9 in the encoded... - 9,9 will be encoded 9,9,2 ... sequence is Pack_byte) - etc... - - * It seems obvious to find values for Pack_byte and Pack_word that are - (almost) never used. So a small routine that finds the 2 less used colors - in the image should be called before starting to pack the picture. This can - be done almost instantaneously in Assembler. - - * When you want to pack a 2-color-sequence, just write these 2 colors one - after the other (Color,Color) because it only takes 2 bytes instead of 3 if - you had to write a packet (Pack_byte,Color,2). - - * If you pack a very simple picture which has a sequence of more than 65535 - same consecutive bytes, you must break the sequence and continue with a new - packet. - - Example: you have to pack 65635 same consecutive bytes (eg. color 0) - (we suppose that Pack_byte=01 and Pack_word=02) - You'll write: 02 00 FF FF 01 00 64 (FFFFh=65535, 64h=100) - - - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ °±²Û Setting GrafX 2.00 video modes Û²±° ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - - All set-mode procs are in 386 ASM. Anyway, if you can't understand any - line of ASM, I really can't see the use you'll have of these procedures. - - They are designed to be used in FLAT memory model. Anyway, it wouldn't - take too much time for you to adapt them to the model you use since only - memory indexations can be affected by this (so use DS:SI instead of ESI, - ES:DI instead of EDI, and beware to the address 0A0000h that will become - 0A000h:0000h). - - -MCGA: (Standard VGA mode) -ÍÍÍÍÍ - - Is there anybody in this world who still don't now how to set the MCGA - 320x200 256 colors mode ??!? - Well... I hope you are a novice if you read the 2 following lines :) - - - mov ax,0013h - int 10h - - - -X-Modes: (Extended VGA modes) -ÍÍÍÍÍÍÍÍ - - Well... I think the original Mode X was 320x240 but now, many people call - "X-Modes" (or Modes X, or Tweaked modes) all the VGA modes that use more - that 64Kb of video memory with the "Unchained" structure. - Setting a pixel in any X-Mode can be done by one same function (but I - won't explain to you how to do that. You just have to tell the function what - the plane width (screen_width/4) is). - If you can't understand anything about what I say (unchained, planes...), - just read any good documentation about Mode X. - - We'd like to thank the authors of XLIB2 for saving our time by having made - this useful function. We slightly optimized it for our needs but the most - important parts are here. - - - mov ax,13h ; Yeah! The MCGA mode again! All X-Modes must start from - int 10h ; the standard VGA mode, but many things change after. - - mov dx,3C6h ; During the initialization, we'll turn the palette into - xor al,al ; black in order to avoid the user to see all our - out dx,al ; manipulations. - - mov dx,3C4h ; We will inform the TIMING SEQUENCER register to switch - mov ax,0604h ; in unchained mode (mode-X), without odd/even management - out dx,ax ; and with an access to the 256Kb of the video card. - mov ax,0100h ; Now we will engage the synchronous reset of the TS - out dx,ax ; register because we're about to play with registers. - - mov al,01h ; Like with the palette, we ask the video card not to - out dx,al ; peek the memory to display it anymore. Thus, it's - inc dx ; one more way to avoid interferences in the display, - in al,dx ; which happens until the mode is completely initialized - mov ah,al ; and stable. In addition, we can expect that asking a - mov al,01h ; memory reading interruption will turn the system - push ax ; faster, and thus speed up the initialization of the - mov al,ah ; graphic mode (hope makes you live :)) - or al,20h ; - out dx,al ; - - mov esi,X_ptr ; Pointer on the list of constants to send to the CRTC. - cld - - lodsb ; This loads in AL a value that will tell what to do - ; with the MISCELLANEOUS register, and increases ESI. - ; The value is equal to ZERO => Nothing to do - ; or ELSE => Send AL to MISCELLANEOUS - - or al,al ; Shall we modify the basic video mode? - jz NoThankYou ; No?Ä¿ Actually the answer is always "Yes". - mov dx,3C2h ; ³ Except for a few modes such as - out dx,al ; ³ 320x200 in Mode X - NoThankYou: ; <ÄÄÄÙ (but our 320x200 is MCGA...) - - mov dx,3C4h ; Manipulations with MISCELLANEOUS register are over, we - mov ax,0300h ; can now disengage the synchronous register of the TS. - out dx,ax - - ; Now, what about teasing the CRTC? - - mov dx,3D4h ; In the 18th register of the CRTC, we will disengage the - mov al,11h ; protection bit. Without this, the values we would have - out dx,al ; sent to the CRTC registers would have been ignored. - inc dx - in al,dx - and al,7Fh - out dx,al - - dec dx ; DX points back to the CRTC register entry - lodsb ; This loads in AL the number of CRTC registers to modify - xor ecx,ecx ; You must clear ECX before... - mov cl,al ; ... starting to repeat AL (CL) times OUTSW - rep outsw ; Let's send all the CRTC parameters! - - ; Just in case the 20th CRTC register would have been forgotten in the - ; initialisation table, we can compute it by ourselves (Yeah, we are good - ; guys). - - mov ax,Screen_width ; You must tell the routine what the Screen width is - shr ax,3 - mov ah,al - mov al,13h - out dx,ax - - mov dx,3C4h ; Now you have the good resolution but there can be - mov ax,0F02h ; shitty pixels on the screen coming from the uncleared - out dx,ax ; memory areas. - mov edi,0A0000h ; So we'll clean memory starting from 0A0000h with the - xor eax,eax ; value 0 (which is the standard black) and on a range - mov ecx,4000h ; of 4000h dwords (256Kb). - rep stosd ; Let's wipe all this out. - - mov dx,3C4h ; We can ask the VGA to read again the memory to display - pop ax ; it on the screen... - out dx,ax ; - mov dx,3C6h ; ... and turn on the palette so the picture appears to - mov al,0FFh ; the user. - out dx,al ; - - - - The table of constants you must send is one of these: - (These are tables for C but they can be easily used in other languages) - - word X320Y224[] = - { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x0014, - 0xC715, 0x0416, 0xE317 }; - word X320Y240[] = - { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, - 0x0616, 0xE317 }; - word X320Y256[] = - { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x2013, - 0x0014, 0x0715, 0x1A16, 0xE317 }; - word X320Y270[] = - { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x0014, - 0x1F15, 0x2F16, 0xE317 }; - word X320Y282[] = - { 0x0CE3, 0x6206, 0xF007, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2F13, - 0x0014, 0x3C15, 0x5C16, 0xE317 }; - word X320Y300[] = - { 0x0DE3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2013, - 0x0014, 0x2F15, 0x4416, 0xE317 }; - word X320Y360[] = - { 0x09E3, 0x4009, 0x8810, 0x8511, 0x6712, 0x2013, 0x0014, 0x6D15, 0xBA16, - 0xE317 }; - word X320Y400[] = - { 0x03E3, 0x4009, 0x0014, 0xE317 }; - word X320Y448[] = - { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x0014, - 0xC715, 0x0416, 0xE317 }; - word X320Y480[] = - { 0x0AE3, 0x0D06, 0x3E07, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, - 0x0616 , 0xE317}; - word X320Y512[] = - { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x2013, - 0x0014, 0x0715, 0x1A16, 0xE317 }; - word X320Y540[] = - { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x0014, - 0x1F15, 0x2F16, 0xE317 }; - word X320Y564[] = - { 0x0CE7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2013, - 0x0014, 0x3C15, 0x5C16, 0xE317 }; - word X320Y600[] = - { 0x0BE7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x0014, - 0x5815, 0x7016, 0xE317 }; - word X360Y200[] = - { 0x09E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2D13, 0x0014, - 0xE317 }; - word X360Y224[] = - { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, - 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X360Y240[] = - { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, - 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; - word X360Y256[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, - 0x0008, 0x6109, 0x0E10, 0xAC11, 0xFF12, 0x2D13, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X360Y270[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, - 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X360Y282[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, - 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X360Y300[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4606, 0x1F07, - 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2D13, 0x0014, 0x2F15, 0x4416, - 0xE317 }; - word X360Y360[] = - { 0x0FE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x8810, - 0x8511, 0x6712, 0x2D13, 0x0014, 0x6D15, 0xBA16, 0xE317 }; - word X360Y400[] = - { 0x0AE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x2D13, - 0x0014, 0xE317 }; - word X360Y448[] = - { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, - 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X360Y480[] = - { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, - 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; - word X360Y512[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, - 0x0008, 0x6009, 0x0E10, 0xAC11, 0xff12, 0x2D13, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X360Y540[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, - 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X360Y564[] = - { 0x12EB, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, - 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X360Y600[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0xBE06, 0xF007, - 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x2D13, 0x0014, 0x5815, 0x7016, - 0xE317 }; - word X400Y200[] = - { 0x09E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3213, 0x0014, - 0xE317 }; - word X400Y224[] = - { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, - 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X400Y240[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, - 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, - 0xE317 }; - word X400Y256[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, - 0x0008, 0x6109, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X400Y270[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, - 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X400Y282[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, - 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X400Y300[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4606, 0x1F07, - 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x3213, 0x0014, 0x2F15, 0x4416, - 0xE317 }; - word X400Y360[] = - { 0x0FE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x8810, - 0x8511, 0x6712, 0x3213, 0x0014, 0x6D15, 0xBA16, 0xE317 }; - word X400Y400[] = - { 0x0AE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x3213, - 0x0014, 0xE317 }; - word X400Y448[] = - { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, - 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X400Y480[] = - { 0x11E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, - 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, 0xE317 }; - word X400Y512[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, - 0x0008, 0x6009, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X400Y540[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, - 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X400Y564[] = - { 0x12EB, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, - 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X400Y600[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0xBE06, 0xF007, - 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x3213, 0x0014, 0x5815, 0x7016, - 0xE317 }; - - - The structure: (example) - - ÚÄÄÄÄThis is the number of values to send to the CRTC registers. This - ³ is actually the number of words in the tables minus 1 (because the - ³ 1st word of the table is not sent to the CRTC but contains a value - ³ to send to the MISCELLANEOUS register and the number of values to - ³ send to the CRTC registers ;) ). - ³ - ³ ÚÄÄThis is the value to send to the MISCEALLANEOUS register (or ZERO - ³ ³ if no value must be sent to it). - ³ ³ - ³ ³ ÚÄÄÄThis is a value to send to a register of the CRTC. - ³ ³ ³ - ³ ³ ³ ÚÄThis is the index of the CRTC register that will receive - ³ ³ ³ ³ the value. - ÿÿ ÿÿ - { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, - 0x0616, 0xE317 }; - - You can notice that CRTC registers 0 to 5 (and 13h) define the screen - width while registers 6 to 17h (except 13h) define the screen height. - - - We have more modes in our pocket than the "few" :) ones we included in - GrafX 2.00, but they aren't really useful or stable. But we may decice to - include them anyway in a next version. - If some of your favourite modes are missing, just send us the list of - constants we must shoot at the CRTC just following the structure we use - above. - - IMPORTANT! The constant values listed above are not supported by every - monitor or video card. - We have tested GrafX2 with several different configurations and - we constated that some modes don't work at all with some video - cards while some others can be overscanned, out of center, dark, - too bright, or shrunk. - But they all work fine with our poor little Tseng Labs ET4000... - - If you already have a good knowledge about CRTC and have different values - than ours for certain modes, please let us know. We'll use them if they work - better with a majority of computers. - - - -VESA: (A "pseudo-standard" for Super-VGA modes) -ÍÍÍÍÍ - - We use VESA for modes that require a width of 640, 800 or 1024 pixels. - But there is a way to combine X-Modes height with VESA so it's possible to - have modes as weird as in X-Mode. - - - mov ax,4F02h - mov bx,Video_mode - int 10h - - - 256-color-VESA video modes are: - 100h : 640x400 - 101h : 640x480 - 103h : 800x600 - 105h : 1024x768 - 107h : 1280x1024 (not available in GrafX2 because only supported with - video cards with 2 or more Megabytes of video memory) - - - As with X-Modes, you can modify CRTC registers to access "Xtd-VESA" modes! - (Note that some video cards don't support the modification of the VGA CRTC - registers in VESA modes.) - - - To enter these extended VESA modes, set a standard VESA mode with the right - width, and then call Modify_CRTC_registers with the proper Height table. - - Example (640x512) : - VESA_Set_mode(101h) /* Set a video mode with the same width */ - Modify_CRTC_registers(Y512) /* Modify height */ - - - * Height tables: - - word Y224[] = - { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0xC715, - 0x0416 }; - word Y240[] = - { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0xE715, - 0x0616 }; - word Y256[] = - { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x0715, - 0x1A16 }; - word Y270[] = - { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x1F15, - 0x2F16 }; - word Y282[] = - { 0x0AE3, 0x6206, 0xF007, 0x0008, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, - 0x3C15, 0x5C16 }; - word Y300[] = - { 0x09E3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2F15, - 0x4416 }; - word Y350[] = - { 0x09A3, 0xBF06, 0x1F07, 0x0008, 0x4009, 0x8310, 0x8511, 0x5D12, 0x6315, - 0xBA16 }; - word Y360[] = - { 0x07E3, 0x0008, 0x4009, 0x8810, 0x8511, 0x6712, 0x6D15, 0xBA16 }; - word Y400[] = - { 0x01E3, 0x4009 }; - word Y448[] = - { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0xC715, - 0x0416 }; - word Y480[] = - { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0xE715, - 0x0616 }; - word Y512[] = - { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x0715, - 0x1A16 }; - word Y540[] = - { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x1F15, - 0x2F16 }; - word Y564[] = - { 0x09E7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3C15, - 0x5C16 }; - word Y600[] = - { 0x09E7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x5815, - 0x7016 }; - - - - Modifying CRTC registers: (inspired by X-Modes init... See above for more - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ details or comments) - - mov esi,XVESA_Ptr - cld - - lodsb - or al,al ; Shall we modify the basic video mode? - jz NoThankYou ; No?Ä¿ The answer can be "No" because initialisations - mov dx,3C2h ; ³ of certain VESA modes directly set the right - out dx,al ; ³ value for the Miscellaneous register. - NoThankYou: ; <ÄÄÄÙ - - mov dx,3D4h - mov al,11h - out dx,al - inc dx - in al,dx - and al,7Fh - out dx,al - - dec dx - lodsb - xor ecx,ecx - mov cl,al - rep outsw - - - - If you are cunning enough, you'll be able to combine constants used in - X-Modes to get more "Xtd-VESA" modes such as 640x200, 800x480, etc... - (but I don't think this will work with 1024x??? because this mode is - generally interlaced... But who knows?...) - The most difficult is to find the right value for the MISCELLANEOUS - register. +ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +³°±²Û Technical documentation for GrafX 2.00 - Version 1.08 (10/05/1997) Û²±°³ +ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +This file deals with: + + - the PKM picture format + - the values to send to the CRTC to access all the amazing video modes + available in GrafX 2.00 + + + +ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +³ °±²Û The PKM picture format - by Karl Maritaud Û²±° ³ +ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + + First of all, I'd like to say that I made this file format some years ago + when I didn't knew how to load any good format (eg. GIF) and wanted to have + my own format. + PKM format was designed to be very simple, easy to encode and decode. Its + header is very simple (short) and evolutive. + The only real default I can find in this format is that you can only save + 256-color pictures. + I know that you will think: + "Oh no just another fucking format! I'll never use it! Its compression + is too poor and I prefer GIF!". + And I'll answer: + "Yeah! You're right. But if you dunno how to load GIF and want a simple + format with a quite good compression rate (on simple pictures at least), + it could be useful." + + So, here comes the format documentation... + + + +The HEADER: +ÍÍÍÍÍÍÍÍÍÍÍ + + The header is the following 780-byte-structure. (Don't worry about the size. + That's just because the palette is considered as a part of the header). + + + ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ Pos ³ Field ³ Type ³ Size ³ Description ³ + ÆÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͵ + ³ 0 ³ Signature ³ char ³ 3 ³ Constant string "PKM" (with NO size ³ + ³ ³ ³ ³ ³ delimitation '\0' or so...) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 3 ³ Version ³ byte ³ 1 ³ For the moment, it can take only the ³ + ³ ³ ³ ³ ³ value 0. ³ + ³ ³ ³ ³ ³ Other packing methods may change this ³ + ³ ³ ³ ³ ³ field but there is only one for now... ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 4 ³ Pack_byte ³ byte ³ 1 ³ Value of the recognition byte for color ³ + ³ ³ ³ ³ ³ repetitions that are coded on 1 byte. ³ + ³ ³ ³ ³ ³ (See the picture packing section for a ³ + ³ ³ ³ ³ ³ better explanation) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 5 ³ Pack_word ³ byte ³ 1 ³ Value of the recognition byte for color ³ + ³ ³ ³ ³ ³ repetitions that are coded on 2 bytes. ³ + ³ ³ ³ ³ ³ (See the picture packing section...) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 6 ³ Width ³ word ³ 2 ³ Picture width (in pixels) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 8 ³ Height ³ word ³ 2 ³ Picture height (in pixels) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 10 ³ Palette ³ byte ³ 768 ³ RGB palette (RGB RGB ... 256 times) with ³ + ³ ³ ³ ³ ³ values from 0 to 63. I know the standard ³ + ³ ³ ³ ³ ³ in picture files is 0 to 255 but I find ³ + ³ ³ ³ ³ ³ it stupid! It is really easier to send ³ + ³ ³ ³ ³ ³ the whole palette in port 3C9h with a ³ + ³ ³ ³ ³ ³ REP OUTSB without palette convertion. ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 778 ³ PH_size ³ word ³ 2 ³ Post-header size. This is the number of ³ + ³ ³ ³ ³ ³ bytes between the header and the picture ³ + ³ ³ ³ ³ ³ data. This value can be equal to 0. ³ + ÀÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Data of type "word" are stored with Intel conventions: lower byte first. + + + +The POST-HEADER: +ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + The post-header has a variable size. It was designed to support new features +for this file format without changing the whole format. + + It consists in field identifiers followed by their size and their value. + A field identifier is coded with 1 byte and a field size also. + + + These field identifiers are: (this list may be updated...) + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + 0 : Comment on the picture + 1 : Original screen dimensions + 2 : Back color (transparent color) + + If you encounter a field that you don't know just jump over it. But if a + field tells you to jump to a position that is over the beginning of the + picture data, there is an error in the file. + + + The fields: + ÄÄÄÄÄÄÄÄÄÄÄ + + * Comment: + + With this field, artists will be able to comment their pictures. + Note that GrafX 2 has a comment size limit of 32 chars. But you can + comment a picture with up to 255 chars if you make your own viewer + since GrafX 2 will just ignore extra characters. + + Example: [0],[16],[Picture by X-Man] + This sequence means: + - the field is a comment + - the comment takes 16 characters (there is no end-of-string character + since you know its size) + - the comment is "Picture by X-Man" + + * Original screen dimensions: + + Since GrafX 2 supplies a huge range of resolutions, it seemed convenient + to add a field that indicates what were the original screen dimensions. + + Example: [1],[4],[320],[256] + This sequence means: + - the field is a screen dimensions descriptor + - the dimensions are 2 words (so this value must be always equal to 4) + - the original screen width was 320 pixels + - the original screen height was 256 pixels + + Note that words stored in fields are written Intel-like. The 90% BETA + version did not respect this norm. I'm really sorry about this. This is + not very serious but pictures saved with version 90% and loaded with a + latest version (91% and more) won't set the right resolution. + + * Back color: + + Saving the back color (transparent color) is especially useful when you + want to save a brush. + The size of this field is 1 byte (index of the color between 0 and 255). + + Example: [2],[1],[255] + This sequence means: + - the field is a screen dimensions descriptor + - the value takes 1 byte + - the transparent color is 255 + + +The PICTURE PACKING METHOD: +ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + The PKM compression method is some sort of Run-Length-Compression which is +very efficient on pictures with long horizontal color repetitions. + Actually, the compression is efficient if there are often more than 3 times +the same color consecutively. + + I think that it would be better to give you the algorithm instead of swim- +ming in incomprehensible explanations. + + + BEGIN + /* + functions: + Read_byte(File) reads and returns 1 byte from File + Draw_pixel(X,Y,Color) draws a pixel of a certain Color at pos. (X,Y) + File_length(File) returns the total length in bytes of File + + variables: + type of Image_size is dword + type of Data_size is dword + type of Packed_data_counter is dword + type of Pixels_counter is dword + type of Color is byte + type of Byte_read is byte + type of Word_read is word + type of Counter is word + type of File is + */ + + /* At this point you've already read the header and post-header. */ + + Image_size <- Header.Width * Header.Height + Data_size <- File_length(File) - (780+Header.PH_size) + + Packed_data_counter <- 0 + Pixels_counter <- 0 + + /* Depacking loop: */ + WHILE ((Pixels_counterHeader.Pack_byte) AND (Byte_read<>Header.Pack_word)) + THEN + { + Draw_pixel(Pixels_counter MOD Header.Width, + Pixels_counter DIV Header.Width, + Byte_read) + + Pixels_counter <- Pixels_counter + 1 + Packed_data_counter <- Packed_data_counter + 1 + } + ELSE /* Is the number of pixels to repeat coded... */ + { /* ... with 1 byte */ + IF (Byte_read = Header.Pack_byte) THEN + { + Color <- Read_byte(File) + Byte_read <- Read_byte(File) + + FOR Counter FROM 0 TO (Byte_read-1) STEP +1 + Draw_pixel((Pixels_counter+Counter) MOD Header.Width, + (Pixels_counter+Counter) DIV Header.Width, + Color) + + Pixels_counter <- Pixels_counter + Byte_read + Packed_data_counter <- Packed_data_counter + 3 + } + ELSE /* ... with 2 bytes */ + { + Color <- Read_byte(File) + Word_read <- (word value) (Read_byte(File) SHL 8)+Read_byte(File) + + FOR Counter FROM 0 TO (Word_read-1) STEP +1 + Draw_pixel((Pixels_counter+Counter) MOD Header.Width, + (Pixels_counter+Counter) DIV Header.Width, + Color) + + Pixels_counter <- Pixels_counter + Word_read + Packed_data_counter <- Packed_data_counter + 4 + } + } + } + END + + + For example, the following sequence: + (we suppose that Pack_byte=01 and Pack_word=02) + 04 03 01 05 06 03 02 00 01 2C + will be decoded as: + 04 03 05 05 05 05 05 05 03 00 00 00 ... (repeat 0 300 times (012Ch=300)) + + Repetitions that fit in a word must be written with their higher byte first. + I know that it goes against Intel standard but since I read bytes from the + file thru a buffer (really faster), I don't care about the order (Sorry :)). + But words in the header and post-header must be written and read Intel-like! + + + Packing advices: + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + * As you can see, there could be a problem when you'd want to pack a raw + pixel with a color equal to Pack_byte or Pack_word. These pixels should + always be coded as a packet even if there is only one pixel. + + Example: (we suppose that Pack_byte=9) + 9 will be encoded 9,9,1 (The 1st 9 in the encoded... + 9,9 will be encoded 9,9,2 ... sequence is Pack_byte) + etc... + + * It seems obvious to find values for Pack_byte and Pack_word that are + (almost) never used. So a small routine that finds the 2 less used colors + in the image should be called before starting to pack the picture. This can + be done almost instantaneously in Assembler. + + * When you want to pack a 2-color-sequence, just write these 2 colors one + after the other (Color,Color) because it only takes 2 bytes instead of 3 if + you had to write a packet (Pack_byte,Color,2). + + * If you pack a very simple picture which has a sequence of more than 65535 + same consecutive bytes, you must break the sequence and continue with a new + packet. + + Example: you have to pack 65635 same consecutive bytes (eg. color 0) + (we suppose that Pack_byte=01 and Pack_word=02) + You'll write: 02 00 FF FF 01 00 64 (FFFFh=65535, 64h=100) + + + +ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +³ °±²Û Setting GrafX 2.00 video modes Û²±° ³ +ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + + All set-mode procs are in 386 ASM. Anyway, if you can't understand any + line of ASM, I really can't see the use you'll have of these procedures. + + They are designed to be used in FLAT memory model. Anyway, it wouldn't + take too much time for you to adapt them to the model you use since only + memory indexations can be affected by this (so use DS:SI instead of ESI, + ES:DI instead of EDI, and beware to the address 0A0000h that will become + 0A000h:0000h). + + +MCGA: (Standard VGA mode) +ÍÍÍÍÍ + + Is there anybody in this world who still don't now how to set the MCGA + 320x200 256 colors mode ??!? + Well... I hope you are a novice if you read the 2 following lines :) + + + mov ax,0013h + int 10h + + + +X-Modes: (Extended VGA modes) +ÍÍÍÍÍÍÍÍ + + Well... I think the original Mode X was 320x240 but now, many people call + "X-Modes" (or Modes X, or Tweaked modes) all the VGA modes that use more + that 64Kb of video memory with the "Unchained" structure. + Setting a pixel in any X-Mode can be done by one same function (but I + won't explain to you how to do that. You just have to tell the function what + the plane width (screen_width/4) is). + If you can't understand anything about what I say (unchained, planes...), + just read any good documentation about Mode X. + + We'd like to thank the authors of XLIB2 for saving our time by having made + this useful function. We slightly optimized it for our needs but the most + important parts are here. + + + mov ax,13h ; Yeah! The MCGA mode again! All X-Modes must start from + int 10h ; the standard VGA mode, but many things change after. + + mov dx,3C6h ; During the initialization, we'll turn the palette into + xor al,al ; black in order to avoid the user to see all our + out dx,al ; manipulations. + + mov dx,3C4h ; We will inform the TIMING SEQUENCER register to switch + mov ax,0604h ; in unchained mode (mode-X), without odd/even management + out dx,ax ; and with an access to the 256Kb of the video card. + mov ax,0100h ; Now we will engage the synchronous reset of the TS + out dx,ax ; register because we're about to play with registers. + + mov al,01h ; Like with the palette, we ask the video card not to + out dx,al ; peek the memory to display it anymore. Thus, it's + inc dx ; one more way to avoid interferences in the display, + in al,dx ; which happens until the mode is completely initialized + mov ah,al ; and stable. In addition, we can expect that asking a + mov al,01h ; memory reading interruption will turn the system + push ax ; faster, and thus speed up the initialization of the + mov al,ah ; graphic mode (hope makes you live :)) + or al,20h ; + out dx,al ; + + mov esi,X_ptr ; Pointer on the list of constants to send to the CRTC. + cld + + lodsb ; This loads in AL a value that will tell what to do + ; with the MISCELLANEOUS register, and increases ESI. + ; The value is equal to ZERO => Nothing to do + ; or ELSE => Send AL to MISCELLANEOUS + + or al,al ; Shall we modify the basic video mode? + jz NoThankYou ; No?Ä¿ Actually the answer is always "Yes". + mov dx,3C2h ; ³ Except for a few modes such as + out dx,al ; ³ 320x200 in Mode X + NoThankYou: ; <ÄÄÄÙ (but our 320x200 is MCGA...) + + mov dx,3C4h ; Manipulations with MISCELLANEOUS register are over, we + mov ax,0300h ; can now disengage the synchronous register of the TS. + out dx,ax + + ; Now, what about teasing the CRTC? + + mov dx,3D4h ; In the 18th register of the CRTC, we will disengage the + mov al,11h ; protection bit. Without this, the values we would have + out dx,al ; sent to the CRTC registers would have been ignored. + inc dx + in al,dx + and al,7Fh + out dx,al + + dec dx ; DX points back to the CRTC register entry + lodsb ; This loads in AL the number of CRTC registers to modify + xor ecx,ecx ; You must clear ECX before... + mov cl,al ; ... starting to repeat AL (CL) times OUTSW + rep outsw ; Let's send all the CRTC parameters! + + ; Just in case the 20th CRTC register would have been forgotten in the + ; initialisation table, we can compute it by ourselves (Yeah, we are good + ; guys). + + mov ax,Screen_width ; You must tell the routine what the Screen width is + shr ax,3 + mov ah,al + mov al,13h + out dx,ax + + mov dx,3C4h ; Now you have the good resolution but there can be + mov ax,0F02h ; shitty pixels on the screen coming from the uncleared + out dx,ax ; memory areas. + mov edi,0A0000h ; So we'll clean memory starting from 0A0000h with the + xor eax,eax ; value 0 (which is the standard black) and on a range + mov ecx,4000h ; of 4000h dwords (256Kb). + rep stosd ; Let's wipe all this out. + + mov dx,3C4h ; We can ask the VGA to read again the memory to display + pop ax ; it on the screen... + out dx,ax ; + mov dx,3C6h ; ... and turn on the palette so the picture appears to + mov al,0FFh ; the user. + out dx,al ; + + + + The table of constants you must send is one of these: + (These are tables for C but they can be easily used in other languages) + + word X320Y224[] = + { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x0014, + 0xC715, 0x0416, 0xE317 }; + word X320Y240[] = + { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, + 0x0616, 0xE317 }; + word X320Y256[] = + { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x2013, + 0x0014, 0x0715, 0x1A16, 0xE317 }; + word X320Y270[] = + { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x0014, + 0x1F15, 0x2F16, 0xE317 }; + word X320Y282[] = + { 0x0CE3, 0x6206, 0xF007, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2F13, + 0x0014, 0x3C15, 0x5C16, 0xE317 }; + word X320Y300[] = + { 0x0DE3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2013, + 0x0014, 0x2F15, 0x4416, 0xE317 }; + word X320Y360[] = + { 0x09E3, 0x4009, 0x8810, 0x8511, 0x6712, 0x2013, 0x0014, 0x6D15, 0xBA16, + 0xE317 }; + word X320Y400[] = + { 0x03E3, 0x4009, 0x0014, 0xE317 }; + word X320Y448[] = + { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x0014, + 0xC715, 0x0416, 0xE317 }; + word X320Y480[] = + { 0x0AE3, 0x0D06, 0x3E07, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, + 0x0616 , 0xE317}; + word X320Y512[] = + { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x2013, + 0x0014, 0x0715, 0x1A16, 0xE317 }; + word X320Y540[] = + { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x0014, + 0x1F15, 0x2F16, 0xE317 }; + word X320Y564[] = + { 0x0CE7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2013, + 0x0014, 0x3C15, 0x5C16, 0xE317 }; + word X320Y600[] = + { 0x0BE7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x0014, + 0x5815, 0x7016, 0xE317 }; + word X360Y200[] = + { 0x09E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2D13, 0x0014, + 0xE317 }; + word X360Y224[] = + { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, + 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X360Y240[] = + { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, + 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; + word X360Y256[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, + 0x0008, 0x6109, 0x0E10, 0xAC11, 0xFF12, 0x2D13, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X360Y270[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, + 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X360Y282[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, + 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X360Y300[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4606, 0x1F07, + 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2D13, 0x0014, 0x2F15, 0x4416, + 0xE317 }; + word X360Y360[] = + { 0x0FE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x8810, + 0x8511, 0x6712, 0x2D13, 0x0014, 0x6D15, 0xBA16, 0xE317 }; + word X360Y400[] = + { 0x0AE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x2D13, + 0x0014, 0xE317 }; + word X360Y448[] = + { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, + 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X360Y480[] = + { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, + 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; + word X360Y512[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, + 0x0008, 0x6009, 0x0E10, 0xAC11, 0xff12, 0x2D13, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X360Y540[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, + 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X360Y564[] = + { 0x12EB, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, + 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X360Y600[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0xBE06, 0xF007, + 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x2D13, 0x0014, 0x5815, 0x7016, + 0xE317 }; + word X400Y200[] = + { 0x09E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3213, 0x0014, + 0xE317 }; + word X400Y224[] = + { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, + 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X400Y240[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, + 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, + 0xE317 }; + word X400Y256[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, + 0x0008, 0x6109, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X400Y270[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, + 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X400Y282[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, + 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X400Y300[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4606, 0x1F07, + 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x3213, 0x0014, 0x2F15, 0x4416, + 0xE317 }; + word X400Y360[] = + { 0x0FE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x8810, + 0x8511, 0x6712, 0x3213, 0x0014, 0x6D15, 0xBA16, 0xE317 }; + word X400Y400[] = + { 0x0AE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x3213, + 0x0014, 0xE317 }; + word X400Y448[] = + { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, + 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X400Y480[] = + { 0x11E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, + 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, 0xE317 }; + word X400Y512[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, + 0x0008, 0x6009, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X400Y540[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, + 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X400Y564[] = + { 0x12EB, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, + 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X400Y600[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0xBE06, 0xF007, + 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x3213, 0x0014, 0x5815, 0x7016, + 0xE317 }; + + + The structure: (example) + + ÚÄÄÄÄThis is the number of values to send to the CRTC registers. This + ³ is actually the number of words in the tables minus 1 (because the + ³ 1st word of the table is not sent to the CRTC but contains a value + ³ to send to the MISCELLANEOUS register and the number of values to + ³ send to the CRTC registers ;) ). + ³ + ³ ÚÄÄThis is the value to send to the MISCEALLANEOUS register (or ZERO + ³ ³ if no value must be sent to it). + ³ ³ + ³ ³ ÚÄÄÄThis is a value to send to a register of the CRTC. + ³ ³ ³ + ³ ³ ³ ÚÄThis is the index of the CRTC register that will receive + ³ ³ ³ ³ the value. + ÿÿ ÿÿ + { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, + 0x0616, 0xE317 }; + + You can notice that CRTC registers 0 to 5 (and 13h) define the screen + width while registers 6 to 17h (except 13h) define the screen height. + + + We have more modes in our pocket than the "few" :) ones we included in + GrafX 2.00, but they aren't really useful or stable. But we may decice to + include them anyway in a next version. + If some of your favourite modes are missing, just send us the list of + constants we must shoot at the CRTC just following the structure we use + above. + + IMPORTANT! The constant values listed above are not supported by every + monitor or video card. + We have tested GrafX2 with several different configurations and + we constated that some modes don't work at all with some video + cards while some others can be overscanned, out of center, dark, + too bright, or shrunk. + But they all work fine with our poor little Tseng Labs ET4000... + + If you already have a good knowledge about CRTC and have different values + than ours for certain modes, please let us know. We'll use them if they work + better with a majority of computers. + + + +VESA: (A "pseudo-standard" for Super-VGA modes) +ÍÍÍÍÍ + + We use VESA for modes that require a width of 640, 800 or 1024 pixels. + But there is a way to combine X-Modes height with VESA so it's possible to + have modes as weird as in X-Mode. + + + mov ax,4F02h + mov bx,Video_mode + int 10h + + + 256-color-VESA video modes are: + 100h : 640x400 + 101h : 640x480 + 103h : 800x600 + 105h : 1024x768 + 107h : 1280x1024 (not available in GrafX2 because only supported with + video cards with 2 or more Megabytes of video memory) + + + As with X-Modes, you can modify CRTC registers to access "Xtd-VESA" modes! + (Note that some video cards don't support the modification of the VGA CRTC + registers in VESA modes.) + + + To enter these extended VESA modes, set a standard VESA mode with the right + width, and then call Modify_CRTC_registers with the proper Height table. + + Example (640x512) : + VESA_Set_mode(101h) /* Set a video mode with the same width */ + Modify_CRTC_registers(Y512) /* Modify height */ + + + * Height tables: + + word Y224[] = + { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0xC715, + 0x0416 }; + word Y240[] = + { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0xE715, + 0x0616 }; + word Y256[] = + { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x0715, + 0x1A16 }; + word Y270[] = + { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x1F15, + 0x2F16 }; + word Y282[] = + { 0x0AE3, 0x6206, 0xF007, 0x0008, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, + 0x3C15, 0x5C16 }; + word Y300[] = + { 0x09E3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2F15, + 0x4416 }; + word Y350[] = + { 0x09A3, 0xBF06, 0x1F07, 0x0008, 0x4009, 0x8310, 0x8511, 0x5D12, 0x6315, + 0xBA16 }; + word Y360[] = + { 0x07E3, 0x0008, 0x4009, 0x8810, 0x8511, 0x6712, 0x6D15, 0xBA16 }; + word Y400[] = + { 0x01E3, 0x4009 }; + word Y448[] = + { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0xC715, + 0x0416 }; + word Y480[] = + { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0xE715, + 0x0616 }; + word Y512[] = + { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x0715, + 0x1A16 }; + word Y540[] = + { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x1F15, + 0x2F16 }; + word Y564[] = + { 0x09E7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3C15, + 0x5C16 }; + word Y600[] = + { 0x09E7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x5815, + 0x7016 }; + + + + Modifying CRTC registers: (inspired by X-Modes init... See above for more + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ details or comments) + + mov esi,XVESA_Ptr + cld + + lodsb + or al,al ; Shall we modify the basic video mode? + jz NoThankYou ; No?Ä¿ The answer can be "No" because initialisations + mov dx,3C2h ; ³ of certain VESA modes directly set the right + out dx,al ; ³ value for the Miscellaneous register. + NoThankYou: ; <ÄÄÄÙ + + mov dx,3D4h + mov al,11h + out dx,al + inc dx + in al,dx + and al,7Fh + out dx,al + + dec dx + lodsb + xor ecx,ecx + mov cl,al + rep outsw + + + + If you are cunning enough, you'll be able to combine constants used in + X-Modes to get more "Xtd-VESA" modes such as 640x200, 800x480, etc... + (but I don't think this will work with 1024x??? because this mode is + generally interlaced... But who knows?...) + The most difficult is to find the right value for the MISCELLANEOUS + register. diff --git a/doc/tech_fra.txt b/doc/tech_fra.txt index c365887c..3f1012ed 100644 --- a/doc/tech_fra.txt +++ b/doc/tech_fra.txt @@ -1,769 +1,769 @@ -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³°±²Û Doc. technique pour GrafX 2.00 - Version 1.08 (5 octobre 1997) Û²±°³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - -Ce fichier traite: - - - du format d'image PKM - - des valeurs … envoyer au CRTC pour avoir accŠs … tous les modes vid‚os - incroyables disponibles dans GrafX 2.00 - - - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ °±²Û Le format d'image PKM - par Karl Maritaud Û²±° ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - - Tout d'abord, je tiens a dire que j'ai cr‚‚ ce format il y a d‚j… quelques - ann‚es, … l'‚poque o— je ne savais pas comment charger les meilleurs formats - (GIF par exemple) et que je voulais ‚galement avoir mon propre format. - Le format PKM a ‚t‚ con‡u pour ˆtre trŠs simple, facile … encoder et … - d‚coder. De plus, son header est trŠs simple (court) et evolutif. - Le seul vrai d‚faut que je puisse y trouver est que l'on ne peut sauver - des images qu'en 256 couleurs. - Je sais que vous allez vous dire: - "Oh non! Encore un nouveau format … la con! J'm'en servirai jamais! En - plus le taux de compression est naze! Je prefŠre le GIF!". - Et je r‚pondrai: - "Ouais! T'as raison. Mais si tu ne sais pas comment charger du GIF et - que tu veux un format simple avec une compression correcte (du moins sur - les images simples), il peut ˆtre utile." - - Donc, voici la documentation de ce format... - - - -Le HEADER: -ÍÍÍÍÍÍÍÍÍÍ - - Le header est la structure de 780 octets suivante. (Ne vous inqui‚tez pas … - propos de la taille. C'est tout simplement parce que la palette fait partie - du header). - - - ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ³ Pos ³ Champ ³ Type ³Taille³ Description ³ - ÆÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͵ - ³ 0 ³ Signature ³ char ³ 3 ³ ChaŒne constante "PKM" (SANS d‚limitation³ - ³ ³ ³ ³ ³ de taille '\0' ou autres...) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 3 ³ Version ³ byte ³ 1 ³ Pour le moment, ce champ ne peut prendre ³ - ³ ³ ³ ³ ³ que la valeur 0. ³ - ³ ³ ³ ³ ³ D'autres m‚thodes de compression pourront³ - ³ ³ ³ ³ ³ la modifier mais pour l'instant il n'y en³ - ³ ³ ³ ³ ³ a qu'une seule. ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 4 ³ Pack_byte ³ byte ³ 1 ³ Valeur de l'octet de reconnaissance pour ³ - ³ ³ ³ ³ ³ les r‚p‚titions de couleurs cod‚es sur 1 ³ - ³ ³ ³ ³ ³ Octet. (Voir la section sur la m‚thode de³ - ³ ³ ³ ³ ³ compression pour plus d'informations) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 5 ³ Pack_word ³ byte ³ 1 ³ Valeur de l'octet de reconnaissance pour ³ - ³ ³ ³ ³ ³ les r‚p‚titions de couleurs cod‚es sur 2 ³ - ³ ³ ³ ³ ³ Octets. (Voir la section sur la m‚thode ³ - ³ ³ ³ ³ ³ de compression pour plus d'informations) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 6 ³ Largeur ³ word ³ 2 ³ Largeur de l'image (en pixels) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 8 ³ Hauteur ³ word ³ 2 ³ Hauteur de l'image (en pixels) ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 10 ³ Palette ³ byte ³ 768 ³ Palette RGB (RGB RGB ... 256 fois) avec ³ - ³ ³ ³ ³ ³ des valeurs de 0 … 63. Je sais que le ³ - ³ ³ ³ ³ ³ standard dans les fichiers d'images est ³ - ³ ³ ³ ³ ³ de 0 … 255 mais je trouve ‡a cr‚tin! ³ - ³ ³ ³ ³ ³ C'est tellement plus simple d'envoyer la ³ - ³ ³ ³ ³ ³ palette toute entiŠre dans le port 3C9h ³ - ³ ³ ³ ³ ³ avec un REP OUTSB sans avoir … convertir ³ - ³ ³ ³ ³ ³ la palette. ³ - ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ 778 ³ Taille_PH ³ word ³ 2 ³ Taille du Post-header. C'est le nombre ³ - ³ ³ ³ ³ ³ d'octets entre le header et les donn‚es ³ - ³ ³ ³ ³ ³ de l'image. Cette valeur peut valoir 0. ³ - ÀÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - Les donn‚es du type "word" sont stock‚es selon les conventions d'Intel: - c'est-…-dire l'octet de poids le plus faible en premier. - - - -Le POST-HEADER: -ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ - - Le post-header a une taille variable. Il a ‚t‚ con‡u pour supporter les -nouvelles fonctions de ce format sans avoir a changer complŠtement le format. - - Il est constitu‚ d'identificateurs de champ suivis par leur taille et leur -contenu. - Un identificateur de champ est cod‚ sur 1 octet ainsi que sa taille. - - - Ces identificateurs de champ sont: (cette liste peut ˆtre rallong‚e...) - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - - 0 : Commentaire sur l'image - 1 : Dimensions de l'‚cran d'origine - 2 : Couleur de fond (couleur de transparence) - - Si vous rencontrez un champ inconnu par votre routine de chargment, sautez - simplement au del…. Mais, par contre, si un champ vous dit de sauter … une - position qui tombe aprŠs le d‚but th‚orique des donn‚es de l'image, alors - c'est qu'il y a une erreur dans le fichier. - - - Les champs: - ÄÄÄÄÄÄÄÄÄÄÄ - - * Commentaire: - - Grƒce … ce champ, les artistes vont pouvoir commenter leurs dessins. - Notez que GrafX 2 a une taille limite de commentaire de 32 caractŠres. - Mais vous pourrez avoir des commentaires allant jusqu'… 255 caractŠres - si vous cr‚ez votre propre viewer puisque GrafX 2 ignorera simplement - les caractŠres en trop. - - Exemple: [0],[15],[Dessin de X-Man] - Cette s‚quence signifie: - - le champ est un commentaire - - le commentaire a une taille de 15 caractŠres (il n'y a pas de - caractŠre de fin de chaŒne puisque vous connaissez sa taille) - - le commentaire est "Dessin de X-Man" - - * Dimensions de l'‚cran d'origine: - - Puisque GrafX 2 propose un ‚norme choix de r‚solutions, il a sembl‚ - pratique d'ajouter un champ indicant quelles ‚taient les dimensions de - l'‚cran d'origine. - - Exemple: [1],[4],[320],[256] - Cette s‚quence signifie: - - Le champ d‚crit les dimensions de l'‚cran d'origine - - Les dimensions sont 2 words (donc cette valeur doit ˆtre ‚gale … 4) - - La largeur de l'‚cran d'origine ‚tait de 320 pixels - - La hauteur de l'‚cran d'origine ‚tait de 256 pixels - - Notez que les words stock‚s dans les champs sont ‚crits … la maniŠre - Intel. La BETA-version 90% ne respectait pas cette norme (d‚sol‚). - Ce n'est pas bien grƒve mais les images sauv‚es avec la version 90% et - recharg‚es avec une version post‚rieure (91% et plus) ne passeront pas - dans la bonne r‚solution. - - * Couleur de fond: - - Enregistrer la couleur de fond (couleur de transparence) se r‚vŠle - particuliŠrement utile lorsque vous voulez sauvegarder une brosse. - La taille de ce champ est 1 octet (indice de la couleur entre 0 et 255). - - Exemple: [2],[1],[255] - Cette s‚quence signifie: - - le champ d‚crit la couleur de fond - - la valeur prend 1 octet - - La couleur de transparence est 255 - - -La METHODE DE COMPACTAGE DE L'IMAGE: -ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ - - La m‚thode de compression PKM est une sorte de "Run-Length-Compression" qui -est trŠs efficace sur les images comportant de longues r‚p‚titions d'une mˆme -couleur horizontalement. - En fait la compression commence … ˆtre efficace s'il y a souvent plus de 3 -fois la mˆme couleur cons‚cutivement. - - Je pense qu'il est pr‚f‚rable de vous donner directement l'algorithme plut“t -que de nager dans des explications incomprehensibles. - - - DEBUT - /* - fonctions: - Lire_octet(Fichier) Lit et retourne 1 octet … partir de - Fichier - Dessiner_pixel(X,Y,Couleur) Dessine un pixel d'une certaine Couleur - … la position (X,Y) - Taille_fichier(Fichier) Retourne la taille totale d'un Fichier - en octets - - variables: - le type de Taille_image est dword - le type de Taille_donnees est dword - le type de Compteur_donnees est dword - le type de Compteur_pixels est dword - le type de Couleur est byte - le type de Octet_lu est byte - le type de Word_lu est word - le type de Compteur est word - le type de Fichier est - */ - - /* A cet endroit, le header et le post-header ont d‚j… ‚t‚ lus. */ - - Taille_image <- Header.Largeur * Header.Hauteur - Taille_donnees <- Taille_fichier(Fichier) - (780+Header.Taille_PH) - - Compteur_donnees <- 0 - Compteur_pixels <- 0 - - /* Boucle de d‚compression: */ - TANT QUE ((Compteur_pixelsHeader.Pack_byte) ET (Octet_lu<>Header.Pack_word)) - ALORS - { - Dessiner_pixel(Compteur_pixels MOD Header.Largeur, - Compteur_pixels DIV Header.Largeur, - Octet_lu) - - Compteur_pixels <- Compteur_pixels + 1 - Compteur_donnees <- Compteur_donnees + 1 - } - SINON /* Est-ce que le nombre de pixels … r‚p‚ter est cod‚... */ - { /* ... sur 1 octet ? */ - SI (Octet_lu = Header.Pack_byte) ALORS - { - Couleur <- Lire_octet(Fichier) - Octet_lu <- Lire_octet(Fichier) - - POUR Compteur ALLANT DE 0 A (Octet_lu-1) PAR PAS DE +1 - Dessiner_pixel((Compteur_pixels+Compteur) MOD Header.Largeur, - (Compteur_pixels+Compteur) DIV Header.Largeur, - Couleur) - - Compteur_pixels <- Compteur_pixels + Octet_lu - Compteur_donnees <- Compteur_donnees + 3 - } - SINON /* ... sur 2 octets ? */ - { - Couleur <- Lire_octet(Fichier) - Word_lu <- (word) (Lire_octet(Fichier) SHL 8)+Lire_octet(Fichier) - - POUR Compteur ALLANT DE 0 A (Word_lu-1) PAR PAS DE +1 - Dessiner_pixel((Compteur_pixels+Compteur) MOD Header.Largeur, - (Compteur_pixels+Compteur) DIV Header.Largeur, - Couleur) - - Compteur_pixels <- Compteur_pixels + Word_lu - Compteur_donnees <- Compteur_donnees + 4 - } - } - } - FIN - - - Par exemple, la s‚quence suivante: - (on suppose que Pack_byte=01 et Pack_word=02) - 04 03 01 05 06 03 02 00 01 2C - sera d‚cod‚e comme: - 04 03 05 05 05 05 05 05 03 00 00 00 ... (rep‚ter 0 300 fois (012Ch=300)) - - Les r‚p‚titions qui tiennent sur un word doivent ˆtre ‚crites avec leur - octet de poids le plus fort en premier. Je sais que ‡a va … l'encontre du - standard Intel mais puisque je lis les octets du fichier au travers d'un - buffer (franchement plus rapide), Je me fous complŠtement de l'ordre - (D‚sol‚ :)). Mais les words du header et du post-header doivent ˆtre ‚crits - et lus … la maniŠre Intel! - - - Conseils de compactage: - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - - * Comme vous pouvez le constater, il pourrait y avoir un problŠme lorsque - vous devriez compacter un pixel brut de couleur ‚gale … Pack_byte ou … - Pack_word. Ces pixels doivent toujours ˆtre cod‚s comme des paquets mˆme - s'il n'y a qu'un seul pixel. - - Exemple: (supposons que Pack_byte=9) - 9 sera encod‚ 9,9,1 (Le 1er 9 dans la s‚quence... - 9,9 sera encod‚ 9,9,2 ... encod‚e est Pack_byte) - etc... - - * Il semble ‚vident de trouver des valeurs pour Pack_byte et Pack_word qui - ne sont jamais (ou presque) utilis‚es. Donc, une petite routine qui trouve - les 2 couleurs les moins utilis‚es dans l'image devrait ˆtre appel‚e avant - de commencer la compression. Ceci peut ˆtre r‚alis‚ presque instantan‚ment - en Assembleur. - - * Quand vous voulez ‚crire une s‚quence de 2 couleurs identiques, ‚crivez - simplement ces 2 couleurs l'une aprŠs l'autre (Couleur,Couleur) puisque ‡a - ne prend que 2 octets au lieu de 3 si vous aviez ‚crit un paquet (Pack_byte, - Couleur,2). - - * Si vous compressez une image extrˆmement simple qui comporte une s‚quence - de plus de 65535 fois la mˆme couleur cons‚cutivement, vous devez "casser" - la s‚quence et continuer avec un nouveau paquet. - - Exemple: vous devez compacter les 65635 mˆmes octets cons‚cutifs (de - couleur 0 par exemple) - (On suppose que Pack_byte=01 et Pack_word=02) - Vous devrez alors ‚crire: 02 00 FF FF 01 00 64 (FFFFh=65535, 64h=100) - - - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ °±²Û Passer dans les modes vid‚os de GrafX 2.00 Û²±° ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - - Toutes les proc‚dures d'initialisation de mode sont ‚crites en ASM 386. De - toutes fa‡ons, si vous ne comprenez pas une ligne d'ASM, je ne vois vraiment - pas … quoi pourront vous servir ces proc‚dures. - - Elles ont ‚t‚ con‡ues pour ˆtre utilis‚es dans le modŠle de m‚moire FLAT. - Mais cela ne devrait pas vous prendre trop de temps de les adapter au modŠle - que vous souhaitez utiliser puisqu'il n'y a que les manipulations de m‚moire - que cela affectera (utilisez donc DS:SI au lieu de ESI, ES:DI … la place de - EDI et faŒtes attention … l'adresse 0A0000h qui se transforme en l'adresse - 0A000h:0000h). - - -MCGA: (Mode VGA standard) -ÍÍÍÍÍ - - Y-a-t'il quelqu'un sur cette planŠte qui ne sache toujours pas comment - on passe en mode MCGA 320x200 en 256 couleurs ??!? - Bon... Je suppose que vous ˆtes un novice si vous lisez les 2 lignes - suivantes :) - - - mov ax,0013h - int 10h - - - -Modes X: (Modes VGA ‚tendus) -ÍÍÍÍÍÍÍÍ - - Bon... Il me semble que le Mode X original ‚tait en 320x240, mais - maintenant tout le monde appelle "Modes X" (ou X-Modes, ou Tweaked modes) - tous les modes VGA qui utilise plus de 64Ko de m‚moire vid‚o et la structure - "Unchained". - Afficher un pixel dans n'importe quel Mode X peut ˆtre effectu‚ par la - mˆme et unique fonction (mais je ne vous expliquerai pas comment faire, il - vous suffit d'indiquer … la fonction la taille des plans (Largeur/4)). - Si vous ne comprenez rien … ce que je dis, (Unchained, plans...) il vous - suffit de lire n'importe quelle bonne documentation sur le Mode X. - - - Nous tenons … remercier les auteurs de XLIB2 pour nous avoir ‚conomis‚ du - temps en ayant ‚crit cette fonction. Nous l'avons l‚gŠrement optimis‚e en - fonction de nos besoins, mais l'essentiel en a ‚t‚ conserv‚. - - - mov ax,13h ; Oui! Encore le mode MCGA! Tous les Modes X doivent - int 10h ; commencer … partir du mode VGA standard, mais bien des - ; choses changent par la suite. - - mov dx,3C6h ; Pour la dur‚e de l'initialisation, on va ‚teindre la - xor al,al ; palette de fa‡on … ce que l'utilisateur ne subisse pas - out dx,al ; nos triturations. - - mov dx,3C4h ; Nous allons demander au registre TIMING SEQUENCER de - mov ax,0604h ; passer dans le mode "Unchained" (mode X), sans g‚rer de - out dx,ax ; parit‚, et un accŠs aux 256Ko de la carte vid‚o. - mov ax,0100h ; On va ensuite enclencher le reset synchrone du registre - out dx,ax ; TS car on s'apprˆte … jouer avec les registres. - - mov al,01h ; De la mˆme fa‡on que pour la palette, on demande … la - out dx,al ; carte vid‚o de ne plus scruter la m‚moire pour - inc dx ; afficher son contenu. Ainsi, c'est une fa‡on de plus - in al,dx ; d'‚viter l'affichage parasite qui arrive le temps que - mov ah,al ; le mode soit totalement initialis‚ et stabilis‚. - mov al,01h ; De plus, on peut esp‚rer qu'en demandant un arrˆt de - push ax ; la lecture de la m‚moire, le systŠme s'en voit un peu - mov al,ah ; acc‚l‚r‚, et ainsi acc‚l‚rer l'initialisation du mode - or al,20h ; graphique (l'espoir fait vivre :)) - out dx,al ; - - mov esi,X_ptr ; Pointeur sur la liste des constantes … envoyer au CRTC. - cld - - lodsb ; Ceci charge dans AL une valeur qui nous dira quoi faire - ; avec le registre MISCELLANEOUS, et incr‚mente ESI. - ; La valeur est ‚gale … ZERO => Rien … faire - ; sinon => Envoyer AL au reg. MISC. - - or al,al ; Devons nous modifier le mode vid‚o de base ? - jz NonMerci ; Non?Ä¿ En fait, la r‚ponse est toujours "Oui". - mov dx,3C2h ; ³ Sauf pour quelques modes tels que le - out dx,al ; ³ 320x200 en Mode X - NonMerci: ; <ÄÄÄÄÙ (mais notre mode 320x200 est en MCGA...) - - mov dx,3C4h ; On en a termin‚ avec les manipulations du registre - mov ax,0300h ; MISCELLANEOUS, on peut maintenant d‚senclencher le - out dx,ax ; reset synchrone du registre TIMING SEQUENCER. - - ; Et maintenant, si on jouait avec le CRTC? - - mov dx,3D4h ; Dans le 18Šme registre du CRTC, on va d‚senclencher le - mov al,11h ; bit de protection. Sans cela, les valeurs que nous - out dx,al ; aurions envoy‚es aux registres du CRTC auraient ‚t‚ - inc dx ; ignor‚es. - in al,dx - and al,7Fh - out dx,al - - dec dx ; DX pointe … nouveau sur "l'entr‚e" du registre CRTC. - lodsb ; Ceci met dans AL le nombre de registres CRTC … changer - xor ecx,ecx ; On doit nettoyer ECX avant de commencer … r‚p‚ter... - mov cl,al ; ...CL (AL) fois OUTSW - rep outsw ; On peut envoyer la sauce aux registres du CRTC! - - ; Juste au cas o— le 20Šme registre CRTC aurait ‚t‚ oubli‚ dans la table - ; d'initialisation, on peut le calculer nous-mˆmes (Ouaip, on est des - ; braves gars). - - mov ax,Screen_width ; Vous devez indiquer … la routine quelle est la - shr ax,3 ; largeur de l'‚cran - mov ah,al - mov al,13h - out dx,ax - - mov dx,3C4h ; Maintenant vous avez la bonne r‚solution mais il peut - mov ax,0F02h ; y avoir des pixels pourris … l'‚cran … cause de zones - out dx,ax ; non nettoy‚es de la m‚moire vid‚o. - mov edi,0A0000h ; Donc on va nettoyer la m‚moire … partir de 0A0000h - xor eax,eax ; avec la valeur 0 (qui est le noir standard) et sur une - mov ecx,4000h ; longueur de 4000h dwords (256Ko). - rep stosd ; Allez, liquidez-moi tout ‡a! - - mov dx,3C4h ; On peut redemander … la carte VGA de relire la m‚moire - pop ax ; pour afficher l'‚cran... - out dx,ax ; - mov dx,3C6h ; ... et r‚tablir la palette pour que l'image soit - mov al,0FFh ; visible … l'utilisateur. - out dx,al ; - - - - La table de constantes que vous devez employer est l'une des suivantes: - (Ces tables sont au format C, mais elles peuvent facilement ˆtres employ‚es - dans d'autres langages) - - word X320Y224[] = - { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x0014, - 0xC715, 0x0416, 0xE317 }; - word X320Y240[] = - { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, - 0x0616, 0xE317 }; - word X320Y256[] = - { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x2013, - 0x0014, 0x0715, 0x1A16, 0xE317 }; - word X320Y270[] = - { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x0014, - 0x1F15, 0x2F16, 0xE317 }; - word X320Y282[] = - { 0x0CE3, 0x6206, 0xF007, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2F13, - 0x0014, 0x3C15, 0x5C16, 0xE317 }; - word X320Y300[] = - { 0x0DE3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2013, - 0x0014, 0x2F15, 0x4416, 0xE317 }; - word X320Y360[] = - { 0x09E3, 0x4009, 0x8810, 0x8511, 0x6712, 0x2013, 0x0014, 0x6D15, 0xBA16, - 0xE317 }; - word X320Y400[] = - { 0x03E3, 0x4009, 0x0014, 0xE317 }; - word X320Y448[] = - { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x0014, - 0xC715, 0x0416, 0xE317 }; - word X320Y480[] = - { 0x0AE3, 0x0D06, 0x3E07, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, - 0x0616 , 0xE317}; - word X320Y512[] = - { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x2013, - 0x0014, 0x0715, 0x1A16, 0xE317 }; - word X320Y540[] = - { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x0014, - 0x1F15, 0x2F16, 0xE317 }; - word X320Y564[] = - { 0x0CE7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2013, - 0x0014, 0x3C15, 0x5C16, 0xE317 }; - word X320Y600[] = - { 0x0BE7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x0014, - 0x5815, 0x7016, 0xE317 }; - word X360Y200[] = - { 0x09E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2D13, 0x0014, - 0xE317 }; - word X360Y224[] = - { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, - 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X360Y240[] = - { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, - 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; - word X360Y256[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, - 0x0008, 0x6109, 0x0E10, 0xAC11, 0xFF12, 0x2D13, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X360Y270[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, - 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X360Y282[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, - 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X360Y300[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4606, 0x1F07, - 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2D13, 0x0014, 0x2F15, 0x4416, - 0xE317 }; - word X360Y360[] = - { 0x0FE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x8810, - 0x8511, 0x6712, 0x2D13, 0x0014, 0x6D15, 0xBA16, 0xE317 }; - word X360Y400[] = - { 0x0AE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x2D13, - 0x0014, 0xE317 }; - word X360Y448[] = - { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, - 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X360Y480[] = - { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, - 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; - word X360Y512[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, - 0x0008, 0x6009, 0x0E10, 0xAC11, 0xff12, 0x2D13, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X360Y540[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, - 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X360Y564[] = - { 0x12EB, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, - 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X360Y600[] = - { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0xBE06, 0xF007, - 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x2D13, 0x0014, 0x5815, 0x7016, - 0xE317 }; - word X400Y200[] = - { 0x09E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3213, 0x0014, - 0xE317 }; - word X400Y224[] = - { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, - 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X400Y240[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, - 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, - 0xE317 }; - word X400Y256[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, - 0x0008, 0x6109, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X400Y270[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, - 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X400Y282[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, - 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X400Y300[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4606, 0x1F07, - 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x3213, 0x0014, 0x2F15, 0x4416, - 0xE317 }; - word X400Y360[] = - { 0x0FE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x8810, - 0x8511, 0x6712, 0x3213, 0x0014, 0x6D15, 0xBA16, 0xE317 }; - word X400Y400[] = - { 0x0AE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x3213, - 0x0014, 0xE317 }; - word X400Y448[] = - { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, - 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, - 0xE317 }; - word X400Y480[] = - { 0x11E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, - 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, 0xE317 }; - word X400Y512[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, - 0x0008, 0x6009, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, - 0xE317 }; - word X400Y540[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, - 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, - 0xE317 }; - word X400Y564[] = - { 0x12EB, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, - 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, - 0xE317 }; - word X400Y600[] = - { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0xBE06, 0xF007, - 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x3213, 0x0014, 0x5815, 0x7016, - 0xE317 }; - - - La structure: (exemple) - - ÚÄÄÄÄCeci est le nombre de valeurs … envoyer aux registres CRTC. C'est - ³ en fait le nombre de words dans la table moins 1 (… cause du 1er - ³ word de la table qui n'est pas envoy‚ au CRTC mais qui contient - ³ une valeur … envoyer au registre MISCELLANEOUS et le nombre de - ³ valeurs … envoyer aux registres CRTC ;) ). - ³ - ³ ÚÄÄCeci est la valeur … envoyer au registre MISCELLANEOUS (ou 0 si - ³ ³ aucune valeur ne doit y ˆtre envoy‚e). - ³ ³ - ³ ³ ÚÄÄÄCeci est une valeur … envoyer dans un registre du CRTC. - ³ ³ ³ - ³ ³ ³ ÚÄCeci est le num‚ro du registre du CRTC qui recevra la - ³ ³ ³ ³ valeur cit‚e pr‚c‚demment. - ÿÿ ÿÿ - { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, - 0x0616, 0xE317 }; - - Vous pouvez remarquer que les registres 0 … 5 (et le 13h) du CRTC - d‚finissent la largeur de l'‚cran, alors que les registres 6 … 17h (… - l'exception du 13h) definissent la hauteur de l'‚cran. - - - Nous avons plus de modes en poche que les quelques-uns :) que nous avons - inclus dans GrafX 2.00, mais ils ne sont ni vraiment utiles ni vraiment - stables. Nous pourrons toutefois d‚cider de les inclure dans une prochaine - version. - S'il manque certains de vos modes pr‚f‚res, envoyez nous simplement la - liste des constantes que l'on doit balancer au CRTC … la maniŠre de la - structure utilis‚e ci-dessus. - - IMPORTANT! Les valeurs des constantes cit‚es plus haut ne sont pas - support‚es par tous les moniteurs ou les cartes vid‚os. - Nous avons test‚ GrafX2 avec diff‚rentes configurations et avons - constat‚s que certains modes ne marchent pas du tout avec - certaines cartes vid‚os, alors que d'autres d‚bordent de l'‚cran, - sont d‚centr‚s, assombris, trop clairs, ou tass‚s. - Toutefois, ils marchent tous correctement avec notre pauvre - petite Tseng Labs ET4000... - - Si vous avez d‚j… une bonne connaissance … propos du CRTC, et avez des - valeurs diff‚rentes des notres pour certains modes, merci de nous en - informer. Nous nous en servirons s'ils marchent mieux sur une majorit‚ - d'ordinateurs. - - - -VESA: (Un "pseudo-standard" pour les modes Super-VGA) -ÍÍÍÍÍ - - Nous nous servons du VESA pour des modes qui n‚cessitent une largeur de - 640, 800 ou 1024 pixels. Mais il existe un moyen de combiner la hauteur des - Modes X avec les modes VESA, il est ainsi possible d'avoir des modes aussi - timbr‚s qu'en Mode X. - - - mov ax,4F02h - mov bx,Video_mode - int 10h - - - Les modes VESA 256 couleur VESA sont: - 100h : 640x400 - 101h : 640x480 - 103h : 800x600 - 105h : 1024x768 - 107h : 1280x1024 (non disponible dans GrafX2 parce qu'uniquement support‚ - par des cartes vid‚o avec 2 Megaoctets ou plus de m‚moire - vid‚o) - - - Comme avec les Modes X, vous pouvez modifier les registres CRTC pour acc‚der - aux modes "VESA-X"! (Notez que certaines cartes vid‚o ne supportent pas les - modifications des registres du CRTC VGA dans les modes VESA.) - - - Pour passer dans ces modes ‚tendus, passez dans un mode VESA standard ayant - la bonne largeur, puis appelez Modif_registres_CRTC avec la bonne table de - hauteur. - - Exemple (640x512) : - VESA_Set_mode(101h) // On passe dans un mode qui a la mˆme largeur - Modif_registres_CRTC(Y512) // On modifie la hauteur - - - * Tables des hauteurs: - - word Y224[] = - { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0xC715, - 0x0416 }; - word Y240[] = - { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0xE715, - 0x0616 }; - word Y256[] = - { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x0715, - 0x1A16 }; - word Y270[] = - { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x1F15, - 0x2F16 }; - word Y282[] = - { 0x0AE3, 0x6206, 0xF007, 0x0008, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, - 0x3C15, 0x5C16 }; - word Y300[] = - { 0x09E3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2F15, - 0x4416 }; - word Y350[] = - { 0x09A3, 0xBF06, 0x1F07, 0x0008, 0x4009, 0x8310, 0x8511, 0x5D12, 0x6315, - 0xBA16 }; - word Y360[] = - { 0x07E3, 0x0008, 0x4009, 0x8810, 0x8511, 0x6712, 0x6D15, 0xBA16 }; - word Y400[] = - { 0x01E3, 0x4009 }; - word Y448[] = - { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0xC715, - 0x0416 }; - word Y480[] = - { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0xE715, - 0x0616 }; - word Y512[] = - { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x0715, - 0x1A16 }; - word Y540[] = - { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x1F15, - 0x2F16 }; - word Y564[] = - { 0x09E7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3C15, - 0x5C16 }; - word Y600[] = - { 0x09E7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x5815, - 0x7016 }; - - - - Modifier les registres CRTC: (inspir‚ de l'init. des Modes X... voir plus - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ haut pour de plus amples d‚tails) - - mov esi,XVESA_Ptr - cld - - lodsb - or al,al ; Devons nous modifier le mode vid‚o de base ? - jz NonMerci ; Non?Ä¿ La r‚ponse peut ˆtre "Non" car les initialisations - mov dx,3C2h ; ³ de certains modes VESA mettent directement la - out dx,al ; ³ bonne valeur pour le registre MISCELLANEOUS. - NonMerci: ; <ÄÄÄÄÙ - - mov dx,3D4h - mov al,11h - out dx,al - inc dx - in al,dx - and al,7Fh - out dx,al - - dec dx - lodsb - xor ecx,ecx - mov cl,al - rep outsw - - - - Si vous ˆtes suffisament astucieux, vous pourrez combiner les constantes - utilis‚es dans les Modes X pour obtenir plus de modes "VESA-X" tels que le - 640x200, 800x480, etc... (mais je ne pense pas que ‡a marche convenablement - avec les largeurs de 1024 pixels puisque ce mode est g‚n‚ralement - entrelac‚... Mais qui sait?...) - Je pense que le plus difficile est de trouver la bonne valeur du registre - MISCELLANEOUS. +ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +³°±²Û Doc. technique pour GrafX 2.00 - Version 1.08 (5 octobre 1997) Û²±°³ +ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Ce fichier traite: + + - du format d'image PKM + - des valeurs … envoyer au CRTC pour avoir accŠs … tous les modes vid‚os + incroyables disponibles dans GrafX 2.00 + + + +ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +³ °±²Û Le format d'image PKM - par Karl Maritaud Û²±° ³ +ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + + Tout d'abord, je tiens a dire que j'ai cr‚‚ ce format il y a d‚j… quelques + ann‚es, … l'‚poque o— je ne savais pas comment charger les meilleurs formats + (GIF par exemple) et que je voulais ‚galement avoir mon propre format. + Le format PKM a ‚t‚ con‡u pour ˆtre trŠs simple, facile … encoder et … + d‚coder. De plus, son header est trŠs simple (court) et evolutif. + Le seul vrai d‚faut que je puisse y trouver est que l'on ne peut sauver + des images qu'en 256 couleurs. + Je sais que vous allez vous dire: + "Oh non! Encore un nouveau format … la con! J'm'en servirai jamais! En + plus le taux de compression est naze! Je prefŠre le GIF!". + Et je r‚pondrai: + "Ouais! T'as raison. Mais si tu ne sais pas comment charger du GIF et + que tu veux un format simple avec une compression correcte (du moins sur + les images simples), il peut ˆtre utile." + + Donc, voici la documentation de ce format... + + + +Le HEADER: +ÍÍÍÍÍÍÍÍÍÍ + + Le header est la structure de 780 octets suivante. (Ne vous inqui‚tez pas … + propos de la taille. C'est tout simplement parce que la palette fait partie + du header). + + + ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ Pos ³ Champ ³ Type ³Taille³ Description ³ + ÆÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͵ + ³ 0 ³ Signature ³ char ³ 3 ³ ChaŒne constante "PKM" (SANS d‚limitation³ + ³ ³ ³ ³ ³ de taille '\0' ou autres...) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 3 ³ Version ³ byte ³ 1 ³ Pour le moment, ce champ ne peut prendre ³ + ³ ³ ³ ³ ³ que la valeur 0. ³ + ³ ³ ³ ³ ³ D'autres m‚thodes de compression pourront³ + ³ ³ ³ ³ ³ la modifier mais pour l'instant il n'y en³ + ³ ³ ³ ³ ³ a qu'une seule. ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 4 ³ Pack_byte ³ byte ³ 1 ³ Valeur de l'octet de reconnaissance pour ³ + ³ ³ ³ ³ ³ les r‚p‚titions de couleurs cod‚es sur 1 ³ + ³ ³ ³ ³ ³ Octet. (Voir la section sur la m‚thode de³ + ³ ³ ³ ³ ³ compression pour plus d'informations) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 5 ³ Pack_word ³ byte ³ 1 ³ Valeur de l'octet de reconnaissance pour ³ + ³ ³ ³ ³ ³ les r‚p‚titions de couleurs cod‚es sur 2 ³ + ³ ³ ³ ³ ³ Octets. (Voir la section sur la m‚thode ³ + ³ ³ ³ ³ ³ de compression pour plus d'informations) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 6 ³ Largeur ³ word ³ 2 ³ Largeur de l'image (en pixels) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 8 ³ Hauteur ³ word ³ 2 ³ Hauteur de l'image (en pixels) ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 10 ³ Palette ³ byte ³ 768 ³ Palette RGB (RGB RGB ... 256 fois) avec ³ + ³ ³ ³ ³ ³ des valeurs de 0 … 63. Je sais que le ³ + ³ ³ ³ ³ ³ standard dans les fichiers d'images est ³ + ³ ³ ³ ³ ³ de 0 … 255 mais je trouve ‡a cr‚tin! ³ + ³ ³ ³ ³ ³ C'est tellement plus simple d'envoyer la ³ + ³ ³ ³ ³ ³ palette toute entiŠre dans le port 3C9h ³ + ³ ³ ³ ³ ³ avec un REP OUTSB sans avoir … convertir ³ + ³ ³ ³ ³ ³ la palette. ³ + ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ 778 ³ Taille_PH ³ word ³ 2 ³ Taille du Post-header. C'est le nombre ³ + ³ ³ ³ ³ ³ d'octets entre le header et les donn‚es ³ + ³ ³ ³ ³ ³ de l'image. Cette valeur peut valoir 0. ³ + ÀÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + Les donn‚es du type "word" sont stock‚es selon les conventions d'Intel: + c'est-…-dire l'octet de poids le plus faible en premier. + + + +Le POST-HEADER: +ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + Le post-header a une taille variable. Il a ‚t‚ con‡u pour supporter les +nouvelles fonctions de ce format sans avoir a changer complŠtement le format. + + Il est constitu‚ d'identificateurs de champ suivis par leur taille et leur +contenu. + Un identificateur de champ est cod‚ sur 1 octet ainsi que sa taille. + + + Ces identificateurs de champ sont: (cette liste peut ˆtre rallong‚e...) + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + 0 : Commentaire sur l'image + 1 : Dimensions de l'‚cran d'origine + 2 : Couleur de fond (couleur de transparence) + + Si vous rencontrez un champ inconnu par votre routine de chargment, sautez + simplement au del…. Mais, par contre, si un champ vous dit de sauter … une + position qui tombe aprŠs le d‚but th‚orique des donn‚es de l'image, alors + c'est qu'il y a une erreur dans le fichier. + + + Les champs: + ÄÄÄÄÄÄÄÄÄÄÄ + + * Commentaire: + + Grƒce … ce champ, les artistes vont pouvoir commenter leurs dessins. + Notez que GrafX 2 a une taille limite de commentaire de 32 caractŠres. + Mais vous pourrez avoir des commentaires allant jusqu'… 255 caractŠres + si vous cr‚ez votre propre viewer puisque GrafX 2 ignorera simplement + les caractŠres en trop. + + Exemple: [0],[15],[Dessin de X-Man] + Cette s‚quence signifie: + - le champ est un commentaire + - le commentaire a une taille de 15 caractŠres (il n'y a pas de + caractŠre de fin de chaŒne puisque vous connaissez sa taille) + - le commentaire est "Dessin de X-Man" + + * Dimensions de l'‚cran d'origine: + + Puisque GrafX 2 propose un ‚norme choix de r‚solutions, il a sembl‚ + pratique d'ajouter un champ indicant quelles ‚taient les dimensions de + l'‚cran d'origine. + + Exemple: [1],[4],[320],[256] + Cette s‚quence signifie: + - Le champ d‚crit les dimensions de l'‚cran d'origine + - Les dimensions sont 2 words (donc cette valeur doit ˆtre ‚gale … 4) + - La largeur de l'‚cran d'origine ‚tait de 320 pixels + - La hauteur de l'‚cran d'origine ‚tait de 256 pixels + + Notez que les words stock‚s dans les champs sont ‚crits … la maniŠre + Intel. La BETA-version 90% ne respectait pas cette norme (d‚sol‚). + Ce n'est pas bien grƒve mais les images sauv‚es avec la version 90% et + recharg‚es avec une version post‚rieure (91% et plus) ne passeront pas + dans la bonne r‚solution. + + * Couleur de fond: + + Enregistrer la couleur de fond (couleur de transparence) se r‚vŠle + particuliŠrement utile lorsque vous voulez sauvegarder une brosse. + La taille de ce champ est 1 octet (indice de la couleur entre 0 et 255). + + Exemple: [2],[1],[255] + Cette s‚quence signifie: + - le champ d‚crit la couleur de fond + - la valeur prend 1 octet + - La couleur de transparence est 255 + + +La METHODE DE COMPACTAGE DE L'IMAGE: +ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ + + La m‚thode de compression PKM est une sorte de "Run-Length-Compression" qui +est trŠs efficace sur les images comportant de longues r‚p‚titions d'une mˆme +couleur horizontalement. + En fait la compression commence … ˆtre efficace s'il y a souvent plus de 3 +fois la mˆme couleur cons‚cutivement. + + Je pense qu'il est pr‚f‚rable de vous donner directement l'algorithme plut“t +que de nager dans des explications incomprehensibles. + + + DEBUT + /* + fonctions: + Lire_octet(Fichier) Lit et retourne 1 octet … partir de + Fichier + Dessiner_pixel(X,Y,Couleur) Dessine un pixel d'une certaine Couleur + … la position (X,Y) + Taille_fichier(Fichier) Retourne la taille totale d'un Fichier + en octets + + variables: + le type de Taille_image est dword + le type de Taille_donnees est dword + le type de Compteur_donnees est dword + le type de Compteur_pixels est dword + le type de Couleur est byte + le type de Octet_lu est byte + le type de Word_lu est word + le type de Compteur est word + le type de Fichier est + */ + + /* A cet endroit, le header et le post-header ont d‚j… ‚t‚ lus. */ + + Taille_image <- Header.Largeur * Header.Hauteur + Taille_donnees <- Taille_fichier(Fichier) - (780+Header.Taille_PH) + + Compteur_donnees <- 0 + Compteur_pixels <- 0 + + /* Boucle de d‚compression: */ + TANT QUE ((Compteur_pixelsHeader.Pack_byte) ET (Octet_lu<>Header.Pack_word)) + ALORS + { + Dessiner_pixel(Compteur_pixels MOD Header.Largeur, + Compteur_pixels DIV Header.Largeur, + Octet_lu) + + Compteur_pixels <- Compteur_pixels + 1 + Compteur_donnees <- Compteur_donnees + 1 + } + SINON /* Est-ce que le nombre de pixels … r‚p‚ter est cod‚... */ + { /* ... sur 1 octet ? */ + SI (Octet_lu = Header.Pack_byte) ALORS + { + Couleur <- Lire_octet(Fichier) + Octet_lu <- Lire_octet(Fichier) + + POUR Compteur ALLANT DE 0 A (Octet_lu-1) PAR PAS DE +1 + Dessiner_pixel((Compteur_pixels+Compteur) MOD Header.Largeur, + (Compteur_pixels+Compteur) DIV Header.Largeur, + Couleur) + + Compteur_pixels <- Compteur_pixels + Octet_lu + Compteur_donnees <- Compteur_donnees + 3 + } + SINON /* ... sur 2 octets ? */ + { + Couleur <- Lire_octet(Fichier) + Word_lu <- (word) (Lire_octet(Fichier) SHL 8)+Lire_octet(Fichier) + + POUR Compteur ALLANT DE 0 A (Word_lu-1) PAR PAS DE +1 + Dessiner_pixel((Compteur_pixels+Compteur) MOD Header.Largeur, + (Compteur_pixels+Compteur) DIV Header.Largeur, + Couleur) + + Compteur_pixels <- Compteur_pixels + Word_lu + Compteur_donnees <- Compteur_donnees + 4 + } + } + } + FIN + + + Par exemple, la s‚quence suivante: + (on suppose que Pack_byte=01 et Pack_word=02) + 04 03 01 05 06 03 02 00 01 2C + sera d‚cod‚e comme: + 04 03 05 05 05 05 05 05 03 00 00 00 ... (rep‚ter 0 300 fois (012Ch=300)) + + Les r‚p‚titions qui tiennent sur un word doivent ˆtre ‚crites avec leur + octet de poids le plus fort en premier. Je sais que ‡a va … l'encontre du + standard Intel mais puisque je lis les octets du fichier au travers d'un + buffer (franchement plus rapide), Je me fous complŠtement de l'ordre + (D‚sol‚ :)). Mais les words du header et du post-header doivent ˆtre ‚crits + et lus … la maniŠre Intel! + + + Conseils de compactage: + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + + * Comme vous pouvez le constater, il pourrait y avoir un problŠme lorsque + vous devriez compacter un pixel brut de couleur ‚gale … Pack_byte ou … + Pack_word. Ces pixels doivent toujours ˆtre cod‚s comme des paquets mˆme + s'il n'y a qu'un seul pixel. + + Exemple: (supposons que Pack_byte=9) + 9 sera encod‚ 9,9,1 (Le 1er 9 dans la s‚quence... + 9,9 sera encod‚ 9,9,2 ... encod‚e est Pack_byte) + etc... + + * Il semble ‚vident de trouver des valeurs pour Pack_byte et Pack_word qui + ne sont jamais (ou presque) utilis‚es. Donc, une petite routine qui trouve + les 2 couleurs les moins utilis‚es dans l'image devrait ˆtre appel‚e avant + de commencer la compression. Ceci peut ˆtre r‚alis‚ presque instantan‚ment + en Assembleur. + + * Quand vous voulez ‚crire une s‚quence de 2 couleurs identiques, ‚crivez + simplement ces 2 couleurs l'une aprŠs l'autre (Couleur,Couleur) puisque ‡a + ne prend que 2 octets au lieu de 3 si vous aviez ‚crit un paquet (Pack_byte, + Couleur,2). + + * Si vous compressez une image extrˆmement simple qui comporte une s‚quence + de plus de 65535 fois la mˆme couleur cons‚cutivement, vous devez "casser" + la s‚quence et continuer avec un nouveau paquet. + + Exemple: vous devez compacter les 65635 mˆmes octets cons‚cutifs (de + couleur 0 par exemple) + (On suppose que Pack_byte=01 et Pack_word=02) + Vous devrez alors ‚crire: 02 00 FF FF 01 00 64 (FFFFh=65535, 64h=100) + + + +ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +³ °±²Û Passer dans les modes vid‚os de GrafX 2.00 Û²±° ³ +ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + + Toutes les proc‚dures d'initialisation de mode sont ‚crites en ASM 386. De + toutes fa‡ons, si vous ne comprenez pas une ligne d'ASM, je ne vois vraiment + pas … quoi pourront vous servir ces proc‚dures. + + Elles ont ‚t‚ con‡ues pour ˆtre utilis‚es dans le modŠle de m‚moire FLAT. + Mais cela ne devrait pas vous prendre trop de temps de les adapter au modŠle + que vous souhaitez utiliser puisqu'il n'y a que les manipulations de m‚moire + que cela affectera (utilisez donc DS:SI au lieu de ESI, ES:DI … la place de + EDI et faŒtes attention … l'adresse 0A0000h qui se transforme en l'adresse + 0A000h:0000h). + + +MCGA: (Mode VGA standard) +ÍÍÍÍÍ + + Y-a-t'il quelqu'un sur cette planŠte qui ne sache toujours pas comment + on passe en mode MCGA 320x200 en 256 couleurs ??!? + Bon... Je suppose que vous ˆtes un novice si vous lisez les 2 lignes + suivantes :) + + + mov ax,0013h + int 10h + + + +Modes X: (Modes VGA ‚tendus) +ÍÍÍÍÍÍÍÍ + + Bon... Il me semble que le Mode X original ‚tait en 320x240, mais + maintenant tout le monde appelle "Modes X" (ou X-Modes, ou Tweaked modes) + tous les modes VGA qui utilise plus de 64Ko de m‚moire vid‚o et la structure + "Unchained". + Afficher un pixel dans n'importe quel Mode X peut ˆtre effectu‚ par la + mˆme et unique fonction (mais je ne vous expliquerai pas comment faire, il + vous suffit d'indiquer … la fonction la taille des plans (Largeur/4)). + Si vous ne comprenez rien … ce que je dis, (Unchained, plans...) il vous + suffit de lire n'importe quelle bonne documentation sur le Mode X. + + + Nous tenons … remercier les auteurs de XLIB2 pour nous avoir ‚conomis‚ du + temps en ayant ‚crit cette fonction. Nous l'avons l‚gŠrement optimis‚e en + fonction de nos besoins, mais l'essentiel en a ‚t‚ conserv‚. + + + mov ax,13h ; Oui! Encore le mode MCGA! Tous les Modes X doivent + int 10h ; commencer … partir du mode VGA standard, mais bien des + ; choses changent par la suite. + + mov dx,3C6h ; Pour la dur‚e de l'initialisation, on va ‚teindre la + xor al,al ; palette de fa‡on … ce que l'utilisateur ne subisse pas + out dx,al ; nos triturations. + + mov dx,3C4h ; Nous allons demander au registre TIMING SEQUENCER de + mov ax,0604h ; passer dans le mode "Unchained" (mode X), sans g‚rer de + out dx,ax ; parit‚, et un accŠs aux 256Ko de la carte vid‚o. + mov ax,0100h ; On va ensuite enclencher le reset synchrone du registre + out dx,ax ; TS car on s'apprˆte … jouer avec les registres. + + mov al,01h ; De la mˆme fa‡on que pour la palette, on demande … la + out dx,al ; carte vid‚o de ne plus scruter la m‚moire pour + inc dx ; afficher son contenu. Ainsi, c'est une fa‡on de plus + in al,dx ; d'‚viter l'affichage parasite qui arrive le temps que + mov ah,al ; le mode soit totalement initialis‚ et stabilis‚. + mov al,01h ; De plus, on peut esp‚rer qu'en demandant un arrˆt de + push ax ; la lecture de la m‚moire, le systŠme s'en voit un peu + mov al,ah ; acc‚l‚r‚, et ainsi acc‚l‚rer l'initialisation du mode + or al,20h ; graphique (l'espoir fait vivre :)) + out dx,al ; + + mov esi,X_ptr ; Pointeur sur la liste des constantes … envoyer au CRTC. + cld + + lodsb ; Ceci charge dans AL une valeur qui nous dira quoi faire + ; avec le registre MISCELLANEOUS, et incr‚mente ESI. + ; La valeur est ‚gale … ZERO => Rien … faire + ; sinon => Envoyer AL au reg. MISC. + + or al,al ; Devons nous modifier le mode vid‚o de base ? + jz NonMerci ; Non?Ä¿ En fait, la r‚ponse est toujours "Oui". + mov dx,3C2h ; ³ Sauf pour quelques modes tels que le + out dx,al ; ³ 320x200 en Mode X + NonMerci: ; <ÄÄÄÄÙ (mais notre mode 320x200 est en MCGA...) + + mov dx,3C4h ; On en a termin‚ avec les manipulations du registre + mov ax,0300h ; MISCELLANEOUS, on peut maintenant d‚senclencher le + out dx,ax ; reset synchrone du registre TIMING SEQUENCER. + + ; Et maintenant, si on jouait avec le CRTC? + + mov dx,3D4h ; Dans le 18Šme registre du CRTC, on va d‚senclencher le + mov al,11h ; bit de protection. Sans cela, les valeurs que nous + out dx,al ; aurions envoy‚es aux registres du CRTC auraient ‚t‚ + inc dx ; ignor‚es. + in al,dx + and al,7Fh + out dx,al + + dec dx ; DX pointe … nouveau sur "l'entr‚e" du registre CRTC. + lodsb ; Ceci met dans AL le nombre de registres CRTC … changer + xor ecx,ecx ; On doit nettoyer ECX avant de commencer … r‚p‚ter... + mov cl,al ; ...CL (AL) fois OUTSW + rep outsw ; On peut envoyer la sauce aux registres du CRTC! + + ; Juste au cas o— le 20Šme registre CRTC aurait ‚t‚ oubli‚ dans la table + ; d'initialisation, on peut le calculer nous-mˆmes (Ouaip, on est des + ; braves gars). + + mov ax,Screen_width ; Vous devez indiquer … la routine quelle est la + shr ax,3 ; largeur de l'‚cran + mov ah,al + mov al,13h + out dx,ax + + mov dx,3C4h ; Maintenant vous avez la bonne r‚solution mais il peut + mov ax,0F02h ; y avoir des pixels pourris … l'‚cran … cause de zones + out dx,ax ; non nettoy‚es de la m‚moire vid‚o. + mov edi,0A0000h ; Donc on va nettoyer la m‚moire … partir de 0A0000h + xor eax,eax ; avec la valeur 0 (qui est le noir standard) et sur une + mov ecx,4000h ; longueur de 4000h dwords (256Ko). + rep stosd ; Allez, liquidez-moi tout ‡a! + + mov dx,3C4h ; On peut redemander … la carte VGA de relire la m‚moire + pop ax ; pour afficher l'‚cran... + out dx,ax ; + mov dx,3C6h ; ... et r‚tablir la palette pour que l'image soit + mov al,0FFh ; visible … l'utilisateur. + out dx,al ; + + + + La table de constantes que vous devez employer est l'une des suivantes: + (Ces tables sont au format C, mais elles peuvent facilement ˆtres employ‚es + dans d'autres langages) + + word X320Y224[] = + { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x0014, + 0xC715, 0x0416, 0xE317 }; + word X320Y240[] = + { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, + 0x0616, 0xE317 }; + word X320Y256[] = + { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x2013, + 0x0014, 0x0715, 0x1A16, 0xE317 }; + word X320Y270[] = + { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x0014, + 0x1F15, 0x2F16, 0xE317 }; + word X320Y282[] = + { 0x0CE3, 0x6206, 0xF007, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2F13, + 0x0014, 0x3C15, 0x5C16, 0xE317 }; + word X320Y300[] = + { 0x0DE3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2013, + 0x0014, 0x2F15, 0x4416, 0xE317 }; + word X320Y360[] = + { 0x09E3, 0x4009, 0x8810, 0x8511, 0x6712, 0x2013, 0x0014, 0x6D15, 0xBA16, + 0xE317 }; + word X320Y400[] = + { 0x03E3, 0x4009, 0x0014, 0xE317 }; + word X320Y448[] = + { 0x0BA3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x0014, + 0xC715, 0x0416, 0xE317 }; + word X320Y480[] = + { 0x0AE3, 0x0D06, 0x3E07, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, + 0x0616 , 0xE317}; + word X320Y512[] = + { 0x0CE3, 0x2306, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x2013, + 0x0014, 0x0715, 0x1A16, 0xE317 }; + word X320Y540[] = + { 0x0BE7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x0014, + 0x1F15, 0x2F16, 0xE317 }; + word X320Y564[] = + { 0x0CE7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2013, + 0x0014, 0x3C15, 0x5C16, 0xE317 }; + word X320Y600[] = + { 0x0BE7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x0014, + 0x5815, 0x7016, 0xE317 }; + word X360Y200[] = + { 0x09E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2D13, 0x0014, + 0xE317 }; + word X360Y224[] = + { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, + 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X360Y240[] = + { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, + 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; + word X360Y256[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, + 0x0008, 0x6109, 0x0E10, 0xAC11, 0xFF12, 0x2D13, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X360Y270[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, + 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X360Y282[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, + 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X360Y300[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4606, 0x1F07, + 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2D13, 0x0014, 0x2F15, 0x4416, + 0xE317 }; + word X360Y360[] = + { 0x0FE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x8810, + 0x8511, 0x6712, 0x2D13, 0x0014, 0x6D15, 0xBA16, 0xE317 }; + word X360Y400[] = + { 0x0AE7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x4009, 0x2D13, + 0x0014, 0xE317 }; + word X360Y448[] = + { 0x12A7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6F06, 0xBA07, + 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x2D13, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X360Y480[] = + { 0x11E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x0D06, 0x3E07, + 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x2D13, 0x0014, 0xE715, 0x0616, 0xE317 }; + word X360Y512[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x2B06, 0xB207, + 0x0008, 0x6009, 0x0E10, 0xAC11, 0xff12, 0x2D13, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X360Y540[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x3006, 0xF007, + 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x2D13, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X360Y564[] = + { 0x12EB, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0x6206, 0xF007, + 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x2D13, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X360Y600[] = + { 0x12E7, 0x6B00, 0x5901, 0x5A02, 0x8E03, 0x5E04, 0x8A05, 0xBE06, 0xF007, + 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x2D13, 0x0014, 0x5815, 0x7016, + 0xE317 }; + word X400Y200[] = + { 0x09E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3213, 0x0014, + 0xE317 }; + word X400Y224[] = + { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, + 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X400Y240[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, + 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, + 0xE317 }; + word X400Y256[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, + 0x0008, 0x6109, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X400Y270[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, + 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X400Y282[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, + 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X400Y300[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4606, 0x1F07, + 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x3213, 0x0014, 0x2F15, 0x4416, + 0xE317 }; + word X400Y360[] = + { 0x0FE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x8810, + 0x8511, 0x6712, 0x3213, 0x0014, 0x6D15, 0xBA16, 0xE317 }; + word X400Y400[] = + { 0x0AE7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x4009, 0x3213, + 0x0014, 0xE317 }; + word X400Y448[] = + { 0x12A7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6F06, 0xBA07, + 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0x3213, 0x0014, 0xC715, 0x0416, + 0xE317 }; + word X400Y480[] = + { 0x11E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x0D06, 0x3E07, + 0x4009, 0xEA10, 0xAC11, 0xDF12, 0x3213, 0x0014, 0xE715, 0x0616, 0xE317 }; + word X400Y512[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x2B06, 0xB207, + 0x0008, 0x6009, 0x1310, 0xAC11, 0xFF12, 0x3213, 0x0014, 0x0715, 0x1A16, + 0xE317 }; + word X400Y540[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x3006, 0xF007, + 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x3213, 0x0014, 0x1F15, 0x2F16, + 0xE317 }; + word X400Y564[] = + { 0x12EB, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0x6206, 0xF007, + 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3213, 0x0014, 0x3C15, 0x5C16, + 0xE317 }; + word X400Y600[] = + { 0x12E7, 0x7100, 0x6301, 0x6402, 0x9203, 0x6604, 0x8205, 0xBE06, 0xF007, + 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x3213, 0x0014, 0x5815, 0x7016, + 0xE317 }; + + + La structure: (exemple) + + ÚÄÄÄÄCeci est le nombre de valeurs … envoyer aux registres CRTC. C'est + ³ en fait le nombre de words dans la table moins 1 (… cause du 1er + ³ word de la table qui n'est pas envoy‚ au CRTC mais qui contient + ³ une valeur … envoyer au registre MISCELLANEOUS et le nombre de + ³ valeurs … envoyer aux registres CRTC ;) ). + ³ + ³ ÚÄÄCeci est la valeur … envoyer au registre MISCELLANEOUS (ou 0 si + ³ ³ aucune valeur ne doit y ˆtre envoy‚e). + ³ ³ + ³ ³ ÚÄÄÄCeci est une valeur … envoyer dans un registre du CRTC. + ³ ³ ³ + ³ ³ ³ ÚÄCeci est le num‚ro du registre du CRTC qui recevra la + ³ ³ ³ ³ valeur cit‚e pr‚c‚demment. + ÿÿ ÿÿ + { 0x0AE3, 0x0D06, 0x3E07, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0x0014, 0xE715, + 0x0616, 0xE317 }; + + Vous pouvez remarquer que les registres 0 … 5 (et le 13h) du CRTC + d‚finissent la largeur de l'‚cran, alors que les registres 6 … 17h (… + l'exception du 13h) definissent la hauteur de l'‚cran. + + + Nous avons plus de modes en poche que les quelques-uns :) que nous avons + inclus dans GrafX 2.00, mais ils ne sont ni vraiment utiles ni vraiment + stables. Nous pourrons toutefois d‚cider de les inclure dans une prochaine + version. + S'il manque certains de vos modes pr‚f‚res, envoyez nous simplement la + liste des constantes que l'on doit balancer au CRTC … la maniŠre de la + structure utilis‚e ci-dessus. + + IMPORTANT! Les valeurs des constantes cit‚es plus haut ne sont pas + support‚es par tous les moniteurs ou les cartes vid‚os. + Nous avons test‚ GrafX2 avec diff‚rentes configurations et avons + constat‚s que certains modes ne marchent pas du tout avec + certaines cartes vid‚os, alors que d'autres d‚bordent de l'‚cran, + sont d‚centr‚s, assombris, trop clairs, ou tass‚s. + Toutefois, ils marchent tous correctement avec notre pauvre + petite Tseng Labs ET4000... + + Si vous avez d‚j… une bonne connaissance … propos du CRTC, et avez des + valeurs diff‚rentes des notres pour certains modes, merci de nous en + informer. Nous nous en servirons s'ils marchent mieux sur une majorit‚ + d'ordinateurs. + + + +VESA: (Un "pseudo-standard" pour les modes Super-VGA) +ÍÍÍÍÍ + + Nous nous servons du VESA pour des modes qui n‚cessitent une largeur de + 640, 800 ou 1024 pixels. Mais il existe un moyen de combiner la hauteur des + Modes X avec les modes VESA, il est ainsi possible d'avoir des modes aussi + timbr‚s qu'en Mode X. + + + mov ax,4F02h + mov bx,Video_mode + int 10h + + + Les modes VESA 256 couleur VESA sont: + 100h : 640x400 + 101h : 640x480 + 103h : 800x600 + 105h : 1024x768 + 107h : 1280x1024 (non disponible dans GrafX2 parce qu'uniquement support‚ + par des cartes vid‚o avec 2 Megaoctets ou plus de m‚moire + vid‚o) + + + Comme avec les Modes X, vous pouvez modifier les registres CRTC pour acc‚der + aux modes "VESA-X"! (Notez que certaines cartes vid‚o ne supportent pas les + modifications des registres du CRTC VGA dans les modes VESA.) + + + Pour passer dans ces modes ‚tendus, passez dans un mode VESA standard ayant + la bonne largeur, puis appelez Modif_registres_CRTC avec la bonne table de + hauteur. + + Exemple (640x512) : + VESA_Set_mode(101h) // On passe dans un mode qui a la mˆme largeur + Modif_registres_CRTC(Y512) // On modifie la hauteur + + + * Tables des hauteurs: + + word Y224[] = + { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4109, 0x0810, 0x8A11, 0xBF12, 0xC715, + 0x0416 }; + word Y240[] = + { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4109, 0xEA10, 0xAC11, 0xDF12, 0xE715, + 0x0616 }; + word Y256[] = + { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6109, 0x0A10, 0xAC11, 0xFF12, 0x0715, + 0x1A16 }; + word Y270[] = + { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6109, 0x2010, 0xA911, 0x1B12, 0x1F15, + 0x2F16 }; + word Y282[] = + { 0x0AE3, 0x6206, 0xF007, 0x0008, 0x6109, 0x310F, 0x3710, 0x8911, 0x3312, + 0x3C15, 0x5C16 }; + word Y300[] = + { 0x09E3, 0x4606, 0x1F07, 0x0008, 0x4009, 0x3110, 0x8011, 0x2B12, 0x2F15, + 0x4416 }; + word Y350[] = + { 0x09A3, 0xBF06, 0x1F07, 0x0008, 0x4009, 0x8310, 0x8511, 0x5D12, 0x6315, + 0xBA16 }; + word Y360[] = + { 0x07E3, 0x0008, 0x4009, 0x8810, 0x8511, 0x6712, 0x6D15, 0xBA16 }; + word Y400[] = + { 0x01E3, 0x4009 }; + word Y448[] = + { 0x09A3, 0x6F06, 0xBA07, 0x0008, 0x4009, 0x0810, 0x8A11, 0xBF12, 0xC715, + 0x0416 }; + word Y480[] = + { 0x09E3, 0x0D06, 0x3E07, 0x0008, 0x4009, 0xEA10, 0xAC11, 0xDF12, 0xE715, + 0x0616 }; + word Y512[] = + { 0x0900, 0x2B06, 0xB207, 0x0008, 0x6009, 0x0A10, 0xAC11, 0xFF12, 0x0715, + 0x1A16 }; + word Y540[] = + { 0x09E7, 0x3006, 0xF007, 0x0008, 0x6009, 0x2010, 0xA911, 0x1B12, 0x1F15, + 0x2F16 }; + word Y564[] = + { 0x09E7, 0x6206, 0xF007, 0x0008, 0x6009, 0x3E10, 0x8911, 0x3312, 0x3C15, + 0x5C16 }; + word Y600[] = + { 0x09E7, 0xBE06, 0xF007, 0x0008, 0x6009, 0x7C10, 0x8C11, 0x5712, 0x5815, + 0x7016 }; + + + + Modifier les registres CRTC: (inspir‚ de l'init. des Modes X... voir plus + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ haut pour de plus amples d‚tails) + + mov esi,XVESA_Ptr + cld + + lodsb + or al,al ; Devons nous modifier le mode vid‚o de base ? + jz NonMerci ; Non?Ä¿ La r‚ponse peut ˆtre "Non" car les initialisations + mov dx,3C2h ; ³ de certains modes VESA mettent directement la + out dx,al ; ³ bonne valeur pour le registre MISCELLANEOUS. + NonMerci: ; <ÄÄÄÄÙ + + mov dx,3D4h + mov al,11h + out dx,al + inc dx + in al,dx + and al,7Fh + out dx,al + + dec dx + lodsb + xor ecx,ecx + mov cl,al + rep outsw + + + + Si vous ˆtes suffisament astucieux, vous pourrez combiner les constantes + utilis‚es dans les Modes X pour obtenir plus de modes "VESA-X" tels que le + 640x200, 800x480, etc... (mais je ne pense pas que ‡a marche convenablement + avec les largeurs de 1024 pixels puisque ce mode est g‚n‚ralement + entrelac‚... Mais qui sait?...) + Je pense que le plus difficile est de trouver la bonne valeur du registre + MISCELLANEOUS. diff --git a/share/grafx2/fonts/PF_Arma_5__.png b/share/grafx2/fonts/PF_Arma_5__.png new file mode 100644 index 00000000..9bbc3aff Binary files /dev/null and b/share/grafx2/fonts/PF_Arma_5__.png differ diff --git a/share/grafx2/fonts/PF_Easta_7_.png b/share/grafx2/fonts/PF_Easta_7_.png new file mode 100644 index 00000000..753b4955 Binary files /dev/null and b/share/grafx2/fonts/PF_Easta_7_.png differ diff --git a/share/grafx2/fonts/PF_Easta_7__.png b/share/grafx2/fonts/PF_Easta_7__.png new file mode 100644 index 00000000..d7ce2a3d Binary files /dev/null and b/share/grafx2/fonts/PF_Easta_7__.png differ diff --git a/share/grafx2/fonts/PF_Ronda_7__.png b/share/grafx2/fonts/PF_Ronda_7__.png new file mode 100644 index 00000000..429e5cc1 Binary files /dev/null and b/share/grafx2/fonts/PF_Ronda_7__.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_5.png b/share/grafx2/fonts/PF_Tempesta_5.png new file mode 100644 index 00000000..cec49bda Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_5.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_5_.png b/share/grafx2/fonts/PF_Tempesta_5_.png new file mode 100644 index 00000000..75ee8795 Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_5_.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_5__.png b/share/grafx2/fonts/PF_Tempesta_5__.png new file mode 100644 index 00000000..fdd54e18 Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_5__.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_5___.png b/share/grafx2/fonts/PF_Tempesta_5___.png new file mode 100644 index 00000000..c75db671 Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_5___.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_7.png b/share/grafx2/fonts/PF_Tempesta_7.png new file mode 100644 index 00000000..6db5e0f6 Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_7.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_7_.png b/share/grafx2/fonts/PF_Tempesta_7_.png new file mode 100644 index 00000000..fe387ae7 Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_7_.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_7__.png b/share/grafx2/fonts/PF_Tempesta_7__.png new file mode 100644 index 00000000..56ab7c7b Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_7__.png differ diff --git a/share/grafx2/fonts/PF_Tempesta_7___.png b/share/grafx2/fonts/PF_Tempesta_7___.png new file mode 100644 index 00000000..64b77ad1 Binary files /dev/null and b/share/grafx2/fonts/PF_Tempesta_7___.png differ diff --git a/share/grafx2/fonts/PF_Westa_7_.png b/share/grafx2/fonts/PF_Westa_7_.png new file mode 100644 index 00000000..e6c4f95c Binary files /dev/null and b/share/grafx2/fonts/PF_Westa_7_.png differ diff --git a/share/grafx2/fonts/PF_Westa_7__.png b/share/grafx2/fonts/PF_Westa_7__.png new file mode 100644 index 00000000..df086afc Binary files /dev/null and b/share/grafx2/fonts/PF_Westa_7__.png differ diff --git a/share/grafx2/gfx2def.ini b/share/grafx2/gfx2def.ini index 8375b3bb..b05c8ef8 100644 --- a/share/grafx2/gfx2def.ini +++ b/share/grafx2/gfx2def.ini @@ -356,4 +356,22 @@ ; Menubars_visible = 255; (Default 255) + ; This enables a mode where right mouse buttons acts as + ; a color picker, with most tools. + ; + Right_click_colorpick = NO; (Default NO) + + ; When this mode is active, scrolling the view (and the magnifier view) + ; affects both the main image and the spare page - as long as they have + ; the same dimensions. + Sync_views = YES; (Default YES) + + ; This setting determines which key inverts the mouse buttons + ; when it's held : A left click is then interpreted as a right-click. + ; It's especially useful for one-button controllers, + ; such as touchscreens and tablets. + ; Possible values are 0 (none), 1 (control), 2 (alt) + + Swap_buttons = 1; (Default 1) + ; end of configuration diff --git a/share/grafx2/scripts/ani_db_ellipse.lua b/share/grafx2/scripts/ani_db_ellipse.lua new file mode 100644 index 00000000..fe8da2f2 --- /dev/null +++ b/share/grafx2/scripts/ani_db_ellipse.lua @@ -0,0 +1,79 @@ +--PICTURE scene: Ellipse update-demo (anim) +--Demonstrates 'interactive' features. +--by Richard Fhager + +-- Copyright 2011 Richard Fhager +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; version 2 +-- of the License. See + + +-- +-- rot: Rotation in degrees +-- stp: Step is # of line segments (more is "better") +-- a & b are axis-radius +function ellipse2(x,y,a,b,stp,rot,col) + local n,m=math,rad,al,sa,ca,sb,cb,ox,oy,x1,y1,ast + m = math; rad = m.pi/180; ast = rad * 360/stp; + sb = m.sin(-rot * rad); cb = m.cos(-rot * rad) + for n = 0, stp, 1 do + ox = x1; oy = y1; + sa = m.sin(ast*n) * b; ca = m.cos(ast*n) * a + x1 = x + ca * cb - sa * sb + y1 = y + ca * sb + sa * cb + if (n > 0) then line(ox,oy,x1,y1,col); end + end +end +-- + +-- +function line(x1,y1,x2,y2,c) + local n,st,m; m = math + st = m.max(1,m.abs(x2-x1),m.abs(y2-y1)); + for n = 0, st, 1 do + putpicturepixel(m.floor(x1+n*(x2-x1)/st), m.floor(y1+n*(y2-y1)/st), +c ); + end +end +-- + +setpicturesize(300,300) +setcolor(0,96,96,96) +setcolor(1,255,255,128) + +r1 = 100 +r2 = 50 +rt = 0 + +frames = 100 + + +while (1 < 2) do + + r1t = 10 + math.random() * 140 + r2t = 10 + math.random() * 140 + rtt = math.random() * 360 + +for n = 0, frames-1, 1 do + clearpicture(0) + + f2 = n / frames + f1 = 1 - f2 + + r1a = r1*f1 + r1t*f2 + r2a = r2*f1 + r2t*f2 + rta = rt*f1 + rtt*f2 + + -- x, y, r1, r2, stp, rot, col + ellipse2(150, 150, r1a, r2a, 50, rta, 1) + + statusmessage('press ESC to stop') + updatescreen();if (waitbreak(0)==1) then return end + +end + + r1,r2,rt = r1a,r2a,rta + +end diff --git a/share/grafx2/scripts/ani_db_spritesheet.lua b/share/grafx2/scripts/ani_db_spritesheet.lua new file mode 100644 index 00000000..9c964047 --- /dev/null +++ b/share/grafx2/scripts/ani_db_spritesheet.lua @@ -0,0 +1,47 @@ +--ANIM: Sprite Animator v0.1 +--Spare page holds data - Plays on current +--by Richard Fhager + +require("memory") + +arg=memory.load({XS=16,YS=16,SPACE=1,FRAMES=8,XOFF=0,YOFF=0,FPS=10}) + +OK, XS, YS, SPACE, FRAMES, XOFF, YOFF, FPS = inputbox("Sprite-Sheet +Animator", + "Sprite X-size", arg.XS, 1, 256,0, + "Sprite Y-size", arg.YS, 1, 256,0, + "Spacing", arg.SPACE, 0, 32,0, + "# of Frames", arg.FRAMES,2, 100,0, + "X-offset", arg.XOFF, 0, 256,0, + "Y-offset", arg.YOFF, 0, 256,0, + "Play Speed (FPS)",arg.FPS, 1, 60,0 +); + + +if OK == true then + +memory.save({XS=XS,YS=YS,SPACE=SPACE,FRAMES=FRAMES,XOFF=XOFF,YOFF=YOFF,FPS=FPS}) + + MAXPLAYS = 25 + + w,h = getpicturesize() + OX = w / 2 - XS/2 + OY = h / 2 - YS/2 + + for play = 1, MAXPLAYS, 1 do + + for f = 0, FRAMES-1, 1 do + for y = 0, YS-1, 1 do + for x = 0, XS-1, 1 do + sx = x + XOFF + f * (XS + SPACE) + sy = y + YOFF + putpicturepixel(OX+x, OY+y, getsparepicturepixel(sx, sy)) + end + end + updatescreen(); if (waitbreak(1/FPS)==1) then return; end + end + + end -- plays + +end --OK + diff --git a/share/grafx2/scripts/libs/memory.lua b/share/grafx2/scripts/libs/memory.lua new file mode 100644 index 00000000..22d1ea24 --- /dev/null +++ b/share/grafx2/scripts/libs/memory.lua @@ -0,0 +1,132 @@ +-- Persistence library: +-- Memorize data for current function +-- memory.save(tab) and tab=memory.load() +-- +-- The data will be stored in file called +-- ZZZ.dat +-- in the lua directory +-- +-- Example 1: +-- +-- -- Load initial values or set defaults +-- arg = memory.load({picX=320,picY=200,scale=0}) +-- -- Run an inputbox +-- OK,arg.picX,arg.picY,arg.scale = inputbox("Image Size")", +-- "Width", arg.picX, 1,2048,0, +-- "Height", arg.picY, 1,2048,0, +-- "Scale", arg.scale, 0,1,0); +-- if OK == true then +-- -- Save the selected values +-- memory.save(arg) +-- end + +-- Example 2: +-- +-- -- Load initial values or set defaults +-- arg = memory.load({x=320,y=200,scale=0}) +-- picX=arg.x +-- picY=arg.y +-- scale=arg.scale +-- -- Run an inputbox +-- OK,picX,picY,scale = inputbox("Image Size")", +-- "Width", picX, 1,2048,0, +-- "Height", picY, 1,2048,0, +-- "Scale", scale, 0,1,0); +-- if OK == true then +-- -- Save the selected values +-- memory.save({x=picX,y=picY,scale=scale}) +-- end + + +memory = +{ + serialize = function(o) + if type(o) == "number" then + return tostring(o) + elseif type(o) == "string" then + return string.format("%q", o) + --elseif type(o) == "table" then + -- io.write("{\n") + -- for k,v in pairs(o) do + -- io.write(" ", k, " = ") + -- memory.serialize(v) + -- io.write(",\n") + -- end + -- io.write("}\n") + else + error("cannot serialize a " .. type(o)) + end + end; + + -- Return a string identifying the calling function. + -- Pass 1 for parent, 2 for grandparent etc. + callername = function(level) + local w + local last_slash + local info = debug.getinfo(level+1,"Sn") + local caller=tostring(info.name) + -- Function name if possible + if (caller~="nil") then + return caller + end + -- Otherwise, get file name, without extension + + -- Get part after directory name + last_slash=0 + while true do + local pos = string.find(info.short_src, "/", last_slash+1) + if (pos==nil) then break end + last_slash=pos + end + caller=string.sub(info.short_src, last_slash+1) + + -- Remove file extension + if (string.sub(caller,-4, -1)==".lua") then + caller=string.sub(caller, 1, -5) + end + return caller + end; + + -- Memorize some parameters. + save = function(o) + local caller=memory.callername(2) + --for k, v in pairs(o) do + -- messagebox(tostring(k)) + -- messagebox(tostring(v)) + --end + local f, e = io.open("ZZZ"..caller..".dat", "w"); + if (f ~= nil) then + f:write("Entry {\n") + for k, v in pairs(o) do + if (type(v)=="number") then + f:write(" "..k.."="..memory["serialize"](v)..",\n") + end + end + f:write("}\n") + f:close() + end + end; + + + -- Recover some saved parameters. + load = function(o) + local caller=memory.callername(2) + local i + + function Entry (b) + -- Adds (or replaces) values in arg with those from b + for k, v in pairs(b) do + o[k]=v + end + end + local f = (loadfile("ZZZ"..caller..".dat")) + if (f ~= nil) then + f() + end + + return o + end; + +} + +return memory diff --git a/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua b/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua index 3aeb78a3..21d786eb 100644 --- a/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua +++ b/share/grafx2/scripts/pic_db_SierpinskyCarpet.lua @@ -49,7 +49,11 @@ for y = 0, h - 1, 1 do c = matchcolor(rp*f,gp*f,bp*f) putpicturepixel(x, y, c); - end + updatescreen() + if (waitbreak(0)==1) then + return + end + end diff --git a/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua b/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua index 9f784c9e..5b4c9cf1 100644 --- a/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua +++ b/share/grafx2/scripts/pic_db_SierpinskyTriangle.lua @@ -49,5 +49,9 @@ for y = 0, h - 1, 1 do putpicturepixel(x, y, c); end + updatescreen() + if (waitbreak(0)==1) then + return + end end diff --git a/share/grafx2/scripts/pic_ni_Colorspace12bit.lua b/share/grafx2/scripts/pic_ni_Colorspace12bit.lua deleted file mode 100644 index fe88ff56..00000000 --- a/share/grafx2/scripts/pic_ni_Colorspace12bit.lua +++ /dev/null @@ -1,18 +0,0 @@ --- 12bit colour space from palette --- - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -for y1=0,3,1 do - for x1=0,3,1 do - for y2=0,15,1 do - for x2=0,15,1 do - putpicturepixel(x1*16+x2,y1*16+y2,matchcolor((y2*255)/15, -((y1*4+x1)*255)/15,(x2*255)/15)) - end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_Colorspace15bit.lua b/share/grafx2/scripts/pic_ni_Colorspace15bit.lua deleted file mode 100644 index 9a82a611..00000000 --- a/share/grafx2/scripts/pic_ni_Colorspace15bit.lua +++ /dev/null @@ -1,18 +0,0 @@ --- 15bit colour space from palette --- - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -for y1=0,3,1 do - for x1=0,7,1 do - for y2=0,31,1 do - for x2=0,31,1 do - putpicturepixel(x1*32+x2,y1*32+y2,matchcolor((y2*255)/31, -((y1*8+x1)*255)/31,(x2*255)/31)) - end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_Colorspace18bit.lua b/share/grafx2/scripts/pic_ni_Colorspace18bit.lua deleted file mode 100644 index 595dd09c..00000000 --- a/share/grafx2/scripts/pic_ni_Colorspace18bit.lua +++ /dev/null @@ -1,18 +0,0 @@ --- 18bit colour space from palette --- - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -for y1=0,7,1 do - for x1=0,7,1 do - for y2=0,63,1 do - for x2=0,63,1 do - putpicturepixel(x1*64+x2,y1*64+y2,matchcolor((y2*255)/64, -((y1*8+x1)*255)/64,(x2*255)/64)) - end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_GlassGridFilter.lua b/share/grafx2/scripts/pic_ni_GlassGridFilter.lua index 0dbdca3b..3aa7e22e 100644 --- a/share/grafx2/scripts/pic_ni_GlassGridFilter.lua +++ b/share/grafx2/scripts/pic_ni_GlassGridFilter.lua @@ -1,19 +1,12 @@ --- Glass grid filter - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - +-- Glass grid filter - Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See w,h=getpicturesize(); -for y1=0,h-1,8 do - for x1=0,w-1,8 do - for y2=0,3,1 do - for x2=0,7,1 do - c1=getpicturepixel(x1+x2,y1+y2) - c2=getpicturepixel(x1+7-x2,y1+7-y2) - putpicturepixel(x1+x2,y1+y2,c2) - putpicturepixel(x1+7-x2,y1+7-y2,c1) - end;end;end;end +ok,xsiz,ysiz=inputbox("message","xsize",8,0,64,5,"ysize",8,0,64,6); +if ok==true then + for y1=0,h-1,xsiz do + for x1=0,w-1,ysiz do + for y2=0,(ysiz/2)-1,1 do + for x2=0,xsiz-1,1 do + c1=getpicturepixel(x1+x2,y1+y2);c2=getpicturepixel(x1+(xsiz-1)-x2,y1+(ysiz-1)-y2) + putpicturepixel(x1+x2,y1+y2,c2);putpicturepixel(x1+(xsiz-1)-x2,y1+(ysiz-1)-y2,c1) + end;end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_Grid8.lua b/share/grafx2/scripts/pic_ni_Grid8.lua deleted file mode 100644 index 29a9e925..00000000 --- a/share/grafx2/scripts/pic_ni_Grid8.lua +++ /dev/null @@ -1,18 +0,0 @@ --- Draw 8x8 grid - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -for y=0,h-1,1 do - for x=0,w-1,8 do - putpicturepixel(x,y,1); - end;end -for y=0,h-1,8 do - for x=0,w-1,1 do - putpicturepixel(x,y,1); - end;end diff --git a/share/grafx2/scripts/pic_ni_Grid8red.lua b/share/grafx2/scripts/pic_ni_Grid8red.lua deleted file mode 100644 index 70172aea..00000000 --- a/share/grafx2/scripts/pic_ni_Grid8red.lua +++ /dev/null @@ -1,19 +0,0 @@ --- Draw red 8x8 grid - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -c=matchcolor(0xFF,0x00,0x00) -for y=0,h-1,1 do - for x=0,w-1,8 do - putpicturepixel(x,y,c); - end;end -for y=0,h-1,8 do - for x=0,w-1,1 do - putpicturepixel(x,y,c); - end;end diff --git a/share/grafx2/scripts/pic_ni_GridIso.lua b/share/grafx2/scripts/pic_ni_GridIso.lua deleted file mode 100644 index 89e3ad22..00000000 --- a/share/grafx2/scripts/pic_ni_GridIso.lua +++ /dev/null @@ -1,18 +0,0 @@ --- Draw isometric grid - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -for y=0,h-1,8 do - for x=0,w-1,1 do - putpicturepixel(x,y+(x/2)%8,1); - end;end -for y=0,h-1,8 do - for x=0,w-1,1 do - putpicturepixel(x+3,y+7-((x/2)%8),1); - end;end diff --git a/share/grafx2/scripts/pic_ni_PaletteX1.lua b/share/grafx2/scripts/pic_ni_PaletteX1.lua deleted file mode 100644 index 78e97752..00000000 --- a/share/grafx2/scripts/pic_ni_PaletteX1.lua +++ /dev/null @@ -1,14 +0,0 @@ --- x1 palette to picture - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -w,h=getpicturesize(); -for y1=0,7,1 do - for x1=0,31,1 do - putpicturepixel(x1,y1,y1+x1*8) - end;end diff --git a/share/grafx2/scripts/pic_ni_PaletteX8.lua b/share/grafx2/scripts/pic_ni_PaletteX8.lua deleted file mode 100644 index 1e4c5466..00000000 --- a/share/grafx2/scripts/pic_ni_PaletteX8.lua +++ /dev/null @@ -1,16 +0,0 @@ --- x8 palette to picture - --- Copyright 2010 Paulo Silva --- --- This program is free software; you can redistribute it and/or --- modify it under the terms of the GNU General Public License --- as published by the Free Software Foundation; version 2 --- of the License. See - -setpicturesize(256,64); -for y1=0,7,1 do - for x1=0,31,1 do - for y2=0,7,1 do - for x2=0,7,1 do - putpicturepixel(x1*8+x2,y1*8+y2,y1+x1*8) - end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_cellcolourreducer.lua b/share/grafx2/scripts/pic_ni_cellcolourreducer.lua new file mode 100644 index 00000000..3f97a8c0 --- /dev/null +++ b/share/grafx2/scripts/pic_ni_cellcolourreducer.lua @@ -0,0 +1,37 @@ +-- cell colour reducer - jan'11, from Paulo Silva, with help from people from GrafX2 google group (DawnBringer, Adrien Destugues (PulkoMandy), and Yves Rizoud) +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize() +ok,xcell,ycell=inputbox("Modify cell pixel size","xcell",8,1,16,4,"ycell",8,1,16,4); +if ok==true then + function grayscaleindexed(c) + r,g,b=getcolor(c);return math.floor((b*11+r*30+g*59)/100);end + celcnt={};for n=0,255,1 do celcnt[n+1]=0;end -- Arraycounter must have initial value + for y1=0,h-1,ycell do + for x1=0,w-1,xcell do + for i=0,255,1 do + celcnt[i+1]=0;end + for y2=0,ycell-1,1 do + for x2=0,xcell-1,1 do + x=x1+x2;y=y1+y2;u=getpicturepixel(x,y) + celcnt[u+1]=celcnt[u+1]+(1000*xcell*ycell)+math.random(0,950);end;end + ikattr=0;paattr=0;ikcnt=0;pacnt=0 + for i=0,255,1 do + if ikcntgrayscaleindexed(paattr) then tmpr=ikattr;ikattr=paattr;paattr=tmpr;end + wmid=math.floor((grayscaleindexed(paattr)+grayscaleindexed(ikattr))/2) + for y2=0,ycell-1,1 do + for x2=0,xcell-1,1 do + x=x1+x2;y=y1+y2;u=getpicturepixel(x,y) + if u==ikattr then + idou=ikattr + elseif u==paattr then + idou=paattr + else + idou=ikattr + if grayscaleindexed(u)>wmid then idou=paattr;end + end + putpicturepixel(x,y,idou) + end;end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_drawgridisometric.lua b/share/grafx2/scripts/pic_ni_drawgridisometric.lua new file mode 100644 index 00000000..1dd304db --- /dev/null +++ b/share/grafx2/scripts/pic_ni_drawgridisometric.lua @@ -0,0 +1,13 @@ +-- Draw isometric grid - Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize(); +ok,gsiz,ik=inputbox("draw isometric grid","size",16,0,128,5,"colour",1,0,255,6); +if ok==true then + for y=0,h-1,gsiz do + for x=0,w-1,1 do + putpicturepixel(x,y+(x/2)%gsiz,ik); + end;end + for y=0,h-1,gsiz do + for x=0,w-1,1 do + putpicturepixel(x+((gsiz/2)-1),y+(gsiz-1)-((x/2)%gsiz),ik); + end;end;end diff --git a/share/grafx2/scripts/pic_ni_drawgridorthogonal_indexedcolour.lua b/share/grafx2/scripts/pic_ni_drawgridorthogonal_indexedcolour.lua new file mode 100644 index 00000000..7f4aafcd --- /dev/null +++ b/share/grafx2/scripts/pic_ni_drawgridorthogonal_indexedcolour.lua @@ -0,0 +1,11 @@ +-- draw grid - indexed colour - Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize(); +ok,xsiz,ysiz,c=inputbox("draw grid - indexed colour)","x size",8,1,64,5,"y size",8,1,64,6,"colour id",0,0,255,6); +if ok==true then + for y=0,h-1,1 do + for x=0,w-1,xsiz do + putpicturepixel(x,y,c);end;end + for y=0,h-1,ysiz do + for x=0,w-1,1 do + putpicturepixel(x,y,c);end;end;end diff --git a/share/grafx2/scripts/pic_ni_drawgridorthogonal_rgbmatchcolor.lua b/share/grafx2/scripts/pic_ni_drawgridorthogonal_rgbmatchcolor.lua new file mode 100644 index 00000000..729243fc --- /dev/null +++ b/share/grafx2/scripts/pic_ni_drawgridorthogonal_rgbmatchcolor.lua @@ -0,0 +1,14 @@ +-- draw grid - rgb (matchcolor) - Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize() +ok,xsiz,ysiz,r,g,b=inputbox("draw grid - rgb (matchcolor)","x size",8,1,64,5,"y size",8,1,64,6,"r",128,0,255,6,"g",128,0,255,6,"b",128,0,255,6); +if ok==true then + c=matchcolor(r,g,b) + for y=0,h-1,1 do + for x=0,w-1,xsiz do + putpicturepixel(x,y,c); + end;end + for y=0,h-1,ysiz do + for x=0,w-1,1 do + putpicturepixel(x,y,c); + end;end;end diff --git a/share/grafx2/scripts/pic_ni_flippicture.lua b/share/grafx2/scripts/pic_ni_flippicture.lua new file mode 100644 index 00000000..3c1a4d62 --- /dev/null +++ b/share/grafx2/scripts/pic_ni_flippicture.lua @@ -0,0 +1,17 @@ +-- flip picture - Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize(); +ok,flipx,flipy=inputbox("flip picture","flip x",1,0,1,-1,"flip y",0,0,1,-1); +if ok==true then + if flipx==1 then + for y=0,h-1,1 do + for x=0,w/2,1 do + c1=getpicturepixel(x,y);c2=getpicturepixel(w-x-1,y) + putpicturepixel(x,y,c2);putpicturepixel(w-x-1,y,c1) + end;end + else + for y=0,h/2,1 do + for x=0,w-1,1 do + c1=getpicturepixel(x,y);c2=getpicturepixel(x,h-y-1) + putpicturepixel(x,y,c2);putpicturepixel(x,h-y-1,c1) + end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_palettetopicture.lua b/share/grafx2/scripts/pic_ni_palettetopicture.lua new file mode 100644 index 00000000..a645fd34 --- /dev/null +++ b/share/grafx2/scripts/pic_ni_palettetopicture.lua @@ -0,0 +1,11 @@ +-- palette to picture - Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize(); +ok,xsiz,ysiz=inputbox("palette to picture","x size",8,1,16,5,"y size",8,1,16,6); +if ok==true then + for y1=0,7,1 do + for x1=0,31,1 do + for y2=0,ysiz-1,1 do + for x2=0,xsiz-1,1 do + putpicturepixel(x1*xsiz+x2,y1*ysiz+y2,y1+x1*8) + end;end;end;end;end diff --git a/share/grafx2/scripts/pic_ni_xbitcolourspacefrompalette.lua b/share/grafx2/scripts/pic_ni_xbitcolourspacefrompalette.lua new file mode 100644 index 00000000..444e62fa --- /dev/null +++ b/share/grafx2/scripts/pic_ni_xbitcolourspacefrompalette.lua @@ -0,0 +1,12 @@ +-- Copyright 2010 Paulo Silva +-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See +w,h=getpicturesize(); +ok,bitd=inputbox("colourspace from palette","bitdepth:",4,1,8,5); +if ok==true then + bitd3=(2^bitd);bitd8=(2^(math.floor(bitd/2)));bitd9=(2^((math.floor((bitd-1)/2))+1)) + for y1=0,(bitd8-1),1 do + for x1=0,(bitd9-1),1 do + for y2=0,(bitd3-1),1 do + for x2=0,(bitd3-1),1 do + putpicturepixel(x1*bitd3+x2,y1*bitd3+y2,matchcolor((y2*255)/(bitd3-1),((y1*8+x1)*255)/(bitd3-1),(x2*255)/(bitd3-1))) + end;end;end;end;end diff --git a/share/grafx2/skins/skin_Aurora.png b/share/grafx2/skins/skin_Aurora.png new file mode 100644 index 00000000..7b9177b9 Binary files /dev/null and b/share/grafx2/skins/skin_Aurora.png differ diff --git a/share/grafx2/skins/skin_Clax2.gif b/share/grafx2/skins/skin_Clax2.gif new file mode 100644 index 00000000..1e9cac8f Binary files /dev/null and b/share/grafx2/skins/skin_Clax2.gif differ diff --git a/share/grafx2/skins/skin_Clax3.gif b/share/grafx2/skins/skin_Clax3.gif new file mode 100644 index 00000000..98fe8257 Binary files /dev/null and b/share/grafx2/skins/skin_Clax3.gif differ diff --git a/share/grafx2/skins/skin_Clax4.gif b/share/grafx2/skins/skin_Clax4.gif new file mode 100644 index 00000000..abe75a31 Binary files /dev/null and b/share/grafx2/skins/skin_Clax4.gif differ diff --git a/share/grafx2/skins/skin_DPaint.png b/share/grafx2/skins/skin_DPaint.png index 8bfb99b7..2685dcb4 100644 Binary files a/share/grafx2/skins/skin_DPaint.png and b/share/grafx2/skins/skin_DPaint.png differ diff --git a/share/grafx2/skins/skin_classic.png b/share/grafx2/skins/skin_classic.png index 373e1f8b..2216df0c 100644 Binary files a/share/grafx2/skins/skin_classic.png and b/share/grafx2/skins/skin_classic.png differ diff --git a/share/grafx2/skins/skin_modern.png b/share/grafx2/skins/skin_modern.png index 212d3679..39be261d 100644 Binary files a/share/grafx2/skins/skin_modern.png and b/share/grafx2/skins/skin_modern.png differ diff --git a/share/grafx2/skins/skin_remapped.png b/share/grafx2/skins/skin_remapped.png deleted file mode 100644 index 30a40fed..00000000 Binary files a/share/grafx2/skins/skin_remapped.png and /dev/null differ diff --git a/share/grafx2/skins/skin_scenish.png b/share/grafx2/skins/skin_scenish.png index c8faa995..2fcfb587 100644 Binary files a/share/grafx2/skins/skin_scenish.png and b/share/grafx2/skins/skin_scenish.png differ diff --git a/tools/Doxyfile b/tools/Doxyfile index 55c8fdd9..4d805857 100644 --- a/tools/Doxyfile +++ b/tools/Doxyfile @@ -778,11 +778,7 @@ HTML_FILE_EXTENSION = .html HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = ../tools/footer.html +HTML_TIMESTAMP = NO # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to diff --git a/tools/footer.html b/tools/footer.html deleted file mode 100644 index 3d0275c8..00000000 --- a/tools/footer.html +++ /dev/null @@ -1,4 +0,0 @@ -
-Generated for $projectname by doxygen
- - diff --git a/tools/gifanalyzer/gifanalyzer.c b/tools/gifanalyzer/gifanalyzer.c new file mode 100644 index 00000000..60153251 --- /dev/null +++ b/tools/gifanalyzer/gifanalyzer.c @@ -0,0 +1,97 @@ +/* vim:expandtab:ts=2 sw=2: +*/ +/* Grafx2 - The Ultimate 256-color bitmap paint program + * Gif Analyzer tool + + Copyright 2010 Adrien Destugues + + Grafx2 is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 + of the License. + + Grafx2 is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Grafx2; if not, see +*/ + +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + FILE* theFile; + + if(argc != 2) + { + printf("%s file.gif\n",argv[0]); + exit(-1); + } + + theFile = fopen(argv[1], "r"); + + uint8_t buffer[256]; + + fread(buffer, 1, 6, theFile); + buffer[6] = 0; + + printf("Signature: %6s\n", buffer); + + uint16_t w,h; + + fread(&w,2,1,theFile); + fread(&h,2,1,theFile); + + printf("Resolution: %dx%d\n",w,h); + + fread(buffer,1,3,theFile); + + int colors = ((buffer[0]&0b01110000)>>4)+1; + colors = pow(2,colors); + + int bpp = (buffer[0]&0xF) +1; + + printf("Color palette: %#02.2x\n",buffer[0]&0xFF); + if (buffer[0] & 0b10000000) + printf("\tGlobal palette\n"); + printf("\tColor count: %d\n", colors); + printf("\tBits per pixel: %d\n",bpp); + + printf("Index of background color: %d\n",buffer[1]); + printf("(reserved byte: %d)\n",buffer[2]); + + printf("Color palette:\n"); + for (int i = 0; i < pow(2,bpp); i++) + { + fread(buffer,1,3,theFile); + printf("\t%d: %u %u %u\t",i,buffer[0], buffer[1], buffer[2]); + if ((i+1)%4 ==0)puts(""); + } + + int i = 0; + do { + fread(buffer,1,1,theFile); + i++; + } while (i != ','); + + if (i > 1); + printf("Skipped %d meaningless bytes before image descriptor\n",i); + + uint16_t x,y; + + fread(&x,2,1,theFile); + fread(&y,2,1,theFile); + fread(&w,2,1,theFile); + fread(&h,2,1,theFile); + + printf("Image descriptor\n"); + printf("\tx=%d y=%d w=%d h=%d\n",x,y,w,h); + + fclose(theFile); +}