Edit I/O routines so R/Ws only log if the register is unknown

Wed, 01 Dec 2010 21:55:09 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Wed, 01 Dec 2010 21:55:09 +0000
changeset 21
e31d2ede6c6b
parent 20
bea459bc22a8
child 22
95a309c51464

Edit I/O routines so R/Ws only log if the register is unknown

src/main.c file | annotate | diff | revisions
     1.1 --- a/src/main.c	Wed Dec 01 21:29:44 2010 +0000
     1.2 +++ b/src/main.c	Wed Dec 01 21:55:09 2010 +0000
     1.3 @@ -23,8 +23,6 @@
     1.4  {
     1.5  	uint32_t data = 0xFFFFFFFF;
     1.6  
     1.7 -	printf("RD32 %08X %d", address, state.romlmap);
     1.8 -
     1.9  	// If ROMLMAP is set, force system to access ROM
    1.10  	if (!state.romlmap)
    1.11  		address |= 0x800000;
    1.12 @@ -41,9 +39,10 @@
    1.13  				((uint32_t)state.ram[address + 1] << 16) |
    1.14  				((uint32_t)state.ram[address + 2] << 8)  |
    1.15  				((uint32_t)state.ram[address + 3]));
    1.16 +	} else {
    1.17 +		// I/O register -- TODO
    1.18 +		printf("RD32 %08X [unknown I/O register]\n", address);
    1.19  	}
    1.20 -
    1.21 -	printf(" ==> %08X\n", data);
    1.22  	return data;
    1.23  }
    1.24  
    1.25 @@ -51,8 +50,6 @@
    1.26  {
    1.27  	uint16_t data = 0xFFFF;
    1.28  
    1.29 -	printf("RD16 %08X %d", address, state.romlmap);
    1.30 -
    1.31  	// If ROMLMAP is set, force system to access ROM
    1.32  	if (!state.romlmap)
    1.33  		address |= 0x800000;
    1.34 @@ -65,9 +62,11 @@
    1.35  		// RAM
    1.36  		data = ((state.ram[address + 0] << 8) |
    1.37  				(state.ram[address + 1]));
    1.38 +	} else {
    1.39 +		// I/O register -- TODO
    1.40 +		printf("RD16 %08X [unknown I/O register]\n", address);
    1.41  	}
    1.42  
    1.43 -	printf(" ==> %04X\n", data);
    1.44  	return data;
    1.45  }
    1.46  
    1.47 @@ -75,8 +74,6 @@
    1.48  {
    1.49  	uint8_t data = 0xFF;
    1.50  
    1.51 -	printf("RD 8 %08X %d ", address, state.romlmap);
    1.52 -
    1.53  	// If ROMLMAP is set, force system to access ROM
    1.54  	if (!state.romlmap)
    1.55  		address |= 0x800000;
    1.56 @@ -87,9 +84,11 @@
    1.57  	} else if (address < state.ram_size) {
    1.58  		// RAM access
    1.59  		data = state.ram[address + 0];
    1.60 +	} else {
    1.61 +		// I/O register -- TODO
    1.62 +		printf("RD 8 %08X [unknown I/O register]\n", address);
    1.63  	}
    1.64  
    1.65 -	printf("==> %02X\n", data);
    1.66  	return data;
    1.67  }
    1.68  
    1.69 @@ -100,8 +99,6 @@
    1.70  	if (!state.romlmap)
    1.71  		address |= 0x800000;
    1.72  
    1.73 -	printf("WR32 %08X %d %02X\n", address, state.romlmap, value);
    1.74 -
    1.75  	if ((address >= 0x800000) && (address <= 0xBFFFFF)) {
    1.76  		// ROM access
    1.77  		// TODO: bus error here? can't write to rom!
    1.78 @@ -113,7 +110,8 @@
    1.79  		state.ram[address + 3] =  value        & 0xff;
    1.80  	} else {
    1.81  		switch (address) {
    1.82 -			case 0xE43000:	state.romlmap = ((value & 0x8000) == 0x8000);
    1.83 +			case 0xE43000:	state.romlmap = ((value & 0x8000) == 0x8000); break;	// GCR3: ROMLMAP
    1.84 +			default:		printf("WR32 %08X ==> %02X\n", address, state.romlmap, value); break;
    1.85  		}
    1.86  	}
    1.87  }
    1.88 @@ -124,8 +122,6 @@
    1.89  	if (!state.romlmap)
    1.90  		address |= 0x800000;
    1.91  
    1.92 -	printf("WR16 %08X %d %02X\n", address, state.romlmap, value);
    1.93 -
    1.94  	if ((address >= 0x800000) && (address <= 0xBFFFFF)) {
    1.95  		// ROM access
    1.96  		// TODO: bus error here? can't write to rom!
    1.97 @@ -135,7 +131,8 @@
    1.98  		state.ram[address + 1] =  value        & 0xff;
    1.99  	} else {
   1.100  		switch (address) {
   1.101 -			case 0xE43000:	state.romlmap = ((value & 0x8000) == 0x8000);
   1.102 +			case 0xE43000:	state.romlmap = ((value & 0x8000) == 0x8000); break;	// GCR3: ROMLMAP
   1.103 +			default:		printf("WR16 %08X %d %02X\n", address, state.romlmap, value); break;
   1.104  		}
   1.105  	}
   1.106  }
   1.107 @@ -146,8 +143,6 @@
   1.108  	if (!state.romlmap)
   1.109  		address |= 0x800000;
   1.110  
   1.111 -	printf("WR 8 %08X %d %02X\n", address, state.romlmap, value);
   1.112 -
   1.113  	if ((address >= 0x800000) && (address <= 0xBFFFFF)) {
   1.114  		// ROM access
   1.115  		// TODO: bus error here? can't write to rom!
   1.116 @@ -155,7 +150,8 @@
   1.117  		state.ram[address] = value & 0xff;
   1.118  	} else {
   1.119  		switch (address) {
   1.120 -			case 0xE43000:	state.romlmap = ((value & 0x80) == 0x80);
   1.121 +			case 0xE43000:	state.romlmap = ((value & 0x80) == 0x80); break;	// GCR3: ROMLMAP
   1.122 +			default:		printf("WR 8 %08X %d %02X\n", address, state.romlmap, value); break;
   1.123  		}
   1.124  	}
   1.125  }