From 055e02bb411060b9560a5466820bfb141b3ab120 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sun, 10 Nov 2002 00:16:34 +0000 Subject: [PATCH] Added status bit. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@491 --- src/hardware/dma.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hardware/dma.cpp b/src/hardware/dma.cpp index eb317d42..1dba7e3d 100644 --- a/src/hardware/dma.cpp +++ b/src/hardware/dma.cpp @@ -91,6 +91,11 @@ static Bit8u read_dma(Bit32u port) { } cont->flipflop=!cont->flipflop; break; + case 0x08: /* Read Status */ + ret=cont->status_reg; + cont->status_reg&=0xf; /* Clear lower 4 bits on read */ + break; + default: LOG_WARN("DMA:Unhandled read from %d",port); } @@ -128,6 +133,8 @@ static void write_dma(Bit32u port,Bit8u val) { case 0x09: /* Request Register */ if (val&4) { /* Set Request bit */ + Bitu channel = val & 0x03; + cont->status_reg |= (1 << (channel+4)); } else { Bitu channel = val & 0x03; cont->status_reg &= ~(1 << (channel+4)); @@ -183,13 +190,15 @@ Bit16u DMA_8_Read(Bit32u dmachan,Bit8u * buffer,Bit16u count) { chan->current_address=chan->base_address; DMA_DEBUG("DMA:Transfer from %d size %d",(chan->page << 16)+chan->base_address,chan->current_count); } - if (chan->current_count>=count) { + if (chan->current_count>count) { MEM_BlockRead(chan->address,buffer,count); chan->address+=count; chan->current_address+=count; chan->current_count-=count; return count; } else { + /* Set the end of counter bit */ + dma[0].status_reg|=(1 << dmachan); /* Copy remaining piece of first buffer */ MEM_BlockRead(chan->address,buffer,chan->current_count); buffer+=chan->current_count;