From 24b045e69fd26f1ec9781afc03544b374a503059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Fri, 2 Dec 2005 13:10:18 +0000 Subject: [PATCH] change tandy machine definition a bit Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2398 --- include/dosbox.h | 4 ++++ src/hardware/tandy_sound.cpp | 2 +- src/hardware/vga_draw.cpp | 4 ++-- src/hardware/vga_memory.cpp | 2 +- src/hardware/vga_misc.cpp | 2 +- src/hardware/vga_other.cpp | 8 ++++---- src/ints/bios.cpp | 17 ++++++++++++----- src/ints/int10.cpp | 13 +++++++------ src/ints/int10.h | 1 + src/ints/int10_char.cpp | 4 ++-- src/ints/int10_modes.cpp | 4 ++-- src/ints/int10_pal.cpp | 23 +++++++++++++---------- 12 files changed, 50 insertions(+), 34 deletions(-) diff --git a/include/dosbox.h b/include/dosbox.h index 8adc942d..51017f56 100644 --- a/include/dosbox.h +++ b/include/dosbox.h @@ -43,12 +43,16 @@ enum MachineType { MCH_HERC, MCH_CGA, MCH_TANDY, + MCH_PCJR, MCH_VGA }; extern MachineType machine; extern bool SDLNetInited; +#define IS_TANDY_ARCH ((machine==MCH_TANDY) || (machine==MCH_PCJR)) +#define TANDY_ARCH_CASE MCH_TANDY: case MCH_PCJR + #ifndef DOSBOX_LOGGING_H #include "logging.h" #endif // the logging system. diff --git a/src/hardware/tandy_sound.cpp b/src/hardware/tandy_sound.cpp index 33ffd8e1..49e0f87f 100644 --- a/src/hardware/tandy_sound.cpp +++ b/src/hardware/tandy_sound.cpp @@ -316,7 +316,7 @@ public: Section_prop * section=static_cast(configuration); real_writeb(0x40,0xd4,0x00); - if (machine==MCH_TANDY) { + if (IS_TANDY_ARCH) { /* enable tandy sound if tandy=true/auto */ if ((strcmp(section->Get_string("tandy"),"true")!=0) && (strcmp(section->Get_string("tandy"),"on")!=0) && diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index f826839e..1569b2bc 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -313,7 +313,7 @@ static void VGA_VerticalTimer(Bitu val) { vga.draw.address=(vga.draw.address*2)&0x1fff; break; } - if (machine==MCH_TANDY) { + if (IS_TANDY_ARCH) { vga.draw.address+=vga.tandy.disp_bank << 14; vga.draw.cursor.address+=vga.tandy.disp_bank << 14; } @@ -418,7 +418,7 @@ void VGA_SetupDrawing(Bitu val) { vga.draw.double_scan=false; switch (machine) { case MCH_CGA: - case MCH_TANDY: + case TANDY_ARCH_CASE: clock=((vga.tandy.mode_control & 1) ? 14318180 : (14318180/2))/8; break; case MCH_HERC: diff --git a/src/hardware/vga_memory.cpp b/src/hardware/vga_memory.cpp index d2b46e43..88cbc4b2 100644 --- a/src/hardware/vga_memory.cpp +++ b/src/hardware/vga_memory.cpp @@ -457,7 +457,7 @@ void VGA_SetupHandlers(void) { range_handler=&vgaph.hmap; if (vga.herc.mode_control&0x80) goto range_b800; else goto range_b000; - case MCH_TANDY: + case TANDY_ARCH_CASE: range_handler=&vgaph.htandy; MEM_SetPageHandler(0x80,32,range_handler); goto range_b800; diff --git a/src/hardware/vga_misc.cpp b/src/hardware/vga_misc.cpp index 92495588..1f96bcda 100644 --- a/src/hardware/vga_misc.cpp +++ b/src/hardware/vga_misc.cpp @@ -119,7 +119,7 @@ void VGA_SetupMisc(void) { IO_RegisterReadHandler(0x3c2,read_p3c2,IO_MB); IO_RegisterWriteHandler(0x3c2,write_p3c2,IO_MB); IO_RegisterReadHandler(0x3cc,read_p3cc,IO_MB); - } else if (machine==MCH_CGA || machine==MCH_TANDY) { + } else if (machine==MCH_CGA || IS_TANDY_ARCH) { IO_RegisterReadHandler(0x3da,read_p3da,IO_MB); } else if (machine==MCH_HERC) { IO_RegisterReadHandler(0x3ba,read_p3da,IO_MB); diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index 904e34a0..13e7f854 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -191,7 +191,7 @@ static void write_color_select(Bit8u val) { break; case M_TANDY4: { - if (machine == MCH_TANDY && (vga.tandy.gfx_control & 0x8)) { + if (IS_TANDY_ARCH && (vga.tandy.gfx_control & 0x8)) { VGA_SetCGA4Table(0,1,2,3); return; } @@ -342,7 +342,7 @@ static Bitu read_hercules(Bitu port,Bitu iolen) { void VGA_SetupOther(void) { Bitu i; - if (machine==MCH_CGA || machine==MCH_TANDY) { + if (machine==MCH_CGA || IS_TANDY_ARCH) { extern Bit8u int10_font_08[256 * 8]; for (i=0;i<256;i++) memcpy(&vga.draw.font[i*32],&int10_font_08[i*8],8); vga.draw.font_tables[0]=vga.draw.font_tables[1]=vga.draw.font; @@ -362,14 +362,14 @@ void VGA_SetupOther(void) { IO_RegisterWriteHandler(0x3b8,write_hercules,IO_MB); IO_RegisterWriteHandler(0x3bf,write_hercules,IO_MB); } - if (machine==MCH_TANDY) { + if (IS_TANDY_ARCH) { IO_RegisterWriteHandler(0x3d8,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3d9,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3de,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3df,write_tandy,IO_MB); IO_RegisterWriteHandler(0x3da,write_tandy,IO_MB); } - if (machine==MCH_CGA || machine==MCH_HERC || machine==MCH_TANDY) { + if (machine==MCH_CGA || machine==MCH_HERC || IS_TANDY_ARCH) { Bitu base=machine==MCH_HERC ? 0x3b4 : 0x3d4; IO_RegisterWriteHandler(base,write_crtc_index_other,IO_MB); IO_RegisterWriteHandler(base+1,write_crtc_data_other,IO_MB); diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index f6fb02ef..76f8191f 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios.cpp,v 1.51 2005-11-24 21:11:45 c2woody Exp $ */ +/* $Id: bios.cpp,v 1.52 2005-12-02 13:10:18 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -560,8 +560,14 @@ static Bitu INT15_Handler(void) { if (biosConfigSeg==0) biosConfigSeg = DOS_GetMemory(1); //We have 16 bytes PhysPt data = PhysMake(biosConfigSeg,0); mem_writew(data,8); // 8 Bytes following - if (machine==MCH_TANDY) { - mem_writeb(data+2,0xFF); // Model ID (Tandy) + if (IS_TANDY_ARCH) { + if (machine==MCH_TANDY) { + // Model ID (Tandy) + mem_writeb(data+2,0xFF); + } else { + // Model ID (PCJR) + mem_writeb(data+2,0xFD); + } mem_writeb(data+3,0x0A); // Submodel ID mem_writeb(data+4,0x10); // Bios Revision /* Tandy doesn't have a 2nd PIC, left as is for now */ @@ -854,7 +860,8 @@ public: callback[8].Install(&INT70_Handler,CB_IRET,"Int 70 RTC"); callback[8].Set_RealVec(0x70); - if (machine==MCH_TANDY) phys_writeb(0xffffe,0xff); /* Tandy model */ + if (machine==MCH_TANDY) phys_writeb(0xffffe,0xff) ; /* Tandy model */ + else if (machine==MCH_PCJR) phys_writeb(0xffffe,0xfd); /* PCJr model */ else phys_writeb(0xffffe,0xfc); /* PC */ if (use_tandyDAC) { @@ -940,7 +947,7 @@ public: break; case MCH_VGA: case MCH_CGA: - case MCH_TANDY: + case TANDY_ARCH_CASE: //Startup 80x25 color config|=0x20; break; diff --git a/src/ints/int10.cpp b/src/ints/int10.cpp index 5ca6781e..27dcc17a 100644 --- a/src/ints/int10.cpp +++ b/src/ints/int10.cpp @@ -68,7 +68,7 @@ static Bitu INT10_Handler(void) { reg_ah=0; break; case 0x05: /* Set Active Page */ - if (reg_al & 0x80 && machine==MCH_TANDY) { + if (reg_al & 0x80 && IS_TANDY_ARCH) { Bit8u crtcpu=real_readb(BIOSMEM_SEG, BIOSMEM_CRTCPU_PAGE); switch (reg_al) { case 0x80: @@ -519,16 +519,17 @@ static void SetupTandyBios(void) { 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x73, 0x20, 0x4c, 0x74, 0x64, 0x2e, 0x0d, 0x0a, 0x61, 0x6e, 0x64, 0x20, 0x54, 0x61, 0x6e, 0x64, 0x79 }; - Bitu i; - phys_writeb(0xffffe,0xff); - for(i=0;i<130;i++) { - phys_writeb(0xf0000+i+0xc000, TandyConfig[i]); + if (machine==MCH_TANDY) { + Bitu i; + for(i=0;i<130;i++) { + phys_writeb(0xf0000+i+0xc000, TandyConfig[i]); + } } } void INT10_Init(Section* sec) { INT10_InitVGA(); - if (machine==MCH_TANDY) SetupTandyBios(); + if (IS_TANDY_ARCH) SetupTandyBios(); /* Setup the INT 10 vector */ call_10=CALLBACK_Allocate(); CALLBACK_Setup(call_10,&INT10_Handler,CB_IRET,"Int 10 video"); diff --git a/src/ints/int10.h b/src/ints/int10.h index bc769198..7f5baf4a 100644 --- a/src/ints/int10.h +++ b/src/ints/int10.h @@ -81,6 +81,7 @@ #define VGAREG_TDY_RESET 0x3da #define VGAREG_TDY_ADDRESS 0x3da #define VGAREG_TDY_DATA 0x3de +#define VGAREG_PCJR_DATA 0x3da #define VGAREG_MDA_MODECTL 0x3b8 #define VGAREG_CGA_MODECTL 0x3d8 diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index 9df3c0ca..09ae940f 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.41 2005-11-12 14:17:36 c2woody Exp $ */ +/* $Id: int10_char.cpp,v 1.42 2005-12-02 13:10:18 c2woody Exp $ */ /* Character displaying moving functions */ @@ -299,7 +299,7 @@ void INT10_SetActivePage(Bit8u page) { void INT10_SetCursorShape(Bit8u first,Bit8u last) { real_writew(BIOSMEM_SEG,BIOSMEM_CURSOR_TYPE,last|(first<<8)); if (machine==MCH_CGA) goto dowrite; - if (machine==MCH_TANDY) goto dowrite; + if (IS_TANDY_ARCH) goto dowrite; /* Skip CGA cursor emulation if EGA/VGA system is active */ if (!(real_readb(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL) & 0x8)) { /* Check for CGA type 01, invisible */ diff --git a/src/ints/int10_modes.cpp b/src/ints/int10_modes.cpp index 925e63c5..a64c2537 100644 --- a/src/ints/int10_modes.cpp +++ b/src/ints/int10_modes.cpp @@ -257,7 +257,7 @@ bool INT10_SetVideoMode_OTHER(Bitu mode,bool clearmem) { switch (machine) { case MCH_CGA: if (mode>6) return false; - case MCH_TANDY: + case TANDY_ARCH_CASE: if (mode>0xa) return false; if (!SetCurMode(ModeList_OTHER,mode)) { LOG(LOG_INT10,LOG_ERROR)("Trying to set illegal mode %X",mode); @@ -336,7 +336,7 @@ bool INT10_SetVideoMode_OTHER(Bitu mode,bool clearmem) { real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_MSR,mode_control); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,color_select); break; - case MCH_TANDY: + case TANDY_ARCH_CASE: /* Init some registers */ IO_WriteB(0x3da,0x1);IO_WriteB(0x3de,0xf); //Palette mask always 0xf IO_WriteB(0x3da,0x2);IO_WriteB(0x3de,0x0); //block border diff --git a/src/ints/int10_pal.cpp b/src/ints/int10_pal.cpp index ed13342f..2011d98f 100644 --- a/src/ints/int10_pal.cpp +++ b/src/ints/int10_pal.cpp @@ -27,12 +27,17 @@ static INLINE void ResetACTL(void) { IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6); } +static INLINE void WriteTandyACTL(Bit8u creg,Bit8u val) { + IO_Write(VGAREG_TDY_ADDRESS,creg); + if (machine==MCH_TANDY) IO_Write(VGAREG_TDY_DATA,val); + else IO_Write(VGAREG_PCJR_DATA,val); +} + void INT10_SetSinglePaletteRegister(Bit8u reg,Bit8u val) { switch (machine) { - case MCH_TANDY: + case TANDY_ARCH_CASE: IO_Read(VGAREG_TDY_RESET); - IO_Write(VGAREG_TDY_ADDRESS,reg+0x10); - IO_Write(VGAREG_TDY_DATA,val); + WriteTandyACTL(reg+0x10,val); break; case MCH_VGA: if(reg<=ACTL_MAX_REG) { @@ -55,17 +60,15 @@ void INT10_SetOverscanBorderColor(Bit8u val) { void INT10_SetAllPaletteRegisters(PhysPt data) { switch (machine) { - case MCH_TANDY: + case TANDY_ARCH_CASE: IO_Read(VGAREG_TDY_RESET); // First the colors for(Bit8u i=0;i<0x10;i++) { - IO_Write(VGAREG_TDY_ADDRESS,i+0x10); - IO_Write(VGAREG_TDY_DATA,mem_readb(data)); + WriteTandyACTL(i+0x10,mem_readb(data)); data++; } // Then the border - IO_Write(VGAREG_TDY_ADDRESS,0x02); - IO_Write(VGAREG_TDY_DATA,mem_readb(data)); + WriteTandyACTL(0x02,mem_readb(data)); break; case MCH_VGA: ResetACTL(); @@ -210,7 +213,7 @@ void INT10_SetBackgroundBorder(Bit8u val) { Bitu temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); temp=(temp & 0xe0) | (val & 0x1f); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp); - if (machine == MCH_CGA || machine == MCH_TANDY) + if (machine == MCH_CGA || IS_TANDY_ARCH) IO_Write(0x3d9,temp); else if (machine == MCH_VGA) { val = ((val << 1) & 0x10) | (val & 0x7); @@ -228,7 +231,7 @@ void INT10_SetColorSelect(Bit8u val) { Bitu temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); temp=(temp & 0xdf) | ((val & 1) ? 0x20 : 0x0); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp); - if (machine == MCH_CGA || machine == MCH_TANDY) + if (machine == MCH_CGA || IS_TANDY_ARCH) IO_Write(0x3d9,temp); else if (machine == MCH_VGA) { val = (temp & 0x10) | 2 | val;