From abbf10093fccecf71afa4ccb371fab084c4bc238 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 6 Dec 2007 17:44:19 +0000 Subject: [PATCH] small bugfix by hal. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3054 --- include/serialport.h | 4 ++-- src/dos/dos.cpp | 5 +++-- src/hardware/serialport/serialport.cpp | 15 ++++++++------- src/ints/bios.cpp | 5 ++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/serialport.h b/include/serialport.h index bc55b0cd..7ed273d8 100644 --- a/include/serialport.h +++ b/include/serialport.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialport.h,v 1.14 2007-01-13 08:35:49 qbix79 Exp $ */ +/* $Id: serialport.h,v 1.15 2007-12-06 17:44:19 qbix79 Exp $ */ #ifndef DOSBOX_SERIALPORT_H #define DOSBOX_SERIALPORT_H @@ -167,7 +167,7 @@ public: void Init_Registers(); bool Putchar(Bit8u data, bool wait_dtr, bool wait_rts, Bitu timeout); - bool Getchar(Bit8u* data, bool wait_dsr, Bitu timeout); + bool Getchar(Bit8u* data, Bit8u* lsr, bool wait_dsr, Bitu timeout); private: diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index 807c2b94..726c4037 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos.cpp,v 1.106 2007-11-18 10:30:12 c2woody Exp $ */ +/* $Id: dos.cpp,v 1.107 2007-12-06 17:44:19 qbix79 Exp $ */ #include #include @@ -83,9 +83,10 @@ static Bitu DOS_21Handler(void) { { Bit16u port = real_readw(0x40,0); if(port!=0 && serialports[0]) { + Bit8u status; // RTS/DTR on IO_WriteB(port+4,0x3); - serialports[0]->Getchar(®_al,true, 0xFFFFFFFF); + serialports[0]->Getchar(®_al, &status, true, 0xFFFFFFFF); } } break; diff --git a/src/hardware/serialport/serialport.cpp b/src/hardware/serialport/serialport.cpp index e535ed0f..25ea520c 100644 --- a/src/hardware/serialport/serialport.cpp +++ b/src/hardware/serialport/serialport.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialport.cpp,v 1.7 2007-02-22 08:41:16 qbix79 Exp $ */ +/* $Id: serialport.cpp,v 1.8 2007-12-06 17:44:19 qbix79 Exp $ */ #include #include @@ -44,7 +44,8 @@ bool device_COM::Read(Bit8u * data,Bit16u * size) { sclass->Write_MCR(0x03); for (Bit16u i=0; i<*size; i++) { - if(!(sclass->Getchar(&data[i],true,1000))) { + Bit8u status; + if(!(sclass->Getchar(&data[i],&status,true,1000))) { *size=i; return true; } @@ -1082,7 +1083,7 @@ CSerial::~CSerial(void) { for(Bitu i = 0; i <= SERIAL_BASE_EVENT_COUNT; i++) removeEvent(i); }; -bool CSerial::Getchar(Bit8u* data, bool wait_dsr, Bitu timeout) { +bool CSerial::Getchar(Bit8u* data, Bit8u* lsr, bool wait_dsr, Bitu timeout) { double starttime=PIC_FullIndex(); // wait for it to become empty @@ -1093,19 +1094,19 @@ bool CSerial::Getchar(Bit8u* data, bool wait_dsr, Bitu timeout) { if(!(starttime>PIC_FullIndex()-timeout)) { #if SERIAL_DEBUG if(dbg_aux) - fprintf(debugfp,"%12.3f API read timeout: MSR 0x%x\r\n", PIC_FullIndex(),Read_MSR()); + fprintf(debugfp,"%12.3f Getchar status timeout: MSR 0x%x\r\n", PIC_FullIndex(),Read_MSR()); #endif return false; } } // wait for a byte to arrive - while((!(Read_LSR()&0x1))&&(starttime>PIC_FullIndex()-timeout)) + while((!((*lsr=Read_LSR())&0x1))&&(starttime>PIC_FullIndex()-timeout)) CALLBACK_Idle(); if(!(starttime>PIC_FullIndex()-timeout)) { #if SERIAL_DEBUG if(dbg_aux) - fprintf(debugfp,"%12.3f API read timeout: MSR 0x%x\r\n", PIC_FullIndex(),Read_MSR()); + fprintf(debugfp,"%12.3f Getchar data timeout: MSR 0x%x\r\n", PIC_FullIndex(),Read_MSR()); #endif return false; } @@ -1146,7 +1147,7 @@ bool CSerial::Putchar(Bit8u data, bool wait_dsr, bool wait_cts, Bitu timeout) { if(!(starttime>PIC_FullIndex()-timeout)) { #if SERIAL_DEBUG if(dbg_aux) - fprintf(debugfp,"%12.3f API write timeout: MSR 0x%x\r\n", + fprintf(debugfp,"%12.3f Putchar timeout: MSR 0x%x\r\n", PIC_FullIndex(),Read_MSR()); #endif return false; diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index d1c9467e..48797316 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.69 2007-09-20 16:42:43 c2woody Exp $ */ +/* $Id: bios.cpp,v 1.70 2007-12-06 17:44:18 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" @@ -431,7 +431,6 @@ static Bitu INT14_Handler(void) // get result reg_ah=IO_ReadB(port+5); if(timeout) reg_ah |= 0x80; - reg_al=IO_ReadB(port+6); } CALLBACK_SCF(false); } @@ -445,7 +444,7 @@ static Bitu INT14_Handler(void) // switch modem lines on IO_WriteB(port+4,0x3); // wait for something - timeout = !serialports[reg_dx]->Getchar(&buffer,true, + timeout = !serialports[reg_dx]->Getchar(&buffer,®_ah,true, mem_readb(BIOS_COM1_TIMEOUT+reg_dx)*1000); // RTS off