src/memory.c

branch
experimental_memory_mapper_v2
changeset 141
8460d432606f
parent 140
1e4c45b144c4
child 144
609707511166
     1.1 --- a/src/memory.c	Fri Apr 12 12:34:32 2013 +0100
     1.2 +++ b/src/memory.c	Fri Apr 12 12:36:28 2013 +0100
     1.3 @@ -123,12 +123,16 @@
     1.4  	exit(-1);
     1.5  #endif
     1.6  
     1.7 +#ifdef MAPRAM_DEBUG_MESSAGES
     1.8  	uint16_t old_pagebits = MAP_PAGEBITS(addr);
     1.9 +#endif
    1.10  
    1.11  	// PS1 is always set on access
    1.12  	MAP_SET_PAGEBIT(addr, PAGE_BIT_PS1);
    1.13  
    1.14 +#ifdef MAPRAM_DEBUG_MESSAGES
    1.15  	uint16_t new_pagebit1 = MAP_PAGEBITS(addr);
    1.16 +#endif
    1.17  
    1.18  	// Update PS0
    1.19  	if (ps0_state) {
    1.20 @@ -137,6 +141,7 @@
    1.21  		MAP_CLR_PAGEBIT(addr, PAGE_BIT_PS0);
    1.22  	}
    1.23  
    1.24 +#ifdef MAPRAM_DEBUG_MESSAGES
    1.25  	uint16_t new_pagebit2 = MAP_PAGEBITS(addr);
    1.26  	switch (addr) {
    1.27  		case 0x000000:
    1.28 @@ -147,10 +152,23 @@
    1.29  		case 0x033000:
    1.30  		case 0x034000:
    1.31  		case 0x035000:
    1.32 -			LOG("Addr %08X MapNew %04X Pagebit update -- ps0 %d, %02X => %02X => %02X", addr, MAPRAM_ADDR(addr), ps0_state, old_pagebits, new_pagebit1, new_pagebit2);
    1.33 +			LOG("Addr %08X %s MapNew %04X Page %04X -- Pagebit update -- ps0 %d, old %s%s => %s%s => %s%s",
    1.34 +					addr,
    1.35 +					write ? "Wr" : "Rd",
    1.36 +					MAPRAM_ADDR(addr),
    1.37 +					MAP_ADDR_TO_PAGE(addr),
    1.38 +					ps0_state,
    1.39 +					old_pagebits & PAGE_BIT_PS0 ? "PS0" : "",
    1.40 +					old_pagebits & PAGE_BIT_PS1 ? "PS1" : "",
    1.41 +					new_pagebit1 & PAGE_BIT_PS0 ? "PS0" : "",
    1.42 +					new_pagebit1 & PAGE_BIT_PS1 ? "PS1" : "",
    1.43 +					new_pagebit2 & PAGE_BIT_PS0 ? "PS0" : "",
    1.44 +					new_pagebit2 & PAGE_BIT_PS1 ? "PS1" : ""
    1.45 +			   );
    1.46  		default:
    1.47  			break;
    1.48  	}
    1.49 +#endif // MAPRAM_DEBUG_MESSAGES
    1.50  }
    1.51  
    1.52  bool access_check_dma(void)