vdu.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Fred Klaus                                      *
00003  *   frednet@web.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef VDU_H
00021 #define VDU_H
00022 
00023 
00024 #ifdef USE_MMX
00025         #include "mmx_memcpy.h"
00026 #else
00027         #include <memory>
00028 #endif
00029 
00030 #include "types.h"
00031 
00032 class GateArray;
00033 class Crtc;
00034 class Z80;
00035 
00037 class Vdu
00038 {
00039 
00040 public:
00041         enum Bpp {Bpp16=0, Bpp24=1, Bpp32=2};
00042 
00043         Vdu(Crtc* crtc=0, GateArray* gatearray=0, Z80* z80=0);
00044         ~Vdu() {}
00045 
00047         typedef void (Vdu::*ModeHandler)();
00049         typedef void (Vdu::*BorderHandler)();
00050 
00051         void init(bool full=false, Crtc* crtc=0, GateArray* gatearray=0, Z80* z80=0);
00052 
00053         void access_video_memory(int repeat_count);
00054 
00055         void draw16bpp_border();     
00056         void draw16bpp_nullborder(); 
00057         void draw16bpp_mode0();      
00058         void draw16bpp_mode1();      
00059         void draw16bpp_mode2();      
00060 
00061         void draw24bpp_border();     
00062         void draw24bpp_nullborder(); 
00063         void draw24bpp_mode0();      
00064         void draw24bpp_mode1();      
00065         void draw24bpp_mode2();      
00066 
00067         void draw32bpp_border();     
00068         void draw32bpp_nullborder(); 
00069         void draw32bpp_mode0();      
00070         void draw32bpp_mode1();      
00071         void draw32bpp_mode2();      
00072         
00073 
00074         uint hsw()            {return mHsw;}
00075         uint hswActive()      {return mHswActive;}
00076         uint hswCount()       {return mHswCount;}
00077         uint vswCount()       {return mVswCount;}
00078         uint hDelay()         {return mHDelay;}
00079         uint vDelay()         {return mVDelay;}
00080         uint scanline()       {return mScanline;}
00081         uint scanlineMin()    {return mScanlineMin;}
00082         bool frameCompleted() {return mFrameCompleted;}
00083         uint charCount()      {return mCharCount;}
00084         uint hCount()         {return mHCount;}
00085         uint hStart()         {return mHStart;}
00086         uint hWidth()         {return mHWidth;}
00087         uint vCount()         {return mVCount;}
00088         uint vStart()         {return mVStart;}
00089         uint vHeight()        {return mVHeight;}
00090         
00091         void setBpp        (Bpp bpp);
00092         void setBorder     (bool border     = true);
00093         void setDoublescan (bool doublescan = true);
00094 
00095         void setHsw            (uint value) {mHsw            = value;}
00096         void setHswActive      (uint value) {mHswActive      = value;}
00097         void setHswCount       (uint value) {mHswCount       = value;}
00098         void setVswCount       (uint value) {mVswCount       = value;}
00099         void setHDelay         (uint value) {mHDelay         = value;}
00100         void setVDelay         (uint value) {mVDelay         = value;}
00101         void setScanline       (uint value) {mScanline       = value;}
00102         void setScanlineMin    (uint value) {mScanlineMin    = value;}
00103         void setFrameCompleted (bool value) {mFrameCompleted = value;}
00104         void setCharCount      (uint value) {mCharCount      = value;}
00105         void setHCount         (uint value) {mHCount         = value;}
00106         void setHStart         (uint value) {mHStart         = value;}
00107         void setHWidth         (uint value) {mHWidth         = value;}
00108         void setVCount         (uint value) {mVCount         = value;}
00109         void setVStart         (uint value) {mVStart         = value;}
00110         void setVHeight        (uint value) {mVHeight        = value;}
00111 
00112         void setScrBase      (uint*  value) {mScrBase       = value;}
00113         void setScrEnd       (uint*  value) {mScrEnd        = value;}
00114         void setScrLineOffset(uint   value) {mScrLineOffset = value;}
00115         void setScrOffset    (uint   value) {mScrOffset     = value;}
00116         void setScrLine      (uint   value) {mScrLine       = value;}
00117         void setCpcRamBase   (UBYTE* value) {mCpcRamBase    = value;}
00118         
00119         inline void doublescan();
00120 
00121 private:
00122         Crtc*      mCrtc;
00123         GateArray* mGateArray;
00124         Z80*       mZ80;
00125 
00126         Bpp mBpp;
00127 
00128         REGPAIR addr;
00129 
00130         bool mFrameCompleted;
00131         bool mBorder;
00132         bool mDoublescan;
00133 
00134         uint mHsw;
00135         uint mHswActive;
00136         uint mHswCount;
00137         uint mVswCount;
00138         uint mHDelay;
00139         uint mVDelay;
00140         uint mScanline;
00141         uint mScanlineMin;
00142         uint mCharCount;
00143         uint mHCount;
00144         uint mHStart;
00145         uint mHWidth;
00146         uint mVCount;
00147         uint mVStart;
00148         uint mVHeight;
00149 
00150         /*
00151         uint  mScrFsWidth;
00152         uint  mScrFsHeight;
00153         uint  mScrFs_bpp;
00154         uint  mScrStyle;
00155         uint  mScrVSync;
00156         uint  mScrLed;
00157         uint  mScrFps;
00158         uint  mScrTube;
00159         uint  mScrWindow;
00160         uint  mScrBps;
00161         */
00162 
00163         uint* mScrBase;
00164         uint* mScrEnd;
00165         uint  mScrWidth;
00166         uint  mScrHeight;
00167         uint  mScrBpp;
00168         uint  mScrLineOffset;
00169         uint  mScrOffset;
00170         uint  mScrLine;
00171 
00172         UBYTE* mCpcRamBase;
00173 
00174         UBYTE mode0_table[512];
00175         UBYTE mode1_table[1024];
00176 
00177         ModeHandler   mModeHandler[3][4];     // [bpp][mode]
00178         BorderHandler mBorderHandler[4];      // [mode]
00179         BorderHandler mNullBorderHandler[4];  // [mode]
00180 
00181         ModeHandler   mCurModeHandler;
00182         BorderHandler mCurBorderHandler;
00183 
00184 };
00185 
00186 #endif

Generated on Fri Mar 16 21:30:28 2007 for roland.kdevelop by  doxygen 1.5.0