diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index a16b3405..8175ca25 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_draw.cpp,v 1.109 2009-06-29 18:43:33 c2woody Exp $ */ +/* $Id: vga_draw.cpp,v 1.110 2009-07-11 10:25:24 c2woody Exp $ */ #include #include @@ -344,11 +344,24 @@ static Bit8u * VGA_Draw_LIN32_Line_HWMouse(Bitu vidstart, Bitu /*line*/) { } } +static const Bit8u* VGA_Text_Memwrap(Bitu vidstart) { + vidstart &= vga.draw.linear_mask; + Bitu line_end = 2 * vga.draw.blocks; + if (GCC_UNLIKELY((vidstart + line_end) > vga.draw.linear_mask)) { + // wrapping in this line + Bitu break_pos = (vga.draw.linear_mask - vidstart) + 1; + // need a temporary storage - TempLine/2 is ok for a bit more than 132 columns + memcpy(&TempLine[sizeof(TempLine)/2], &vga.tandy.draw_base[vidstart], break_pos); + memcpy(&TempLine[sizeof(TempLine)/2 + break_pos],&vga.tandy.draw_base[0], line_end - break_pos); + return &TempLine[sizeof(TempLine)/2]; + } else return &vga.tandy.draw_base[vidstart]; +} + static Bit32u FontMask[2]={0xffffffff,0x0}; static Bit8u * VGA_TEXT_Draw_Line(Bitu vidstart, Bitu line) { Bits font_addr; Bit32u * draw=(Bit32u *)TempLine; - const Bit8u *vidmem = &vga.tandy.draw_base[vidstart]; + const Bit8u* vidmem = VGA_Text_Memwrap(vidstart); for (Bitu cx=0;cx=vga.draw.split_line)) pel_pan=0; - const Bit8u *vidmem = &vga.tandy.draw_base[vidstart]; + const Bit8u* vidmem = VGA_Text_Memwrap(vidstart); Bit8u chr=vidmem[0]; Bit8u col=vidmem[1]; Bit8u font=(vga.draw.font_tables[(col >> 3)&1][chr*32+line])<=vga.draw.split_line)) pel_pan=0; - const Bit8u *vidmem = &vga.tandy.draw_base[vidstart]; + const Bit8u* vidmem = VGA_Text_Memwrap(vidstart); Bit8u chr=vidmem[0]; Bit8u col=vidmem[1]; Bit8u font=(vga.draw.font_tables[(col >> 3)&1][chr*32+line])<> 4)) ? diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index 55a93cb3..bbf059ad 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_other.cpp,v 1.27 2009-06-29 18:43:33 c2woody Exp $ */ +/* $Id: vga_other.cpp,v 1.28 2009-07-11 10:25:24 c2woody Exp $ */ #include #include @@ -68,7 +68,8 @@ static void write_crtc_data_other(Bitu /*port*/,Bitu val,Bitu /*iolen*/) { vga.other.vsyncp=(Bit8u)val; break; case 0x09: //Max scanline - if (vga.other.max_scanline ^ val) VGA_StartResize(); + val &= 0x1f; // VGADOC says bit 0-3 but the MC6845 datasheet says bit 0-4 + if (vga.other.max_scanline ^ val) VGA_StartResize(); vga.other.max_scanline=(Bit8u)val; break; case 0x0A: /* Cursor Start Register */ @@ -522,6 +523,7 @@ void VGA_SetupOther(void) { Bitu i; memset( &vga.tandy, 0, sizeof( vga.tandy )); vga.attr.enabled = true; + vga.config.bytes_skip=0; //Initialize values common for most machines, can be overwritten vga.tandy.draw_base = vga.mem.linear; diff --git a/src/ints/int10.h b/src/ints/int10.h index fdf01064..7ceee886 100644 --- a/src/ints/int10.h +++ b/src/ints/int10.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10.h,v 1.39 2009-05-27 09:15:42 qbix79 Exp $ */ +/* $Id: int10.h,v 1.40 2009-07-11 10:25:25 c2woody Exp $ */ #include "vga.h" @@ -95,7 +95,7 @@ #define VGAMEM_MTEXT 0xB000 #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; +#define BIOS_NROWS Bit16u nrows=(Bit16u)real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS)+1; extern Bit8u int10_font_08[256 * 8]; extern Bit8u int10_font_14[256 * 14]; diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index ee291623..9d102b4c 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.58 2009-05-27 09:15:42 qbix79 Exp $ */ +/* $Id: int10_char.cpp,v 1.59 2009-07-11 10:25:25 c2woody Exp $ */ /* Character displaying moving functions */ @@ -272,12 +272,19 @@ filling: void INT10_SetActivePage(Bit8u page) { Bit16u mem_address; - if (page>7) LOG(LOG_INT10,LOG_ERROR)("INT10_SetActivePage page %d",page); + + if (IS_EGAVGA_ARCH && (svgaCard==SVGA_S3Trio)) page &= 7; + mem_address=page*real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE); /* Write the new page start */ real_writew(BIOSMEM_SEG,BIOSMEM_CURRENT_START,mem_address); - if (IS_EGAVGA_ARCH && CurMode->mode<0x8) mem_address>>=1; + if (IS_EGAVGA_ARCH) { + if (CurMode->mode<8) mem_address>>=1; + // rare alternative: if (CurMode->type==M_TEXT) mem_address>>=1; + } else { + mem_address>>=1; + } /* Write the new start address in vgahardware */ Bit16u base=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS); IO_Write(base,0x0c); @@ -587,7 +594,7 @@ static void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr,Bit8u pag if(cur_row==nrows) { //Fill with black on non-text modes and with 0x7 on textmode Bit8u fill = (CurMode->type == M_TEXT)?0x7:0; - INT10_ScrollWindow(0,0,nrows-1,ncols-1,-1,fill,page); + INT10_ScrollWindow(0,0,(Bit8u)(nrows-1),ncols-1,-1,fill,page); cur_row--; } // Set the cursor for the page diff --git a/src/ints/int10_modes.cpp b/src/ints/int10_modes.cpp index 7da1a306..e1ae1894 100644 --- a/src/ints/int10_modes.cpp +++ b/src/ints/int10_modes.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_modes.cpp,v 1.86 2009-06-28 14:56:14 c2woody Exp $ */ +/* $Id: int10_modes.cpp,v 1.87 2009-07-11 10:25:25 c2woody Exp $ */ #include @@ -232,7 +232,7 @@ VideoModeBlock ModeList_OTHER[]={ }; VideoModeBlock Hercules_Mode= -{ 0x007 ,M_TEXT ,640 ,400 ,80 ,25 ,8 ,14 ,4 ,0xB0000 ,0x1000 ,97 ,25 ,80 ,25 ,0 }; +{ 0x007 ,M_TEXT ,640 ,400 ,80 ,25 ,8 ,14 ,1 ,0xB0000 ,0x1000 ,97 ,25 ,80 ,25 ,0 }; static Bit8u text_palette[64][3]= {