src/memory.c

changeset 55
ba6b8e570062
parent 53
e1693c4b8a0c
child 56
b3f309d46e97
     1.1 diff -r 57c6ef81ae81 -r ba6b8e570062 src/memory.c
     1.2 --- a/src/memory.c	Mon Dec 06 01:43:04 2010 +0000
     1.3 +++ b/src/memory.c	Sun Dec 12 23:47:35 2010 +0000
     1.4 @@ -238,8 +238,9 @@
     1.5  			case 0x050000:				// Phone status
     1.6  				break;
     1.7  			case 0x060000:				// DMA Count
     1.8 -				// U/OERR- is always inactive (bit set)
     1.9 -				data = (state.dma_count & 0x3fff) | 0x8000;
    1.10 +				// TODO: U/OERR- is always inactive (bit set)... or should it be = DMAEN+?
    1.11 +				// Bit 14 is always unused, so leave it set
    1.12 +				data = (state.dma_count & 0x3fff) | 0xC000;
    1.13  				handled = true;
    1.14  				break;
    1.15  			case 0x070000:				// Line Printer Status Register
    1.16 @@ -408,8 +409,9 @@
    1.17  			case 0x050000:				// Phone status
    1.18  				break;
    1.19  			case 0x060000:				// DMA Count
    1.20 -				// U/OERR- is always inactive (bit set)
    1.21 -				data = (state.dma_count & 0x3fff) | 0x8000;
    1.22 +				// TODO: U/OERR- is always inactive (bit set)... or should it be = DMAEN+?
    1.23 +				// Bit 14 is always unused, so leave it set
    1.24 +				data = (state.dma_count & 0x3fff) | 0xC000;
    1.25  				handled = true;
    1.26  				break;
    1.27  			case 0x070000:				// Line Printer Status Register
    1.28 @@ -758,8 +760,12 @@
    1.29  				state.dma_count = (value & 0x3FFF);
    1.30  				state.idmarw = ((value & 0x4000) == 0x4000);
    1.31  				state.dmaen = ((value & 0x8000) == 0x8000);
    1.32 -				state.dmaenb = state.dmaen;
    1.33  				printf("\tcount %04X, idmarw %d, dmaen %d\n", state.dma_count, state.idmarw, state.dmaen);
    1.34 +				// This handles the "dummy DMA transfer" mentioned in the docs
    1.35 +				// TODO: access check, peripheral access
    1.36 +				if (!state.idmarw)
    1.37 +					WR32(state.ram, mapAddr(address, false), state.ram_size - 1, 0xDEAD);
    1.38 +				state.dma_count++;
    1.39  				handled = true;
    1.40  				break;
    1.41  			case 0x070000:				// Line Printer Status Register
    1.42 @@ -961,8 +967,12 @@
    1.43  				state.dma_count = (value & 0x3FFF);
    1.44  				state.idmarw = ((value & 0x4000) == 0x4000);
    1.45  				state.dmaen = ((value & 0x8000) == 0x8000);
    1.46 -				state.dmaenb = state.dmaen;
    1.47  				printf("\tcount %04X, idmarw %d, dmaen %d\n", state.dma_count, state.idmarw, state.dmaen);
    1.48 +				// This handles the "dummy DMA transfer" mentioned in the docs
    1.49 +				// TODO: access check, peripheral access
    1.50 +				if (!state.idmarw)
    1.51 +					WR32(state.ram, mapAddr(address, false), state.ram_size - 1, 0xDEAD);
    1.52 +				state.dma_count++;
    1.53  				handled = true;
    1.54  				break;
    1.55  			case 0x070000:				// Line Printer Status Register