dosbox-wii/src/ints/int10.h

215 lines
7.2 KiB
C
Raw Normal View History

2009-05-02 23:03:37 +02:00
/*
2009-05-03 00:28:34 +02:00
* Copyright (C) 2002-2007 The DOSBox Team
2009-05-02 23:03:37 +02:00
*
* 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; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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
2009-05-03 00:02:15 +02:00
* GNU General Public License for more details.
2009-05-02 23:03:37 +02:00
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
2009-05-02 23:53:27 +02:00
#include "vga.h"
2009-05-02 23:43:00 +02:00
#define S3_LFB_BASE 0xC0000000
#define BIOSMEM_SEG 0x40
2009-05-02 23:03:37 +02:00
#define BIOSMEM_INITIAL_MODE 0x10
#define BIOSMEM_CURRENT_MODE 0x49
#define BIOSMEM_NB_COLS 0x4A
#define BIOSMEM_PAGE_SIZE 0x4C
#define BIOSMEM_CURRENT_START 0x4E
#define BIOSMEM_CURSOR_POS 0x50
#define BIOSMEM_CURSOR_TYPE 0x60
#define BIOSMEM_CURRENT_PAGE 0x62
#define BIOSMEM_CRTC_ADDRESS 0x63
#define BIOSMEM_CURRENT_MSR 0x65
#define BIOSMEM_CURRENT_PAL 0x66
#define BIOSMEM_NB_ROWS 0x84
#define BIOSMEM_CHAR_HEIGHT 0x85
#define BIOSMEM_VIDEO_CTL 0x87
#define BIOSMEM_SWITCHES 0x88
#define BIOSMEM_MODESET_CTL 0x89
#define BIOSMEM_DCC_INDEX 0x8A
2009-05-03 00:02:15 +02:00
#define BIOSMEM_CRTCPU_PAGE 0x8A
2009-05-02 23:03:37 +02:00
#define BIOSMEM_VS_POINTER 0xA8
/*
*
* VGA registers
*
*/
#define VGAREG_ACTL_ADDRESS 0x3c0
#define VGAREG_ACTL_WRITE_DATA 0x3c0
#define VGAREG_ACTL_READ_DATA 0x3c1
#define VGAREG_INPUT_STATUS 0x3c2
#define VGAREG_WRITE_MISC_OUTPUT 0x3c2
#define VGAREG_VIDEO_ENABLE 0x3c3
#define VGAREG_SEQU_ADDRESS 0x3c4
#define VGAREG_SEQU_DATA 0x3c5
#define VGAREG_PEL_MASK 0x3c6
#define VGAREG_DAC_STATE 0x3c7
#define VGAREG_DAC_READ_ADDRESS 0x3c7
#define VGAREG_DAC_WRITE_ADDRESS 0x3c8
#define VGAREG_DAC_DATA 0x3c9
#define VGAREG_READ_FEATURE_CTL 0x3ca
#define VGAREG_READ_MISC_OUTPUT 0x3cc
#define VGAREG_GRDC_ADDRESS 0x3ce
#define VGAREG_GRDC_DATA 0x3cf
#define VGAREG_MDA_CRTC_ADDRESS 0x3b4
#define VGAREG_MDA_CRTC_DATA 0x3b5
#define VGAREG_VGA_CRTC_ADDRESS 0x3d4
#define VGAREG_VGA_CRTC_DATA 0x3d5
#define VGAREG_MDA_WRITE_FEATURE_CTL 0x3ba
#define VGAREG_VGA_WRITE_FEATURE_CTL 0x3da
#define VGAREG_ACTL_RESET 0x3da
2009-05-03 00:18:08 +02:00
#define VGAREG_TDY_RESET 0x3da
#define VGAREG_TDY_ADDRESS 0x3da
#define VGAREG_TDY_DATA 0x3de
#define VGAREG_PCJR_DATA 0x3da
2009-05-02 23:03:37 +02:00
#define VGAREG_MDA_MODECTL 0x3b8
#define VGAREG_CGA_MODECTL 0x3d8
#define VGAREG_CGA_PALETTE 0x3d9
/* Video memory */
#define VGAMEM_GRAPH 0xA000
#define VGAMEM_CTEXT 0xB800
#define VGAMEM_MTEXT 0xB000
2009-05-02 23:43:00 +02:00
#define BIOS_NCOLS Bit16u ncols=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS);
#define BIOS_NROWS Bit16u nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS)+1;
2009-05-02 23:03:37 +02:00
extern Bit8u int10_font_08[256 * 8];
extern Bit8u int10_font_14[256 * 14];
extern Bit8u int10_font_16[256 * 16];
2009-05-02 23:43:00 +02:00
struct VideoModeBlock {
Bitu mode;
VGAModes type;
Bitu swidth, sheight;
Bitu twidth, theight;
Bitu cwidth, cheight;
Bitu ptotal,pstart,plength;
Bitu htotal,vtotal;
Bitu hdispend,vdispend;
Bitu special;
};
2009-05-03 00:02:15 +02:00
extern VideoModeBlock ModeList_VGA[];
2009-05-02 23:43:00 +02:00
extern VideoModeBlock * CurMode;
2009-05-02 23:03:37 +02:00
typedef struct {
2009-05-02 23:43:00 +02:00
struct {
RealPt font_8_first;
RealPt font_8_second;
RealPt font_14;
RealPt font_16;
RealPt static_state;
RealPt oemstring;
RealPt vesa_modes;
RealPt pmode_interface;
Bit16u pmode_interface_size;
2009-05-03 00:18:08 +02:00
Bit16u pmode_interface_start;
Bit16u pmode_interface_window;
Bit16u pmode_interface_palette;
2009-05-02 23:43:00 +02:00
Bitu used;
} rom;
} Int10Data;
2009-05-02 23:03:37 +02:00
2009-05-02 23:43:00 +02:00
extern Int10Data int10;
2009-05-02 23:03:37 +02:00
2009-05-02 23:43:00 +02:00
INLINE Bit8u CURSOR_POS_COL(Bit8u page) {
2009-05-02 23:03:37 +02:00
return real_readb(BIOSMEM_SEG,BIOSMEM_CURSOR_POS+page*2);
}
2009-05-02 23:43:00 +02:00
INLINE Bit8u CURSOR_POS_ROW(Bit8u page) {
2009-05-02 23:03:37 +02:00
return real_readb(BIOSMEM_SEG,BIOSMEM_CURSOR_POS+page*2+1);
}
2009-05-02 23:43:00 +02:00
bool INT10_SetVideoMode(Bitu mode);
2009-05-02 23:03:37 +02:00
2009-05-02 23:12:18 +02:00
void INT10_ScrollWindow(Bit8u rul,Bit8u cul,Bit8u rlr,Bit8u clr,Bit8s nlines,Bit8u attr,Bit8u page);
2009-05-02 23:03:37 +02:00
void INT10_SetActivePage(Bit8u page);
2009-05-02 23:12:18 +02:00
void INT10_GetFuncStateInformation(PhysPt save);
2009-05-02 23:03:37 +02:00
2009-05-02 23:43:00 +02:00
void INT10_SetCursorShape(Bit8u first,Bit8u last);
2009-05-02 23:03:37 +02:00
void INT10_SetCursorPos(Bit8u row,Bit8u col,Bit8u page);
2009-05-02 23:53:27 +02:00
void INT10_TeletypeOutput(Bit8u chr,Bit8u attr);
void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr);
2009-05-02 23:03:37 +02:00
void INT10_ReadCharAttr(Bit16u * result,Bit8u page);
void INT10_WriteChar(Bit8u chr,Bit8u attr,Bit8u page,Bit16u count,bool showattr);
2009-05-02 23:12:18 +02:00
void INT10_WriteString(Bit8u row,Bit8u col,Bit8u flag,Bit8u attr,PhysPt string,Bit16u count,Bit8u page);
2009-05-02 23:03:37 +02:00
/* Graphics Stuff */
void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color);
void INT10_GetPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u * color);
2009-05-02 23:43:00 +02:00
/* Font Stuff */
void INT10_LoadFont(PhysPt font,bool reload,Bitu count,Bitu offset,Bitu map,Bitu height);
2009-05-02 23:03:37 +02:00
/* Palette Group */
2009-05-02 23:43:00 +02:00
void INT10_SetBackgroundBorder(Bit8u val);
void INT10_SetColorSelect(Bit8u val);
2009-05-02 23:03:37 +02:00
void INT10_SetSinglePaletteRegister(Bit8u reg,Bit8u val);
void INT10_SetOverscanBorderColor(Bit8u val);
2009-05-02 23:12:18 +02:00
void INT10_SetAllPaletteRegisters(PhysPt data);
2009-05-02 23:03:37 +02:00
void INT10_ToggleBlinkingBit(Bit8u state);
void INT10_GetSinglePaletteRegister(Bit8u reg,Bit8u * val);
void INT10_GetOverscanBorderColor(Bit8u * val);
2009-05-02 23:12:18 +02:00
void INT10_GetAllPaletteRegisters(PhysPt data);
2009-05-02 23:03:37 +02:00
void INT10_SetSingleDacRegister(Bit8u index,Bit8u red,Bit8u green,Bit8u blue);
void INT10_GetSingleDacRegister(Bit8u index,Bit8u * red,Bit8u * green,Bit8u * blue);
2009-05-02 23:12:18 +02:00
void INT10_SetDACBlock(Bit16u index,Bit16u count,PhysPt data);
void INT10_GetDACBlock(Bit16u index,Bit16u count,PhysPt data);
2009-05-02 23:43:00 +02:00
void INT10_SelectDACPage(Bit8u function,Bit8u mode);
2009-05-03 00:18:08 +02:00
void INT10_GetDACPage(Bit8u* mode,Bit8u* page);
2009-05-02 23:43:00 +02:00
void INT10_SetPelMask(Bit8u mask);
void INT10_GetPelMask(Bit8u & mask);
2009-05-03 00:18:08 +02:00
void INT10_PerformGrayScaleSumming(Bit16u start_reg,Bit16u count);
2009-05-02 23:43:00 +02:00
2009-05-02 23:03:37 +02:00
2009-05-02 23:43:00 +02:00
/* Vesa Group */
Bit8u VESA_GetSVGAInformation(Bit16u seg,Bit16u off);
Bit8u VESA_GetSVGAModeInformation(Bit16u mode,Bit16u seg,Bit16u off);
Bit8u VESA_SetSVGAMode(Bit16u mode);
Bit8u VESA_GetSVGAMode(Bit16u & mode);
2009-05-02 23:53:27 +02:00
Bit8u VESA_SetCPUWindow(Bit8u window,Bit8u address);
2009-05-02 23:43:00 +02:00
Bit8u VESA_GetCPUWindow(Bit8u window,Bit16u & address);
2009-05-03 00:18:08 +02:00
Bit8u VESA_ScanLineLength(Bit8u subcall, Bit16u val, Bit16u & bytes,Bit16u & pixels,Bit16u & lines);
2009-05-02 23:43:00 +02:00
Bit8u VESA_SetDisplayStart(Bit16u x,Bit16u y);
Bit8u VESA_GetDisplayStart(Bit16u & x,Bit16u & y);
Bit8u VESA_SetPalette(PhysPt data,Bitu index,Bitu count);
Bit8u VESA_GetPalette(PhysPt data,Bitu index,Bitu count);
2009-05-02 23:03:37 +02:00
/* Sup Groups */
void INT10_SetupRomMemory(void);
2009-05-03 00:18:08 +02:00
void INT10_SetupRomMemoryChecksum(void);
2009-05-02 23:43:00 +02:00
void INT10_SetupVESA(void);
2009-05-02 23:03:37 +02:00
2009-05-03 00:18:08 +02:00
/* EGA RIL */
RealPt INT10_EGA_RIL_GetVersionPt(void);
void INT10_EGA_RIL_ReadRegister(Bit8u & bl, Bit16u dx);
void INT10_EGA_RIL_WriteRegister(Bit8u & bl, Bit8u bh, Bit16u dx);
void INT10_EGA_RIL_ReadRegisterRange(Bit8u & bl, Bit8u ch, Bit8u cl, Bit16u dx, PhysPt dst);
void INT10_EGA_RIL_WriteRegisterRange(Bit8u & bl, Bit8u ch, Bit8u cl, Bit16u dx, PhysPt dst);
void INT10_EGA_RIL_ReadRegisterSet(Bit16u cx, PhysPt tbl);
void INT10_EGA_RIL_WriteRegisterSet(Bit16u cx, PhysPt tbl);