use bios scanlength/page size fields instead of mode fixed values for put/get pixel functions (fixes aldo2)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3083
This commit is contained in:
parent
61db3e5178
commit
f82d47239e
1 changed files with 21 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2007 The DOSBox Team
|
||||
* Copyright (C) 2002-2008 The DOSBox Team
|
||||
*
|
||||
* 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
|
||||
|
@ -16,6 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: int10_put_pixel.cpp,v 1.19 2008-01-20 09:21:49 c2woody Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
#include "inout.h"
|
||||
|
@ -102,7 +104,12 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) {
|
|||
if (color & 0x80) { IO_Write(0x3ce,0x3);IO_Write(0x3cf,0x18); }
|
||||
//Perhaps also set mode 1
|
||||
/* Calculate where the pixel is in video memory */
|
||||
PhysPt off=0xa0000+CurMode->plength*page+((y*CurMode->swidth+x)>>3);
|
||||
if (CurMode->plength!=real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE))
|
||||
E_Exit("PutPixel_EGA_p: %x!=%x",CurMode->plength,real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE));
|
||||
if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8)
|
||||
E_Exit("PutPixel_EGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8);
|
||||
PhysPt off=0xa0000+real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)*page+
|
||||
((y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x)>>3);
|
||||
/* Bitmask and set/reset should do the rest */
|
||||
mem_readb(off);
|
||||
mem_writeb(off,0xff);
|
||||
|
@ -118,7 +125,9 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) {
|
|||
mem_writeb(PhysMake(0xa000,y*320+x),color);
|
||||
break;
|
||||
case M_LIN8: {
|
||||
PhysPt off=S3_LFB_BASE+y*CurMode->swidth+x;
|
||||
if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8)
|
||||
E_Exit("PutPixel_VGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8);
|
||||
PhysPt off=S3_LFB_BASE+y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x;
|
||||
mem_writeb(off,color);
|
||||
break;
|
||||
}
|
||||
|
@ -149,7 +158,12 @@ void INT10_GetPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u * color) {
|
|||
case M_EGA:
|
||||
{
|
||||
/* Calculate where the pixel is in video memory */
|
||||
PhysPt off=0xa0000+CurMode->plength*page+((y*CurMode->swidth+x)>>3);
|
||||
if (CurMode->plength!=real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE))
|
||||
E_Exit("GetPixel_EGA_p: %x!=%x",CurMode->plength,real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE));
|
||||
if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8)
|
||||
E_Exit("GetPixel_EGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8);
|
||||
PhysPt off=0xa0000+real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)*page+
|
||||
((y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x)>>3);
|
||||
Bitu shift=7-(x & 7);
|
||||
/* Set the read map */
|
||||
*color=0;
|
||||
|
@ -167,7 +181,9 @@ void INT10_GetPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u * color) {
|
|||
*color=mem_readb(PhysMake(0xa000,320*y+x));
|
||||
break;
|
||||
case M_LIN8: {
|
||||
PhysPt off=S3_LFB_BASE+y*CurMode->swidth+x;
|
||||
if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8)
|
||||
E_Exit("GetPixel_VGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8);
|
||||
PhysPt off=S3_LFB_BASE+y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x;
|
||||
*color = mem_readb(off);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue