1
0
Fork 0

Fixes to hercules emulation, better detection and bank switching

Fixes to tandy emulation, 640x200x16 mode and different sizes bank.
EGA/VGA memory changes detection for faster rendering added
Renderer does initial pass to check for needing to lock buffer


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2781
This commit is contained in:
Sjoerd van der Berg 2007-01-24 16:29:09 +00:00
parent 667c756775
commit 5660ee1856
16 changed files with 1132 additions and 565 deletions

View file

@ -21,6 +21,10 @@
#include "../src/gui/render_scalers.h"
#define RENDER_SKIP_CACHE 16
//Enable this for scalers to support 0 input for empty lines
//#define RENDER_NULL_INPUT
typedef struct {
struct {
Bit8u red;
@ -40,7 +44,7 @@ typedef struct {
typedef struct {
struct {
Bitu width;
Bitu width, start;
Bitu height;
Bitu bpp;
bool dblw,dblh;
@ -50,6 +54,8 @@ typedef struct {
struct {
Bitu count;
Bitu max;
Bitu index;
Bit8u hadSkip[RENDER_SKIP_CACHE];
} frameskip;
struct {
Bitu size;
@ -71,13 +77,14 @@ typedef struct {
bool updating;
bool active;
bool aspect;
bool fullFrame;
} Render_t;
extern Render_t render;
extern ScalerLineHandler_t RENDER_DrawLine;
void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh);
bool RENDER_StartUpdate(void);
void RENDER_EndUpdate( bool fullUpdate );
void RENDER_EndUpdate( );
void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue);

View file

@ -23,8 +23,18 @@
#include "dosbox.h"
#endif
//Don't enable keeping changes and mapping lfb probably...
#define VGA_LFB_MAPPED
//#define VGA_KEEP_CHANGES
#define VGA_MEMORY (2*1024*1024)
#define VGA_CHANGE_SHIFT 9
//Offset inside VGA_MEMORY that will be used for certain types of caching
#define VGA_CACHE_OFFSET (512*1024)
class PageHandler;
enum VGAModes {
M_CGA2, M_CGA4,
M_EGA, M_VGA,
@ -70,6 +80,7 @@ typedef struct {
Bit8u pel_panning; /* Amount of pixels to skip when starting horizontal line */
Bit8u hlines_skip;
Bit8u bytes_skip;
Bit8u addr_shift;
/* Specific stuff memory write/read handling */
@ -97,6 +108,10 @@ typedef struct {
Bitu blocks;
Bitu panning;
Bitu address;
Bit8u *linear_base;
Bitu linear_mask;
Bitu address_mask;
Bitu address_last;
Bitu address_add;
Bitu address_line_total;
Bitu address_line;
@ -108,13 +123,14 @@ typedef struct {
Bitu parts_lines;
Bitu parts_left;
struct {
float vtotal;
float vstart;
float vend;
float htotal;
float hstart;
float hend;
float parts;
double framestart;
double vrstart, vrend; // V-retrace
double hrstart, hrend; // H-retrace
double hblkstart, hblkend; // H-blanking
double vblkstart, vblkend; // V-Blanking
double vdend, vtotal;
double hdend, htotal;
double parts;
} delay;
bool double_scan;
bool doublewidth,doubleheight;
@ -194,31 +210,36 @@ typedef struct {
Bit8u htotal;
Bit8u hdend;
Bit8u hsyncp;
Bit8u hsyncw;
Bit8u syncw;
Bit8u vtotal;
Bit8u vdend;
Bit8u vadjust;
Bit8u vsyncp;
Bit8u vsyncw;
Bit8u max_scanline;
Bit8u lpen_low, lpen_high;
Bit8u cursor_start;
Bit8u cursor_end;
} VGA_OTHER;
typedef struct {
Bit8u pcjr_flipflop;
Bit8u mode_control;
Bit8u color_select;
Bit8u mem_bank;
Bit8u disp_bank;
Bit8u reg_index;
Bit8u gfx_control;
Bit8u palette_mask;
Bit8u extended_ram;
Bit8u border_color;
bool is_32k_mode;
bool pcjr_flipflop;
Bit8u line_mask, line_shift;
Bit8u draw_bank, mem_bank;
Bit8u *draw_base, *mem_base;
Bitu addr_mask;
} VGA_TANDY;
typedef struct {
Bit8u index;
Bit8u reset;
Bit8u clocking_mode;
Bit8u map_mask;
@ -281,11 +302,11 @@ typedef struct {
Bit8u bit_mask;
} VGA_Gfx;
struct RGBEntry {
typedef struct {
Bit8u red;
Bit8u green;
Bit8u blue;
};
} RGBEntry;
typedef struct {
Bit8u bits; /* DAC bits, usually 6 or 8 */
@ -298,16 +319,30 @@ typedef struct {
RGBEntry rgb[0x100];
} VGA_Dac;
union VGA_Latch {
typedef struct {
Bitu readStart, writeStart;
Bitu bankMask;
} VGA_SVGA;
typedef union {
Bit32u d;
Bit8u b[4];
};
} VGA_Latch;
union VGA_Memory {
Bit8u linear[512*1024*4];
Bit8u paged[512*1024][4];
VGA_Latch latched[512*1024];
};
typedef struct {
Bit8u linear[VGA_MEMORY];
} VGA_Memory;
typedef struct {
//Add a few more just to be safe
Bit8u map[(VGA_MEMORY >> VGA_CHANGE_SHIFT) + 32];
Bit8u checkMask, frame, writeMask;
bool active;
Bit32u lineWidth;
Bit32u clearMask;
Bit32u start, last;
Bit32u lastAddress;
} VGA_Changes;
typedef struct {
Bit32u page;
@ -316,8 +351,6 @@ typedef struct {
PageHandler *handler;
} VGA_LFB;
#define VGA_CHANGE_SHIFT 9
typedef Bit8u VGA_Changed[(2*1024*1024) >> VGA_CHANGE_SHIFT];
typedef struct {
VGAModes mode; /* The mode the vga system is in */
VGAModes lastmode;
@ -333,13 +366,15 @@ typedef struct {
VGA_Dac dac;
VGA_Latch latch;
VGA_S3 s3;
VGA_SVGA svga;
VGA_HERC herc;
VGA_TANDY tandy;
VGA_OTHER other;
VGA_Memory mem;
#ifdef VGA_KEEP_CHANGES
VGA_Changes changes;
#endif
VGA_LFB lfb;
VGA_Changed changed;
Bit8u * gfxmem_start;
} VGA_Type;
@ -351,6 +386,7 @@ void VGA_SetupHandlers(void);
void VGA_StartResize(void);
void VGA_SetupDrawing(Bitu val);
void VGA_CheckScanLength(void);
void VGA_ChangedBank(void);
/* Some DAC/Attribute functions */
void VGA_DAC_CombineColor(Bit8u attr,Bit8u pal);