Make mapper debug logic more verbose (but disable by default) experimental_memory_mapper_v2

Fri, 12 Apr 2013 12:36:28 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Fri, 12 Apr 2013 12:36:28 +0100
branch
experimental_memory_mapper_v2
changeset 141
8460d432606f
parent 140
1e4c45b144c4
child 142
cfa30b1cd92f

Make mapper debug logic more verbose (but disable by default)

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