vga.h

Go to the documentation of this file.
00001 /* ES40 emulator.
00002  * Copyright (C) 2007-2008 by the ES40 Emulator Project
00003  *
00004  * WWW    : http://sourceforge.net/projects/es40
00005  * E-mail : camiel@camicom.com
00006  * 
00007  *  This file is based upon Bochs.
00008  *
00009  *  Copyright (C) 2002  MandrakeSoft S.A.
00010  *
00011  *    MandrakeSoft S.A.
00012  *    43, rue d'Aboukir
00013  *    75002 Paris - France
00014  *    http://www.linux-mandrake.com/
00015  *    http://www.mandrakesoft.com/
00016  *
00017  *  This library is free software; you can redistribute it and/or
00018  *  modify it under the terms of the GNU Lesser General Public
00019  *  License as published by the Free Software Foundation; either
00020  *  version 2 of the License, or (at your option) any later version.
00021  *
00022  *  This library is distributed in the hope that it will be useful,
00023  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025  *  Lesser General Public License for more details.
00026  *
00027  *  You should have received a copy of the GNU Lesser General Public
00028  *  License along with this library; if not, write to the Free Software
00029  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00030  */
00031 
00050 #ifndef BX_IODEV_VGA_H
00051 #define BX_IODEV_VGA_H
00052 
00053 // Make colour
00054 #define MAKE_COLOUR                                                              \
00055     (                                                                            \
00056       red, red_shiftfrom, red_shiftto, red_mask, green, green_shiftfrom,         \
00057         green_shiftto, green_mask, blue, blue_shiftfrom, blue_shiftto, blue_mask \
00058     )                                                                            \
00059       (                                                                          \
00060         (                                                                        \
00061           (                                                                      \
00062             ((red_shiftto) > (red_shiftfrom)) ? (red) <<                         \
00063               ((red_shiftto) - (red_shiftfrom)) : (red) >>                       \
00064                 ((red_shiftfrom) - (red_shiftto))                                \
00065           ) & (red_mask)                                                         \
00066         ) |                                                                      \
00067           (                                                                      \
00068             (                                                                    \
00069               ((green_shiftto) > (green_shiftfrom)) ? (green) <<                 \
00070                 ((green_shiftto) - (green_shiftfrom)) : (green) >>               \
00071                   ((green_shiftfrom) - (green_shiftto))                          \
00072             ) & (green_mask)                                                     \
00073           ) |                                                                    \
00074             (                                                                    \
00075               (                                                                  \
00076                 ((blue_shiftto) > (blue_shiftfrom)) ? (blue) <<                  \
00077                   ((blue_shiftto) - (blue_shiftfrom)) : (blue) >>                \
00078                     ((blue_shiftfrom) - (blue_shiftto))                          \
00079               ) & (blue_mask)                                                    \
00080             )                                                                    \
00081       )
00082 #if BX_SUPPORT_VBE
00083 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB     8
00084 #define VBE_DISPI_4BPP_PLANE_SHIFT          21
00085 
00086 #define VBE_DISPI_BANK_ADDRESS              0xA0000
00087 #define VBE_DISPI_BANK_SIZE_KB              64
00088 
00089 #define VBE_DISPI_MAX_XRES                  1600
00090 #define VBE_DISPI_MAX_YRES                  1200
00091 #define VBE_DISPI_MAX_BPP                   32
00092 
00093 #define VBE_DISPI_IOPORT_INDEX              0x01CE
00094 #define VBE_DISPI_IOPORT_DATA               0x01CF
00095 
00096 #define VBE_DISPI_IOPORT_INDEX_OLD          0xFF80
00097 #define VBE_DISPI_IOPORT_DATA_OLD           0xFF81
00098 
00099 #define VBE_DISPI_INDEX_ID                  0x0
00100 #define VBE_DISPI_INDEX_XRES                0x1
00101 #define VBE_DISPI_INDEX_YRES                0x2
00102 #define VBE_DISPI_INDEX_BPP                 0x3
00103 #define VBE_DISPI_INDEX_ENABLE              0x4
00104 #define VBE_DISPI_INDEX_BANK                0x5
00105 #define VBE_DISPI_INDEX_VIRT_WIDTH          0x6
00106 #define VBE_DISPI_INDEX_VIRT_HEIGHT         0x7
00107 #define VBE_DISPI_INDEX_X_OFFSET            0x8
00108 #define VBE_DISPI_INDEX_Y_OFFSET            0x9
00109 
00110 #define VBE_DISPI_ID0                       0xB0C0
00111 #define VBE_DISPI_ID1                       0xB0C1
00112 #define VBE_DISPI_ID2                       0xB0C2
00113 #define VBE_DISPI_ID3                       0xB0C3
00114 #define VBE_DISPI_ID4                       0xB0C4
00115 
00116 #define VBE_DISPI_BPP_4                     0x04
00117 #define VBE_DISPI_BPP_8                     0x08
00118 #define VBE_DISPI_BPP_15                    0x0F
00119 #define VBE_DISPI_BPP_16                    0x10
00120 #define VBE_DISPI_BPP_24                    0x18
00121 #define VBE_DISPI_BPP_32                    0x20
00122 
00123 #define VBE_DISPI_DISABLED                  0x00
00124 #define VBE_DISPI_ENABLED                   0x01
00125 #define VBE_DISPI_GETCAPS                   0x02
00126 #define VBE_DISPI_8BIT_DAC                  0x20
00127 #define VBE_DISPI_LFB_ENABLED               0x40
00128 #define VBE_DISPI_NOCLEARMEM                0x80
00129 
00130 #define VBE_DISPI_LFB_PHYSICAL_ADDRESS      0xE0000000
00131 
00132 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB     (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
00133 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES  (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
00134 #define BX_MAX_XRES                         VBE_DISPI_MAX_XRES
00135 #define BX_MAX_YRES                         VBE_DISPI_MAX_YRES
00136 
00137 #elif BX_SUPPORT_CLGD54XX
00138 #define BX_MAX_XRES 1280
00139 #define BX_MAX_YRES 1024
00140 
00141 #else
00142 #define BX_MAX_XRES 800
00143 #define BX_MAX_YRES 600
00144 #endif //BX_SUPPORT_VBE
00145 #define X_TILESIZE      16
00146 #define Y_TILESIZE      24
00147 #define BX_NUM_X_TILES  (BX_MAX_XRES / X_TILESIZE)
00148 #define BX_NUM_Y_TILES  (BX_MAX_YRES / Y_TILESIZE)
00149 
00150 // Support varying number of rows of text.  This used to
00151 // be limited to only 25 lines.
00152 #define BX_MAX_TEXT_LINES 100
00153 
00154 //  struct {
00155 //    u16  vbe_cur_dispi;
00156 //    u16  vbe_xres;
00157 //    u16  vbe_yres;
00158 //    u16  vbe_bpp;
00159 //    u16  vbe_max_xres;
00160 //    u16  vbe_max_yres;
00161 //    u16  vbe_max_bpp;
00162 //    u16  vbe_bank;
00163 //    bool vbe_enabled;
00164 //    u16  vbe_curindex;
00165 //    u32  vbe_visible_screen_size; /**< in bytes */
00166 //    u16  vbe_offset_x;                 /**< Virtual screen x start (in pixels) */
00167 //    u16  vbe_offset_y;                 /**< Virtual screen y start (in pixels) */
00168 //    u16  vbe_virtual_xres;
00169 //    u16  vbe_virtual_yres;
00170 //    u32  vbe_virtual_start;   /**< For dealing with bpp>8, this is where the virtual screen starts. */
00171 //    u8   vbe_bpp_multiplier;  /**< We have to save this b/c sometimes we need to recalculate stuff with it. */
00172 //    bool vbe_lfb_enabled;
00173 //    bool vbe_get_capabilities;
00174 //    bool vbe_8bit_dac;
00175 //  } s;  // state information
00176 #endif

SourceForge.net Logo
Project space on SourceForge.net