Skip to content

Commit

Permalink
Rename misc. 'pagesize' variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kklobe authored and kcgen committed Jun 22, 2022
1 parent 5424d38 commit 0fd73e8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/ints/int10_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ void INT10_LoadFont(PhysPt font,bool reload,Bitu count,Bitu offset,Bitu map,Bitu
real_writeb(BIOSMEM_SEG,BIOSMEM_NB_ROWS,rows-1);
real_writeb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT,(uint8_t)height);
//Page size
Bitu pagesize=rows*real_readb(BIOSMEM_SEG,BIOSMEM_NB_COLS)*2;
pagesize+=0x100; // bios adds extra on reload
real_writew(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE,pagesize);
Bitu bios_pagesize=rows*real_readb(BIOSMEM_SEG,BIOSMEM_NB_COLS)*2;
bios_pagesize+=0x100; // bios adds extra on reload
real_writew(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE,bios_pagesize);
//Cursor shape
if (height>=14) height--; // move up one line on 14+ line fonts
INT10_SetCursorShape(height-2,height-1);
Expand Down
36 changes: 18 additions & 18 deletions src/ints/int10_vesa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
MODE_INFO minfo;
memset(&minfo,0,sizeof(minfo));
PhysPt buf=PhysMake(seg,off);
int pageSize = 0;
int modePageSize = 0;
uint8_t modeAttributes;

mode&=0x3fff; // vbe2 compatible, ignore lfb and keep screen content bits
Expand Down Expand Up @@ -181,15 +181,15 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
bool ok_per_mode_pref;
switch (mblock.type) {
case M_LIN4:
pageSize = mblock.sheight * mblock.swidth/8;
modePageSize = mblock.sheight * mblock.swidth/8;
minfo.BytesPerScanLine = host_to_le16(mblock.swidth / 8);
minfo.NumberOfPlanes = 0x4;
minfo.BitsPerPixel = 4u;
minfo.MemoryModel = 3u; // ega planar mode
modeAttributes = 0x1b; // Color, graphics, no linear buffer
break;
case M_LIN8:
pageSize = mblock.sheight * mblock.swidth;
modePageSize = mblock.sheight * mblock.swidth;
minfo.BytesPerScanLine = host_to_le16(mblock.swidth);
minfo.NumberOfPlanes = 0x1;
minfo.BitsPerPixel = 8u;
Expand All @@ -207,7 +207,7 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
modeAttributes |= 0x80; // linear framebuffer
break;
case M_LIN15:
pageSize = mblock.sheight * mblock.swidth*2;
modePageSize = mblock.sheight * mblock.swidth*2;
minfo.BytesPerScanLine = host_to_le16(mblock.swidth * 2);
minfo.NumberOfPlanes = 0x1;
minfo.BitsPerPixel = 15u;
Expand All @@ -225,7 +225,7 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
modeAttributes |= 0x80; // linear framebuffer
break;
case M_LIN16:
pageSize = mblock.sheight * mblock.swidth*2;
modePageSize = mblock.sheight * mblock.swidth*2;
minfo.BytesPerScanLine = host_to_le16(mblock.swidth * 2);
minfo.NumberOfPlanes = 0x1;
minfo.BitsPerPixel = 16u;
Expand All @@ -244,10 +244,10 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
// Mode 0x212 has 128 extra bytes per scan line for
// compatibility with Windows 640x480 24-bit S3 Trio drivers
if (mode == 0x212) {
pageSize = mblock.sheight * (mblock.swidth * 3 + 128);
modePageSize = mblock.sheight * (mblock.swidth * 3 + 128);
minfo.BytesPerScanLine = host_to_le16(mblock.swidth * 3 + 128);
} else {
pageSize = mblock.sheight * (mblock.swidth * 3);
modePageSize = mblock.sheight * (mblock.swidth * 3);
minfo.BytesPerScanLine = host_to_le16(mblock.swidth * 3);
}
minfo.NumberOfPlanes = 0x1u;
Expand All @@ -264,7 +264,7 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
modeAttributes |= 0x80; // linear framebuffer
break;
case M_LIN32:
pageSize = mblock.sheight * mblock.swidth*4;
modePageSize = mblock.sheight * mblock.swidth*4;
minfo.BytesPerScanLine = host_to_le16(mblock.swidth * 4);
minfo.NumberOfPlanes = 0x1u;
minfo.BitsPerPixel = 32u;
Expand All @@ -282,7 +282,7 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
modeAttributes |= 0x80; // linear framebuffer
break;
case M_TEXT:
pageSize = 0;
modePageSize = 0;
minfo.BytesPerScanLine = host_to_le16(mblock.twidth * 2);
minfo.NumberOfPlanes = 0x4;
minfo.BitsPerPixel = 4u;
Expand All @@ -292,21 +292,21 @@ uint8_t VESA_GetSVGAModeInformation(uint16_t mode,uint16_t seg,uint16_t off) {
default:
return VESA_FAIL;
}
if (pageSize & 0xFFFF) {
if (modePageSize & 0xFFFF) {
// It is documented that many applications assume 64k-aligned page sizes
// VBETEST is one of them
pageSize += 0x10000;
pageSize &= ~0xFFFF;
modePageSize += 0x10000;
modePageSize &= ~0xFFFF;
}
int pages = 0;
if (pageSize > static_cast<int>(vga.vmemsize)) {
int modePages = 0;
if (modePageSize > static_cast<int>(vga.vmemsize)) {
// mode not supported by current hardware configuration
modeAttributes &= ~0x1;
} else if (pageSize) {
pages = (vga.vmemsize / pageSize)-1;
} else if (modePageSize) {
modePages = (vga.vmemsize / modePageSize)-1;
}
assert(pages <= UINT8_MAX);
minfo.NumberOfImagePages = static_cast<uint8_t>(pages);
assert(modePages <= UINT8_MAX);
minfo.NumberOfImagePages = static_cast<uint8_t>(modePages);
minfo.ModeAttributes = host_to_le16(modeAttributes);
minfo.WinAAttributes = 0x7; // Exists/readable/writable

Expand Down

0 comments on commit 0fd73e8

Please sign in to comment.