src/memory.c

changeset 93
09e3ddeb869a
parent 84
0d903718da81
child 97
240e195e4bed
     1.1 --- a/src/memory.c	Thu Feb 10 00:07:59 2011 +0000
     1.2 +++ b/src/memory.c	Thu Feb 10 01:08:32 2011 +0000
     1.3 @@ -401,9 +401,15 @@
     1.4  					case 0x070000:		// [ef][7f]xxxx ==> 6850 Keyboard Controller
     1.5  						// TODO: figure out which sizes are valid (probably just 8 and 16)
     1.6  						// ENFORCE_SIZE_W(bits, address, 16, "KEYBOARD CONTROLLER");
     1.7 -						printf("KBD WR %02X => %04X\n", (address >> 1) & 3, data >> 8);
     1.8 -						keyboard_write(&state.kbd, (address >> 1) & 3, data >> 8);
     1.9 -						handled = true;
    1.10 +						if (bits == 8) {
    1.11 +							printf("KBD WR %02X => %02X\n", (address >> 1) & 3, data);
    1.12 +							keyboard_write(&state.kbd, (address >> 1) & 3, data);
    1.13 +							handled = true;
    1.14 +						} else if (bits == 16) {
    1.15 +							printf("KBD WR %02X => %04X\n", (address >> 1) & 3, data);
    1.16 +							keyboard_write(&state.kbd, (address >> 1) & 3, data >> 8);
    1.17 +							handled = true;
    1.18 +						}
    1.19  						break;
    1.20  				}
    1.21  		}
    1.22 @@ -552,9 +558,11 @@
    1.23  						// TODO: figure out which sizes are valid (probably just 8 and 16)
    1.24  						//ENFORCE_SIZE_R(bits, address, 16, "KEYBOARD CONTROLLER");
    1.25  						{
    1.26 -							uint16_t data = keyboard_read(&state.kbd, (address >> 1) & 3);
    1.27 -							data = (data << 8) + data;
    1.28 -							//printf("KBD RD %02X => %04X\n", (address >> 1) & 3, data);
    1.29 +							if (bits == 8) {
    1.30 +								return keyboard_read(&state.kbd, (address >> 1) & 3);
    1.31 +							} else {
    1.32 +								return keyboard_read(&state.kbd, (address >> 1) & 3) << 8;
    1.33 +							}
    1.34  							return data;
    1.35  						}
    1.36  						break;