add comments for some write-only regs, fix LOG_NOT_HANDLED_R(32) in read16, basic LED reg decoding

Fri, 03 Dec 2010 01:43:57 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Fri, 03 Dec 2010 01:43:57 +0000
changeset 46
7d14fab5e4aa
parent 45
caa916e038e5
child 47
c472ae8f44b2

add comments for some write-only regs, fix LOG_NOT_HANDLED_R(32) in read16, basic LED reg decoding

src/memory.c file | annotate | diff | revisions
src/state.h file | annotate | diff | revisions
     1.1 --- a/src/memory.c	Fri Dec 03 00:20:36 2010 +0000
     1.2 +++ b/src/memory.c	Fri Dec 03 01:43:57 2010 +0000
     1.3 @@ -271,11 +271,12 @@
     1.4  						break;
     1.5  				}
     1.6  				break;
     1.7 -			case 0x0A0000:				// Miscellaneous Control Register
     1.8 +			case 0x0A0000:				// Miscellaneous Control Register -- write only!
     1.9 +				handled = true;
    1.10  				break;
    1.11  			case 0x0B0000:				// TM/DIALWR
    1.12  				break;
    1.13 -			case 0x0C0000:				// Clear Status Register
    1.14 +			case 0x0C0000:				// Clear Status Register -- write only!
    1.15  				handled = true;
    1.16  				break;
    1.17  			case 0x0D0000:				// DMA Address Register
    1.18 @@ -432,11 +433,12 @@
    1.19  						break;
    1.20  				}
    1.21  				break;
    1.22 -			case 0x0A0000:				// Miscellaneous Control Register
    1.23 +			case 0x0A0000:				// Miscellaneous Control Register -- write only!
    1.24 +				handled = true;
    1.25  				break;
    1.26  			case 0x0B0000:				// TM/DIALWR
    1.27  				break;
    1.28 -			case 0x0C0000:				// Clear Status Register
    1.29 +			case 0x0C0000:				// Clear Status Register -- write only!
    1.30  				handled = true;
    1.31  				break;
    1.32  			case 0x0D0000:				// DMA Address Register
    1.33 @@ -505,7 +507,7 @@
    1.34  		}
    1.35  	}
    1.36  
    1.37 -	LOG_NOT_HANDLED_R(32);
    1.38 +	LOG_NOT_HANDLED_R(16);
    1.39  	return data;
    1.40  }
    1.41  
    1.42 @@ -602,11 +604,12 @@
    1.43  						break;
    1.44  				}
    1.45  				break;
    1.46 -			case 0x0A0000:				// Miscellaneous Control Register
    1.47 +			case 0x0A0000:				// Miscellaneous Control Register -- write only!
    1.48 +				handled = true;
    1.49  				break;
    1.50  			case 0x0B0000:				// TM/DIALWR
    1.51  				break;
    1.52 -			case 0x0C0000:				// Clear Status Register
    1.53 +			case 0x0C0000:				// Clear Status Register -- write only!
    1.54  				handled = true;
    1.55  				break;
    1.56  			case 0x0D0000:				// DMA Address Register
    1.57 @@ -758,6 +761,14 @@
    1.58  				}
    1.59  				break;
    1.60  			case 0x0A0000:				// Miscellaneous Control Register
    1.61 +				// TODO: handle the ctrl bits properly
    1.62 +				state.leds = (~value & 0xF00) >> 8;
    1.63 +				printf("LEDs: %s %s %s %s\n",
    1.64 +						(state.leds & 8) ? "R" : "-",
    1.65 +						(state.leds & 4) ? "G" : "-",
    1.66 +						(state.leds & 2) ? "Y" : "-",
    1.67 +						(state.leds & 1) ? "R" : "-");
    1.68 +				handled = true;
    1.69  				break;
    1.70  			case 0x0B0000:				// TM/DIALWR
    1.71  				break;
    1.72 @@ -924,6 +935,14 @@
    1.73  				}
    1.74  				break;
    1.75  			case 0x0A0000:				// Miscellaneous Control Register
    1.76 +				// TODO: handle the ctrl bits properly
    1.77 +				state.leds = (~value & 0xF00) >> 8;
    1.78 +				printf("LEDs: %s %s %s %s\n",
    1.79 +						(state.leds & 8) ? "R" : "-",
    1.80 +						(state.leds & 4) ? "G" : "-",
    1.81 +						(state.leds & 2) ? "Y" : "-",
    1.82 +						(state.leds & 1) ? "R" : "-");
    1.83 +				handled = true;
    1.84  				break;
    1.85  			case 0x0B0000:				// TM/DIALWR
    1.86  				break;
    1.87 @@ -1042,7 +1061,7 @@
    1.88  				handled = true;
    1.89  				break;
    1.90  			case 0x020000:				// Video RAM
    1.91 -				if (address > 0x427FFF) fprintf(stderr, "NOTE: WR8 to VideoRAM mirror, addr=%08X\n, data=0x%02X", address, value);
    1.92 +				if (address > 0x427FFF) fprintf(stderr, "NOTE: WR8 to VideoRAM mirror, addr=%08X, data=0x%02X\n", address, value);
    1.93  				WR8(state.vram, address, 0x7FFF, value);
    1.94  				handled = true;
    1.95  				break;
    1.96 @@ -1089,6 +1108,17 @@
    1.97  				}
    1.98  				break;
    1.99  			case 0x0A0000:				// Miscellaneous Control Register
   1.100 +				// TODO: handle the ctrl bits properly
   1.101 +				if ((address & 1) == 0)
   1.102 +					;// CTL bits
   1.103 +				else
   1.104 +					state.leds = (~value & 0xF);
   1.105 +				printf("LEDs: %s %s %s %s\n",
   1.106 +						(state.leds & 8) ? "R" : "-",
   1.107 +						(state.leds & 4) ? "G" : "-",
   1.108 +						(state.leds & 2) ? "Y" : "-",
   1.109 +						(state.leds & 1) ? "R" : "-");
   1.110 +				handled = true;
   1.111  				break;
   1.112  			case 0x0B0000:				// TM/DIALWR
   1.113  				break;
     2.1 --- a/src/state.h	Fri Dec 03 00:20:36 2010 +0000
     2.2 +++ b/src/state.h	Fri Dec 03 01:43:57 2010 +0000
     2.3 @@ -32,6 +32,9 @@
     2.4  	uint16_t	bsr0;				///< Bus Status Register 0
     2.5  	uint16_t	bsr1;				///< Bus Status Register 1
     2.6  
     2.7 +	// MISCELLANEOUS CONTROL REGISTER
     2.8 +	uint8_t		leds;				///< LED status, 1=on, in order red3/green2/yellow1/red0 from bit3 to bit0
     2.9 +
    2.10  	// GENERAL CONTROL REGISTER
    2.11  	/// GENCON.ROMLMAP -- false ORs the address with 0x800000, forcing the
    2.12  	/// 68010 to access ROM instead of RAM when booting. TRM page 2-36.