small bugfix by hal.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3054
This commit is contained in:
parent
7ae0f48fb5
commit
abbf10093f
4 changed files with 15 additions and 14 deletions
|
@ -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:
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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 <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue