File:  [RetroPC.NET] / np2 / mem / dmax86.c
Revision 1.2: download - view: text, annotated - select for diffs
Fri May 13 15:20:35 2005 JST (20 years, 5 months ago) by yui
Branches: MAIN
CVS tags: VER_0_82_x64, VER_0_82, VER_0_81A, VER_0_81, HEAD
fix DMA use memory access macros (T.Yui)

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


void dmax86(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
						MEMP_WRITE8(ch->adrs.d, ch->proc.inproc());
						break;

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


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