1
0
Fork 0

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
This commit is contained in:
Sebastian Strohhäcker 2005-10-03 19:22:13 +00:00
parent a270f4d0bc
commit 59910aafbc
5 changed files with 156 additions and 17 deletions

View file

@ -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");

View file

@ -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);

View file

@ -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)) {

View file

@ -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(ch<regs) {
if (ch+cl>regs) cl=regs-ch;
for (Bitu i=0; i<cl; i++) {
if(port == 0x3c0) IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6);
IO_Write(port,ch+i);
mem_writeb(dst++,IO_Read(port+1));
}
if(port == 0x3c0) IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6);
} else LOG(LOG_INT10,LOG_ERROR)("EGA RIL range read from %x for invalid register %x",port,ch);
}
}
void INT10_EGA_RIL_WriteRegisterRange(Bit8u & bl, Bit8u ch, Bit8u cl, Bit16u dx, PhysPt src) {
Bitu port = 0;
Bitu regs = 0;
EGA_RIL(dx,port,regs);
if(regs == 0) {
LOG(LOG_INT10,LOG_ERROR)("EGA RIL range write called with port %x",port);
} else {
if(ch<regs) {
if (ch+cl>regs) cl=regs-ch;
if(port == 0x3c0) {
IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6);
for (Bitu i=0; i<cl; i++) {
IO_Write(port,ch+i);
IO_Write(port,mem_readb(src++));
}
} else {
for (Bitu i=0; i<cl; i++) {
IO_Write(port,ch+i);
IO_Write(port+1,mem_readb(src++));
}
}
} else LOG(LOG_INT10,LOG_ERROR)("EGA RIL range write to %x with invalid register %x",port,ch);
}
}
/* register sets are of the form
offset 0 (word): group index
offset 2 (byte): register number (0 for single registers, ignored)
offset 3 (byte): register value (return value when reading)
*/
void INT10_EGA_RIL_ReadRegisterSet(Bit16u cx, PhysPt tbl) {
/* read cx register sets */
for (Bitu i=0; i<cx; i++) {
Bit8u vl=mem_readb(tbl+2);
INT10_EGA_RIL_ReadRegister(vl, mem_readw(tbl));
mem_writeb(tbl+3, vl);
tbl+=4;
}
}
void INT10_EGA_RIL_WriteRegisterSet(Bit16u cx, PhysPt tbl) {
/* write cx register sets */
Bitu port = 0;
Bitu regs = 0;
for (Bitu i=0; i<cx; i++) {
EGA_RIL(mem_readw(tbl),port,regs);
Bit8u vl=mem_readb(tbl+3);
if(regs == 0) {
if(port) IO_Write(port,vl);
} else {
Bit8u idx=mem_readb(tbl+2);
if(port == 0x3c0) {
IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6);
IO_Write(port,idx);
IO_Write(port,vl);
} else {
IO_Write(port,idx);
IO_Write(port+1,vl);
}
}
tbl+=4;
}
}

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: mouse.cpp,v 1.55 2005-09-30 10:14:27 qbix79 Exp $ */
/* $Id: mouse.cpp,v 1.56 2005-10-03 19:22:13 c2woody Exp $ */
#include <string.h>
#include <math.h>
@ -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;