src/memory.c

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