File:  [RetroPC.NET] / np2 / i286a / Attic / dmap.c
Revision 1.2: download - view: text, annotated - select for diffs
Mon Jan 5 18:31:25 2004 JST (21 years, 9 months ago) by yui
Branches: MAIN
CVS tags: VER_0_80, VER_0_79, VER_0_78, VER_0_77, VER_0_76, VER_0_75, VER_0_74, VER_0_73, HEAD
fix dmac (T.Yui)

#include	"compiler.h"
#include	"cpucore.h"
#include	"pccore.h"
#include	"iocore.h"
#include	"dmap.h"


void dmap_i286(void) {

	DMACH	ch;
	REG8	bit;

	if (dmac.working) {
		ch = dmac.dmach;
		bit = 1;
		do {
			if (dmac.working & bit) {
				// DMA working !
				if (!ch->leng.w) {
					dmac.stat |= bit;
					dmac.working &= ~bit;
					ch->proc.extproc(DMAEXT_END);
				}
				ch->leng.w--;

				switch(ch->mode & 0x0c) {
					case 0x00:		// verifty
						ch->proc.inproc();
						break;

					case 0x04:		// port->mem
						i286_memorywrite(ch->adrs.d, ch->proc.inproc());
						break;

					default:
						ch->proc.outproc(i286_memoryread(ch->adrs.d));
						break;
				}
				ch->adrs.d += ((ch->mode & 0x20)?-1:1);
			}
			ch++;
			bit <<= 1;
		} while(bit & 0x0f);
	}
}

void dmap_v30(void) {

	DMACH	ch;
	REG8	bit;

	if (dmac.working) {
		ch = dmac.dmach;
		bit = 1;
		do {
			if (dmac.working & bit) {
				// DMA working !
				if (!ch->leng.w) {
					dmac.stat |= bit;
					dmac.working &= ~bit;
					ch->proc.extproc(DMAEXT_END);
				}
				ch->leng.w--;

				switch(ch->mode & 0x0c) {
					case 0x00:		// verifty
						ch->proc.inproc();
						break;

					case 0x04:		// port->mem
						i286_memorywrite(ch->adrs.d, ch->proc.inproc());
						break;

					default:
						ch->proc.outproc(i286_memoryread(ch->adrs.d));
						break;
				}
				ch->adrs.w[DMA16_LOW] += ((ch->mode & 0x20)?-1:1);
			}
			ch++;
			bit <<= 1;
		} while(bit & 0x0f);
	}
}


RetroPC.NET-CVS <cvs@retropc.net>