Bit of a challenge this one provided, hopefully its now stable:
This code Fixes INT10-function 3 (Video Scroller support):
add the following to INT10_CHAR.CPP
(Somewhere just below the #includes ..)
static INLINE void CGA2_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) {
Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT);
PhysPt dest=base+((CurMode->twidth*rnew)*(cheight/2)+cleft);
PhysPt src=base+((CurMode->twidth*rold)*(cheight/2)+cleft);
Bitu copy=(cright-cleft);
Bitu nextline=CurMode->twidth;
for (Bitu i=0;i<cheight;i++) {
MEM_BlockCopy(dest,src,copy);
MEM_BlockCopy(dest+8*1024,src+8*1024,copy);
dest+=nextline;src+=nextline;
}
}
static INLINE void CGA2_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) {
Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT);
PhysPt dest=base+((CurMode->twidth*row)*(cheight/2)+cleft);
Bitu copy=(cright-cleft);
Bitu nextline=CurMode->twidth;
attr=(attr & 0x3) | ((attr & 0x3) << 2) | ((attr & 0x3) << 4) | ((attr & 0x3) << 6);
for (Bitu i=0;i<cheight;i++) {
for (Bitu x=0;x<copy;x++) {
mem_writeb(dest+x,attr);
mem_writeb(dest+8*1024+x,attr);
}
dest+=nextline;
}
}
............ Then replace the following ...........
case M_TEXT16:
TEXT_CopyRow(cul,clr,start,start+nlines,base);break;
--// case M_CGA2:
++ case M_CGA2:
++ CGA2_CopyRow(cul,clr,start,start+nlines,base);break;
case M_CGA4:
... AND ...
case M_TEXT16:
TEXT_FillRow(cul,clr,start,base,attr);break;
--// case M_CGA2:
++ case M_CGA2:
CGA2_FillRow(cul,clr,start,base,attr);break;
case M_CGA4:
CGA4_FillRow(cul,clr,start,base,attr);break;
Now you can play King's Valley (CGA/Tandy)!
King's Valley