src/mess/machine/tandy1t.c
| r5311 | r5312 | |
| 16 | 16 | 8x read 16 bit word at x |
| 17 | 17 | 30 cx 30 4x 16bit 00 write 16bit at x |
| 18 | 18 | */ |
| 19 | | static struct { |
| 19 | static struct |
| 20 | { |
| 20 | 21 | int state; |
| 21 | 22 | int clock; |
| 22 | 23 | UINT8 oper; |
| 23 | 24 | UINT16 data; |
| 24 | | struct { |
| 25 | struct |
| 26 | { |
| 25 | 27 | UINT8 low, high; |
| 26 | 28 | } ee[0x40]; /* only 0 to 4 used in hx, addressing seems to allow this */ |
| 27 | 29 | } eeprom={0}; |
| 28 | 30 | |
| 29 | 31 | NVRAM_HANDLER( tandy1000 ) |
| 30 | 32 | { |
| 31 | | if (file==NULL) { |
| 33 | if (file==NULL) |
| 34 | { |
| 32 | 35 | // init only |
| 33 | | } else if (read_or_write) { |
| 36 | } |
| 37 | else if (read_or_write) |
| 38 | { |
| 34 | 39 | mame_fwrite(file, eeprom.ee, sizeof(eeprom.ee)); |
| 35 | | } else { |
| 40 | } |
| 41 | else |
| 42 | { |
| 36 | 43 | mame_fread(file, eeprom.ee, sizeof(eeprom.ee)); |
| 37 | 44 | } |
| 38 | 45 | } |
| r5311 | r5312 | |
| 46 | 53 | |
| 47 | 54 | static void tandy1000_write_eeprom(UINT8 data) |
| 48 | 55 | { |
| 49 | | if (!eeprom.clock && (data&4) ) { |
| 56 | if (!eeprom.clock && (data&4) ) |
| 57 | { |
| 50 | 58 | // logerror("!!!tandy1000 eeprom %.2x %.2x\n",eeprom.state, data); |
| 51 | | switch (eeprom.state) { |
| 59 | switch (eeprom.state) |
| 60 | { |
| 52 | 61 | case 0: |
| 53 | 62 | if ((data&3)==0) eeprom.state++; |
| 54 | 63 | break; |
| r5311 | r5312 | |
| 74 | 83 | case 10: |
| 75 | 84 | eeprom.oper=(eeprom.oper<<1)|(data&1); |
| 76 | 85 | logerror("!!!tandy1000 eeprom %.2x\n",eeprom.oper); |
| 77 | | if ((eeprom.oper&0xc0)==0x80) { |
| 86 | if ((eeprom.oper&0xc0)==0x80) |
| 87 | { |
| 78 | 88 | eeprom.state=100; |
| 79 | 89 | eeprom.data=eeprom.ee[eeprom.oper&0x3f].low |
| 80 | 90 | |(eeprom.ee[eeprom.oper&0x3f].high<<8); |
| 81 | 91 | logerror("!!!tandy1000 eeprom read %.2x,%.4x\n",eeprom.oper,eeprom.data); |
| 82 | | } else if ((eeprom.oper&0xc0)==0x40) { |
| 92 | } |
| 93 | else if ((eeprom.oper&0xc0)==0x40) |
| 94 | { |
| 83 | 95 | eeprom.state=200; |
| 84 | | } else eeprom.state=0; |
| 96 | } |
| 97 | else |
| 98 | eeprom.state=0; |
| 85 | 99 | break; |
| 86 | 100 | |
| 87 | 101 | /* read 16 bit */ |
| r5311 | r5312 | |
| 142 | 156 | eeprom.clock=data&4; |
| 143 | 157 | } |
| 144 | 158 | |
| 145 | | static struct { |
| 159 | static struct |
| 160 | { |
| 146 | 161 | UINT8 data[8]; |
| 162 | |
| 163 | UINT8 bios_bank; /* I/O port FFEAh */ |
| 147 | 164 | } tandy={ {0}}; |
| 148 | 165 | |
| 149 | 166 | WRITE8_HANDLER ( pc_t1t_p37x_w ) |
| r5311 | r5312 | |
| 175 | 192 | bit 4 input eeprom data in |
| 176 | 193 | bit 3 output turbo mode |
| 177 | 194 | */ |
| 178 | | static struct { |
| 195 | static struct |
| 196 | { |
| 179 | 197 | UINT8 portb, portc; |
| 180 | 198 | } tandy_ppi= { 0 }; |
| 181 | 199 | |
| 182 | 200 | WRITE8_HANDLER ( tandy1000_pio_w ) |
| 183 | 201 | { |
| 184 | | switch (offset) { |
| 202 | switch (offset) |
| 203 | { |
| 185 | 204 | case 1: |
| 186 | 205 | tandy_ppi.portb = data; |
| 187 | 206 | pit8253_gate_w( devtag_get_device(space->machine, "pit8253"), 2, data & 1); |
| 188 | 207 | pc_speaker_set_spkrdata( space->machine, data & 0x02 ); |
| 189 | 208 | pc_keyb_set_clock(data&0x40); |
| 190 | | if ( data & 0x80 ) { |
| 209 | if ( data & 0x80 ) |
| 210 | { |
| 191 | 211 | pc_keyb_clear(); |
| 192 | 212 | } |
| 193 | 213 | break; |
| r5311 | r5312 | |
| 204 | 224 | READ8_HANDLER(tandy1000_pio_r) |
| 205 | 225 | { |
| 206 | 226 | int data=0xff; |
| 207 | | switch (offset) { |
| 227 | switch (offset) |
| 228 | { |
| 208 | 229 | case 0: |
| 209 | 230 | data = pc_keyb_read(); |
| 210 | 231 | break; |
| r5311 | r5312 | |
| 222 | 243 | } |
| 223 | 244 | |
| 224 | 245 | |
| 246 | static void tandy1000_set_bios_bank( running_machine *machine ) |
| 247 | { |
| 248 | memory_set_bankptr( machine, 11, memory_region(machine, "maincpu") + ( tandy.bios_bank & 0x07 ) * 0x10000 ); |
| 249 | } |
| 225 | 250 | |
| 251 | |
| 252 | MACHINE_RESET( tandy1000rl ) |
| 253 | { |
| 254 | MACHINE_RESET_CALL( pc ); |
| 255 | tandy.bios_bank = 6; |
| 256 | tandy1000_set_bios_bank( machine ); |
| 257 | } |
| 258 | |
| 259 | |
| 260 | READ8_HANDLER( tandy1000_bank_r ) |
| 261 | { |
| 262 | UINT8 data = 0xFF; |
| 263 | |
| 264 | logerror( "%s: tandy1000_bank_r: offset = %x\n", cpuexec_describe_context(space->machine), offset ); |
| 265 | |
| 266 | switch( offset ) |
| 267 | { |
| 268 | case 0x00: /* FFEA */ |
| 269 | data = tandy.bios_bank; |
| 270 | break; |
| 271 | } |
| 272 | |
| 273 | return data; |
| 274 | } |
| 275 | |
| 276 | |
| 277 | WRITE8_HANDLER( tandy1000_bank_w ) |
| 278 | { |
| 279 | logerror( "%s: tandy1000_bank_w: offset = %x, data = %02x\n", cpuexec_describe_context(space->machine), offset, data ); |
| 280 | |
| 281 | switch( offset ) |
| 282 | { |
| 283 | case 0x00: /* FFEA */ |
| 284 | tandy.bios_bank = data; |
| 285 | tandy1000_set_bios_bank( space->machine ); |
| 286 | break; |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | |
| 291 | |
| 226 | 292 | INPUT_PORTS_START( t1000_keyboard ) |
| 227 | 293 | PORT_START("pc_keyboard_0") |
| 228 | 294 | PORT_BIT ( 0x0001, 0x0000, IPT_UNUSED ) /* unused scancode 0 */ |
src/mess/drivers/pc.c
| r5311 | r5312 | |
| 380 | 380 | AM_RANGE(0xc8000, 0xc9fff) AM_ROM |
| 381 | 381 | AM_RANGE(0xca000, 0xcffff) AM_NOP |
| 382 | 382 | AM_RANGE(0xd0000, 0xeffff) AM_ROM AM_REGION("maincpu", 0x60000) /* This should become AM_ROMBANK(x) */ |
| 383 | AM_RANGE(0xd0000, 0xeffff) AM_ROMBANK(11) /* Banked part of the BIOS */ |
| 383 | 384 | AM_RANGE(0xf0000, 0xfffff) AM_ROM AM_REGION("maincpu", 0x70000) |
| 384 | 385 | ADDRESS_MAP_END |
| 385 | 386 | |
| r5311 | r5312 | |
| 401 | 402 | AM_RANGE(0x03d0, 0x03df) AM_READWRITE8(pc_T1T_r, pc_T1T_w, 0xffff) |
| 402 | 403 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 403 | 404 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 405 | AM_RANGE(0xffea, 0xffeb) AM_READWRITE8(tandy1000_bank_r, tandy1000_bank_w, 0xffff) |
| 404 | 406 | ADDRESS_MAP_END |
| 405 | 407 | |
| 406 | 408 | |
| r5311 | r5312 | |
| 1945 | 1947 | MDRV_CPU_PC(tandy1000_16, tandy1000_16, I8086, XTAL_28_63636MHz / 3, pc_frame_interrupt) |
| 1946 | 1948 | |
| 1947 | 1949 | MDRV_MACHINE_START(pc) |
| 1948 | | MDRV_MACHINE_RESET(pc) |
| 1950 | MDRV_MACHINE_RESET(tandy1000rl) |
| 1949 | 1951 | |
| 1950 | 1952 | MDRV_PIT8253_ADD( "pit8253", ibm5150_pit8253_config ) |
| 1951 | 1953 | |
| r5311 | r5312 | |
| 2651 | 2653 | |
| 2652 | 2654 | // pcjr (better graphics, better sound) |
| 2653 | 2655 | COMP( 1983, ibmpcjr, ibm5150, 0, ibmpcjr, tandy1t, pcjr, pcjr, "International Business Machines", "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS ) |
| 2656 | |
| 2657 | // tandy 1000 |
| 2654 | 2658 | COMP( 1987, t1000hx, ibm5150, 0, t1000hx, tandy1t, t1000hx, ibm5160, "Tandy Radio Shack", "Tandy 1000HX", 0) |
| 2655 | 2659 | COMP( 1987, t1000sx, ibm5150, 0, t1000hx, tandy1t, t1000hx, ibm5160, "Tandy Radio Shack", "Tandy 1000SX", GAME_NOT_WORKING) |
| 2656 | 2660 | COMP( 1989, t1000rl, ibm5150, 0, t1000_16, tandy1t, t1000hx, ibm5160, "Tandy Radio Shack", "Tandy 1000RL", GAME_NOT_WORKING ) |