From 59910aafbc56d8cc30d2c547ff1c141529a6b662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Mon, 3 Oct 2005 19:22:13 +0000 Subject: [PATCH] add some EGA RIL functions, show mouse on requestet page (1994Pool); don't use current page for bios string output (Gobble Man) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2335 --- src/ints/int10.cpp | 23 +++++++- src/ints/int10.h | 8 ++- src/ints/int10_char.cpp | 14 +++-- src/ints/int10_misc.cpp | 120 ++++++++++++++++++++++++++++++++++++++-- src/ints/mouse.cpp | 8 +-- 5 files changed, 156 insertions(+), 17 deletions(-) diff --git a/src/ints/int10.cpp b/src/ints/int10.cpp index 46bd874b..90ff9fc8 100644 --- a/src/ints/int10.cpp +++ b/src/ints/int10.cpp @@ -437,8 +437,29 @@ graphics_chars: reg_al=0x0; } break; + case 0xf0: + INT10_EGA_RIL_ReadRegister(reg_bl, reg_dx); + break; case 0xf1: - INT10_EGA_RIL_F1(reg_bl, reg_bh, reg_dx); + INT10_EGA_RIL_WriteRegister(reg_bl, reg_bh, reg_dx); + break; + case 0xf2: + INT10_EGA_RIL_ReadRegisterRange(reg_bl, reg_ch, reg_cl, reg_dx, SegPhys(es)+reg_bx); + break; + case 0xf3: + INT10_EGA_RIL_WriteRegisterRange(reg_bl, reg_ch, reg_cl, reg_dx, SegPhys(es)+reg_bx); + break; + case 0xf4: + INT10_EGA_RIL_ReadRegisterSet(reg_cx, SegPhys(es)+reg_bx); + break; + case 0xf5: + INT10_EGA_RIL_WriteRegisterSet(reg_cx, SegPhys(es)+reg_bx); + break; + case 0xfa: { + RealPt pt=INT10_EGA_RIL_GetVersionPt(); + SegSet16(es,RealSeg(pt)); + reg_bx=RealOff(pt); + } break; case 0xff: if (!warned_ff) LOG(LOG_INT10,LOG_NORMAL)("INT10:FF:Weird NC call"); diff --git a/src/ints/int10.h b/src/ints/int10.h index 2db43333..abdb7110 100644 --- a/src/ints/int10.h +++ b/src/ints/int10.h @@ -200,4 +200,10 @@ void INT10_SetupRomMemory(void); void INT10_SetupVESA(void); /* EGA RIL */ -void INT10_EGA_RIL_F1(Bit8u & bl, Bit8u bh, Bit16u dx); +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); diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index a0c765ba..642885e1 100644 --- a/src/ints/int10_char.cpp +++ b/src/ints/int10_char.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_char.cpp,v 1.38 2005-10-02 10:12:31 qbix79 Exp $ */ +/* $Id: int10_char.cpp,v 1.39 2005-10-03 19:22:13 c2woody Exp $ */ /* Character displaying moving functions */ @@ -522,9 +522,7 @@ void INT10_WriteChar(Bit8u chr,Bit8u attr,Bit8u page,Bit16u count,bool showattr) } } -void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr) { - //TODO Check if this page thing is correct - Bit8u page=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE); +static INLINE void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr,Bit8u page) { BIOS_NCOLS;BIOS_NROWS; Bit8u cur_row=CURSOR_POS_ROW(page); Bit8u cur_col=CURSOR_POS_COL(page); @@ -544,7 +542,7 @@ void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr) { break; case '\t': do { - INT10_TeletypeOutputAttr(' ',attr,useattr); + INT10_TeletypeOutputAttr(' ',attr,useattr,page); cur_row=CURSOR_POS_ROW(page); cur_col=CURSOR_POS_COL(page); } while(cur_col%8); @@ -569,6 +567,10 @@ void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr) { INT10_SetCursorPos(cur_row,cur_col,page); } +void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr) { + INT10_TeletypeOutputAttr(chr,attr,useattr,real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE)); +} + void INT10_TeletypeOutput(Bit8u chr,Bit8u attr) { INT10_TeletypeOutputAttr(chr,attr,CurMode->type!=M_TEXT); } @@ -591,7 +593,7 @@ void INT10_WriteString(Bit8u row,Bit8u col,Bit8u flag,Bit8u attr,PhysPt string,B attr=mem_readb(string); string++; }; - INT10_TeletypeOutputAttr(chr,attr,true); + INT10_TeletypeOutputAttr(chr,attr,true,page); count--; } if (!(flag&1)) { diff --git a/src/ints/int10_misc.cpp b/src/ints/int10_misc.cpp index cbcf578e..5c680ffc 100644 --- a/src/ints/int10_misc.cpp +++ b/src/ints/int10_misc.cpp @@ -127,6 +127,12 @@ void INT10_GetFuncStateInformation(PhysPt save) { mem_writeb(save+0x31,3); } +RealPt INT10_EGA_RIL_GetVersionPt(void) { + /* points to a graphics ROM location at the moment + as checks test for bx!=0 only */ + return RealMake(0xc000,0x30); +} + static void EGA_RIL(Bit16u dx, Bitu& port, Bitu& regs) { port = 0; regs = 0; //if nul is returned it's a single register port @@ -165,16 +171,120 @@ static void EGA_RIL(Bit16u dx, Bitu& port, Bitu& regs) { } } -void INT10_EGA_RIL_F1(Bit8u & bl, Bit8u bh, Bit16u dx) { +void INT10_EGA_RIL_ReadRegister(Bit8u & bl, Bit16u dx) { Bitu port = 0; Bitu regs = 0; EGA_RIL(dx,port,regs); if(regs == 0) { - IO_Write(port,bl); + if(port) bl = IO_Read(port); } else { + if(port == 0x3c0) IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6); IO_Write(port,bl); - IO_Write(port+1,bh); - bl = bh;//Not sure - LOG(LOG_INT10,LOG_NORMAL)("EGA RIL used with multi-reg"); + bl = IO_Read(port+1); + if(port == 0x3c0) IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6); + LOG(LOG_INT10,LOG_NORMAL)("EGA RIL read used with multi-reg"); + } +} + +void INT10_EGA_RIL_WriteRegister(Bit8u & bl, Bit8u bh, Bit16u dx) { + Bitu port = 0; + Bitu regs = 0; + EGA_RIL(dx,port,regs); + if(regs == 0) { + if(port) IO_Write(port,bl); + } else { + if(port == 0x3c0) { + IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6); + IO_Write(port,bl); + IO_Write(port,bh); + } else { + IO_Write(port,bl); + IO_Write(port+1,bh); + } + bl = bh;//Not sure + LOG(LOG_INT10,LOG_NORMAL)("EGA RIL write used with multi-reg"); + } +} + +void INT10_EGA_RIL_ReadRegisterRange(Bit8u & bl, Bit8u ch, Bit8u cl, Bit16u dx, PhysPt dst) { + Bitu port = 0; + Bitu regs = 0; + EGA_RIL(dx,port,regs); + if(regs == 0) { + LOG(LOG_INT10,LOG_ERROR)("EGA RIL range read with port %x called",port); + } else { + if(chregs) cl=regs-ch; + for (Bitu i=0; iregs) cl=regs-ch; + if(port == 0x3c0) { + IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6); + for (Bitu i=0; i #include @@ -321,7 +321,7 @@ void RestoreCursorBackground() for (y=y1; y<=y2; y++) { dataPos += addx1; for (x=x1; x<=x2; x++) { - INT10_PutPixel(x,y,0,mouse.backData[dataPos++]); + INT10_PutPixel(x,y,mouse.page,mouse.backData[dataPos++]); }; dataPos += addx2; }; @@ -378,7 +378,7 @@ void DrawCursor() { for (y=y1; y<=y2; y++) { dataPos += addx1; for (x=x1; x<=x2; x++) { - INT10_GetPixel(x,y,0,&mouse.backData[dataPos++]); + INT10_GetPixel(x,y,mouse.page,&mouse.backData[dataPos++]); }; dataPos += addx2; }; @@ -401,7 +401,7 @@ void DrawCursor() { if (cuMask & HIGHESTBIT) pixel = pixel ^ 0x0F; cuMask<<=1; // Set Pixel - INT10_PutPixel(x,y,0,pixel); + INT10_PutPixel(x,y,mouse.page,pixel); dataPos++; }; dataPos += addx2;