src/emu/machine/pit8253.c
| r2942 | r2943 | |
| 18 | 18 | * |
| 19 | 19 | *****************************************************************************/ |
| 20 | 20 | |
| 21 | | #include <math.h> |
| 22 | 21 | #include "driver.h" |
| 23 | | #include "devconv.h" |
| 24 | 22 | #include "machine/pit8253.h" |
| 25 | 23 | |
| 26 | 24 | |
| r2942 | r2943 | |
| 37 | 35 | #define LOG1(msg) do { if (VERBOSE >= 1) logerror msg; } while (0) |
| 38 | 36 | #define LOG2(msg) do { if (VERBOSE >= 2) logerror msg; } while (0) |
| 39 | 37 | |
| 40 | | |
| 41 | | #define TIMER_TIME_NEVER ((UINT64) -1) |
| 42 | | |
| 43 | 38 | #define CYCLES_NEVER ((UINT32) -1) |
| 44 | 39 | |
| 45 | 40 | /* device types */ |
| r2942 | r2943 | |
| 57 | 52 | |
| 58 | 53 | struct pit8253_timer |
| 59 | 54 | { |
| 55 | int index; /* index number of the timer */ |
| 60 | 56 | double clockin; /* input clock frequency in Hz */ |
| 57 | int clock; /* clock signal when clockin is 0 */ |
| 61 | 58 | |
| 62 | 59 | pit8253_output_changed_func output_changed; /* callback function for when output changes */ |
| 63 | | pit8253_frequency_changed_func frequency_changed; /* callback function for when output frequency changes */ |
| 64 | 60 | |
| 65 | 61 | attotime last_updated; /* time when last updated */ |
| 66 | 62 | |
| 67 | | emu_timer *outputtimer; /* MAME timer for output change callback */ |
| 68 | | emu_timer *freqtimer; /* MAME timer for output frequency change callback */ |
| 63 | emu_timer *updatetimer; /* MAME timer to process updates */ |
| 69 | 64 | |
| 65 | UINT8 programmed; /* Has this counter been programmed by writing to the control word */ |
| 70 | 66 | UINT16 value; /* current counter value ("CE" in Intel docs) */ |
| 71 | 67 | UINT16 latch; /* latched counter value ("OL" in Intel docs) */ |
| 72 | 68 | UINT16 count; /* new counter value ("CR" in Intel docs) */ |
| r2942 | r2943 | |
| 84 | 80 | INT32 phase; /* see phase definition tables in simulate2(), below */ |
| 85 | 81 | |
| 86 | 82 | UINT32 cycles_to_output; /* cycles until output callback called */ |
| 87 | | UINT32 cycles_to_freq; /* cycles until frequency callback called */ |
| 88 | | UINT32 freq_count; /* counter period for periodic modes, 0 if counter non-periodic */ |
| 89 | 83 | }; |
| 90 | 84 | |
| 91 | 85 | typedef struct _pit8253_t pit8253_t; |
| r2942 | r2943 | |
| 211 | 205 | } |
| 212 | 206 | |
| 213 | 207 | |
| 214 | | static double get_frequency(struct pit8253_timer *timer) |
| 208 | /* Counter loading: transfer of a count from the CR to the CE */ |
| 209 | static void load_counter_value(const device_config *device, struct pit8253_timer *timer) |
| 215 | 210 | { |
| 216 | | LOG2(("pit8253: get_frequency() : %lf\n",(double)(timer->freq_count == 0 ? 0 : timer->clockin / timer->freq_count))); |
| 217 | | return timer->freq_count == 0 ? 0 : timer->clockin / timer->freq_count; |
| 218 | | } |
| 219 | | |
| 220 | | |
| 221 | | /* Call the frequency callback in "cycles" cycles */ |
| 222 | | static void freq_callback_in(struct pit8253_timer *timer,UINT32 cycles) |
| 223 | | { |
| 224 | | LOG2(("pit8253: freq_callback_in(): %d cycles\n",cycles)); |
| 225 | | |
| 226 | | if (timer->frequency_changed == NULL) |
| 227 | | { |
| 228 | | return; |
| 229 | | } |
| 230 | | |
| 231 | | if (timer->clockin == 0 || cycles == CYCLES_NEVER) |
| 232 | | { |
| 233 | | timer_reset(timer->freqtimer,attotime_never); |
| 234 | | } |
| 235 | | else |
| 236 | | { |
| 237 | | timer_reset(timer->freqtimer,double_to_attotime(cycles / timer->clockin)); |
| 238 | | } |
| 239 | | timer->cycles_to_freq = cycles; |
| 240 | | } |
| 241 | | |
| 242 | | |
| 243 | | static void set_freq_count(const device_config *device, struct pit8253_timer *timer) |
| 244 | | { |
| 245 | | int mode = CTRL_MODE(timer->control); |
| 246 | | UINT32 freq_count; |
| 247 | | |
| 248 | | if ((mode == 2 || mode == 3) && timer->gate != 0 && timer->phase != 0) |
| 249 | | { |
| 250 | | freq_count = adjusted_count(CTRL_BCD(timer->control),timer->count); |
| 251 | | } |
| 252 | | else |
| 253 | | { |
| 254 | | freq_count = 0; |
| 255 | | } |
| 256 | | |
| 257 | | if (freq_count != timer->freq_count) |
| 258 | | { |
| 259 | | timer->freq_count = freq_count; |
| 260 | | if (timer->frequency_changed != NULL) |
| 261 | | { |
| 262 | | timer->frequency_changed(device, get_frequency(timer)); |
| 263 | | freq_callback_in(timer,CYCLES_NEVER); |
| 264 | | } |
| 265 | | } |
| 266 | | |
| 267 | | LOG2(("pit8253: set_freq_count() : %d\n",freq_count)); |
| 268 | | } |
| 269 | | |
| 270 | | |
| 271 | | /* Call the output callback in "cycles" cycles */ |
| 272 | | static void trigger_countdown(const device_config *device, struct pit8253_timer *timer) |
| 273 | | { |
| 274 | | LOG2(("pit8253: trigger_countdown()\n")); |
| 275 | | |
| 276 | | timer->phase = 1; |
| 277 | 211 | timer->value = timer->count; |
| 278 | | if (CTRL_MODE(timer->control) == 3 && timer->output == 0) |
| 279 | | timer->value &= 0xfffe; |
| 280 | | |
| 281 | | set_freq_count(device, timer); |
| 212 | timer->null_count = 1; |
| 213 | if ( CTRL_MODE(timer->control) == 3 && timer->output == 0) |
| 214 | timer->value &= 0xfffe; |
| 282 | 215 | } |
| 283 | 216 | |
| 284 | 217 | |
| r2942 | r2943 | |
| 297 | 230 | |
| 298 | 231 | /* This emulates timer "timer" for "elapsed_cycles" cycles and assumes no |
| 299 | 232 | callbacks occur during that time. */ |
| 300 | | static void simulate2(const device_config *device, struct pit8253_timer *timer,UINT64 elapsed_cycles) |
| 233 | static void simulate2(const device_config *device, struct pit8253_timer *timer, INT64 elapsed_cycles) |
| 301 | 234 | { |
| 302 | 235 | UINT32 adjusted_value; |
| 303 | 236 | int bcd = CTRL_BCD(timer->control); |
| 304 | 237 | int mode = CTRL_MODE(timer->control); |
| 305 | 238 | int cycles_to_output = 0; |
| 306 | 239 | |
| 307 | | if (timer->cycles_to_freq != CYCLES_NEVER) |
| 308 | | { |
| 309 | | timer->cycles_to_freq -= elapsed_cycles; |
| 310 | | } |
| 240 | LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x\n", |
| 241 | (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,timer->gate,timer->output,timer->value)); |
| 311 | 242 | |
| 312 | | LOG2(("pit8253: simulate2(): simulating %d cycles in mode %d, bcd = %d, phase = %d, gate = %d, value = 0x%04x\n", |
| 313 | | (int)elapsed_cycles,mode,bcd,timer->phase,timer->gate,timer->value)); |
| 314 | | |
| 315 | 243 | switch (mode) { |
| 316 | 244 | case 0: |
| 317 | 245 | /* Mode 0: (Interrupt on Terminal Count) |
| r2942 | r2943 | |
| 333 | 261 | |
| 334 | 262 | Gate level sensitive only. Low disables counting, high enables it. */ |
| 335 | 263 | |
| 336 | | if (timer->gate == 0 || timer->phase == 0) |
| 264 | if (timer->phase == 0) |
| 337 | 265 | { |
| 338 | 266 | cycles_to_output = CYCLES_NEVER; |
| 339 | 267 | } |
| r2942 | r2943 | |
| 341 | 269 | { |
| 342 | 270 | if (elapsed_cycles > 0 && timer->phase == 1) |
| 343 | 271 | { |
| 272 | /* Counter load cycle */ |
| 344 | 273 | --elapsed_cycles; |
| 345 | 274 | timer->phase = 2; |
| 275 | load_counter_value( device, timer ); |
| 346 | 276 | } |
| 347 | 277 | |
| 348 | | if (timer->phase == 2) |
| 278 | if ( timer->gate == 0 ) |
| 349 | 279 | { |
| 350 | | adjusted_value = adjusted_count(bcd,timer->value); |
| 351 | | if (elapsed_cycles < adjusted_value) |
| 280 | cycles_to_output = CYCLES_NEVER; |
| 281 | } |
| 282 | else |
| 283 | { |
| 284 | if (timer->phase == 2) |
| 352 | 285 | { |
| 353 | | /* Counter didn't wrap */ |
| 354 | | decrease_counter_value(timer,elapsed_cycles); |
| 286 | adjusted_value = adjusted_count(bcd,timer->value); |
| 287 | if (elapsed_cycles >= adjusted_value) |
| 288 | { |
| 289 | /* Counter wrapped, output goes high */ |
| 290 | elapsed_cycles -= adjusted_value; |
| 291 | timer->phase = 3; |
| 292 | timer->value = 0; |
| 293 | set_output( device, timer, 1 ); |
| 294 | } |
| 355 | 295 | } |
| 356 | | else |
| 296 | |
| 297 | decrease_counter_value(timer,elapsed_cycles); |
| 298 | |
| 299 | switch( timer->phase ) |
| 357 | 300 | { |
| 358 | | /* Counter wrapped, output goes high */ |
| 359 | | elapsed_cycles -= adjusted_value; |
| 360 | | timer->phase = 3; |
| 361 | | timer->value = 0; |
| 301 | case 1: cycles_to_output = 1; break; |
| 302 | case 2: cycles_to_output = adjusted_count( bcd, timer->value ); break; |
| 303 | case 3: cycles_to_output = adjusted_count( bcd, timer->value ); break; |
| 362 | 304 | } |
| 363 | 305 | } |
| 364 | | |
| 365 | | if (timer->phase == 3) |
| 366 | | { |
| 367 | | decrease_counter_value(timer,elapsed_cycles); |
| 368 | | cycles_to_output = CYCLES_NEVER; |
| 369 | | } |
| 370 | | else |
| 371 | | { |
| 372 | | cycles_to_output = adjusted_count(bcd,timer->value) + (timer->phase == 1 ? 1 : 0); |
| 373 | | } |
| 374 | 306 | } |
| 375 | | |
| 376 | | set_output(device, timer, timer->phase == 3 ? 1 : 0); |
| 377 | 307 | break; |
| 378 | 308 | |
| 379 | 309 | |
| 380 | 310 | case 1: |
| 381 | 311 | /* Mode 1: (Hardware Retriggerable One-Shot a.k.a. Programmable One-Shot) |
| 382 | 312 | |
| 383 | | --+ +------------------ |
| 384 | | | | |
| 385 | | +-------+ |
| 386 | | <- n -> |
| 313 | -----+ +------------------ |
| 314 | | | |
| 315 | +-------+ |
| 316 | <- n -> |
| 387 | 317 | |
| 388 | 318 | ^ |
| 389 | 319 | +- trigger |
| 390 | 320 | |
| 391 | 321 | phase|output|length |value|next|comment |
| 392 | 322 | -----+------+--------+-----+----+---------------------------------- |
| 393 | | 0|high |infinity|0..1 |1 |counting down |
| 394 | | 1|low |n |n..1 |0 |counting down |
| 323 | 0|high |infinity| |1 |counting down |
| 324 | 1|high |1 | |2 |internal delay to load counter |
| 325 | 2|low |n |n..1 |3 |counting down |
| 326 | 3|high |infinity|0..1 |3 |counting down |
| 395 | 327 | |
| 396 | 328 | Gate rising-edge sensitive only. |
| 397 | 329 | Rising edge initiates counting and resets output after next clock. */ |
| 398 | 330 | |
| 399 | | adjusted_value = adjusted_count(bcd,timer->value); |
| 400 | | if (elapsed_cycles < adjusted_value) |
| 331 | if ( elapsed_cycles > 0 && timer->phase == 1 ) |
| 401 | 332 | { |
| 402 | | /* Counter didn't wrap */ |
| 403 | | decrease_counter_value(timer,elapsed_cycles); |
| 404 | | cycles_to_output = (timer->phase == 0 ? CYCLES_NEVER : adjusted_count(bcd,timer->value)); |
| 333 | /* Counter load cycle, output goes low */ |
| 334 | --elapsed_cycles; |
| 335 | timer->phase = 2; |
| 336 | load_counter_value( device, timer ); |
| 337 | set_output( device, timer, 0 ); |
| 405 | 338 | } |
| 406 | | else |
| 339 | |
| 340 | if ( timer->phase == 2 ) |
| 407 | 341 | { |
| 408 | | /* Counter wrapped, output goes high */ |
| 409 | | elapsed_cycles -= adjusted_value; |
| 410 | | timer->phase = 0; |
| 411 | | timer->value = 0; |
| 412 | | decrease_counter_value(timer,elapsed_cycles); |
| 413 | | cycles_to_output = CYCLES_NEVER; |
| 342 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 343 | if ( elapsed_cycles >= adjusted_value ) |
| 344 | { |
| 345 | /* Counter wrapped, output goes high */ |
| 346 | timer->phase = 3; |
| 347 | set_output( device, timer, 1 ); |
| 348 | } |
| 414 | 349 | } |
| 415 | | set_output(device, timer, timer->phase == 0 ? 1 : 0); |
| 350 | |
| 351 | decrease_counter_value( timer, elapsed_cycles ); |
| 352 | |
| 353 | switch( timer->phase ) |
| 354 | { |
| 355 | case 1: cycles_to_output = 1; break; |
| 356 | case 2: cycles_to_output = adjusted_count( bcd, timer->value ); break; |
| 357 | default: cycles_to_output = CYCLES_NEVER; break; |
| 358 | } |
| 416 | 359 | break; |
| 417 | 360 | |
| 418 | 361 | |
| r2942 | r2943 | |
| 422 | 365 | --------------+ +---------+ +---- |
| 423 | 366 | | | | | |
| 424 | 367 | +-+ +-+ |
| 425 | | <- n -X- n -> |
| 368 | <- n -X- n -> |
| 426 | 369 | <1> |
| 427 | | ^ |
| 428 | | +- counter load or trigger |
| 370 | ^ |
| 371 | +- counter load or trigger |
| 429 | 372 | |
| 430 | 373 | phase|output|length |value|next|comment |
| 431 | 374 | -----+------+--------+-----+----+---------------------------------- |
| 432 | 375 | 0|high |infinity| |1 |waiting for count |
| 433 | | 1|v!=1 |n |n..1 |1 |counting down |
| 376 | 1|high |1 | |2 |internal delay to load counter |
| 377 | 2|high |n |n..2 |3 |counting down |
| 378 | 3|low |1 |1 |2 |reload counter |
| 434 | 379 | |
| 435 | 380 | Counter rewrite has no effect until repeated |
| 436 | 381 | |
| r2942 | r2943 | |
| 447 | 392 | } |
| 448 | 393 | else |
| 449 | 394 | { |
| 450 | | adjusted_value = adjusted_count(bcd,timer->value); |
| 451 | | if (elapsed_cycles < adjusted_value) |
| 395 | if ( elapsed_cycles > 0 && timer->phase == 1 ) |
| 452 | 396 | { |
| 453 | | /* Counter didn't wrap */ |
| 454 | | decrease_counter_value(timer,elapsed_cycles); |
| 397 | --elapsed_cycles; |
| 398 | timer->phase = 2; |
| 399 | load_counter_value( device, timer ); |
| 455 | 400 | } |
| 456 | | else |
| 401 | |
| 402 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 403 | |
| 404 | do |
| 457 | 405 | { |
| 458 | | /* Counter wrapped around one or more times */ |
| 459 | | elapsed_cycles -= adjusted_value; |
| 460 | | trigger_countdown(device, timer); |
| 461 | | decrease_counter_value(timer,elapsed_cycles % adjusted_count(bcd,timer->count)); |
| 406 | if ( timer->phase == 2 ) |
| 407 | { |
| 408 | if ( elapsed_cycles + 1 >= adjusted_value ) |
| 409 | { |
| 410 | /* Coounter hits 1, output goes low */ |
| 411 | timer->phase = 3; |
| 412 | set_output( device, timer, 0 ); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | if ( elapsed_cycles > 0 && timer->phase == 3 ) |
| 417 | { |
| 418 | /* Reload counter, output goes high */ |
| 419 | --elapsed_cycles; |
| 420 | timer->phase = 2; |
| 421 | load_counter_value( device, timer ); |
| 422 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 423 | set_output( device, timer, 1 ); |
| 424 | } |
| 462 | 425 | } |
| 463 | | cycles_to_output = (timer->value == 1 ? 1 : (adjusted_count(bcd,timer->value) - 1)); |
| 426 | while( elapsed_cycles >= adjusted_value ); |
| 464 | 427 | |
| 465 | | set_output(device, timer, timer->value != 1 ? 1 : 0); |
| 428 | /* Calculate counter value */ |
| 429 | decrease_counter_value(timer,elapsed_cycles); |
| 430 | |
| 431 | switch( timer->phase ) |
| 432 | { |
| 433 | case 1: cycles_to_output = 1; break; |
| 434 | default: cycles_to_output = (timer->value == 1 ? 1 : (adjusted_count(bcd,timer->value) - 1)); |
| 435 | } |
| 466 | 436 | } |
| 467 | 437 | break; |
| 468 | 438 | |
| r2942 | r2943 | |
| 470 | 440 | case 3: |
| 471 | 441 | /* Mode 3: (Square Wave Generator) |
| 472 | 442 | |
| 473 | | ----------------+ +-----------+ +---- |
| 474 | | | | | | |
| 475 | | +-----------+ +-----------+ |
| 476 | | <- (n+1)/2 -X- n/2 -> |
| 477 | | ^ |
| 478 | | +- counter load or trigger |
| 443 | ----------------+ +-----------+ +---- |
| 444 | | | | | |
| 445 | +-----------+ +-----------+ |
| 446 | <- (n+1)/2 -X- n/2 -> |
| 447 | ^ |
| 448 | +- counter load or trigger |
| 479 | 449 | |
| 480 | 450 | phase|output|length |value|next|comment |
| 481 | | -----+------+--------+-----+----+---------------------------------- |
| 482 | | 0|high |infinity| |1 |waiting for count |
| 483 | | 1| |infinity|n..0 |1 |counting down double speed |
| 451 | -----+------+--------+-----+----+---------------------------------- |
| 452 | 0|high |infinity| |1 |waiting for count |
| 453 | 1|high |1 | |2 |internal delay to load counter |
| 454 | 2|high |n/2(+1) |n..0 |3 |counting down double speed, reload counter |
| 455 | 3|low |n/2 |n..0 |2 |counting down double speed, reload counter |
| 484 | 456 | |
| 485 | | Counter rewrite has no effect until repeated (output falling or rising) |
| 457 | Counter rewrite has no effect until repeated (output falling or rising) |
| 486 | 458 | |
| 487 | | Gate rising-edge and level sensitive. |
| 488 | | Gate low disables counting and sets output immediately high. |
| 489 | | Rising-edge reloads count and initiates counting |
| 490 | | Gate high enables counting. */ |
| 459 | Gate rising-edge and level sensitive. |
| 460 | Gate low disables counting and sets output immediately high. |
| 461 | Rising-edge reloads count and initiates counting |
| 462 | Gate high enables counting. */ |
| 491 | 463 | |
| 492 | 464 | if (timer->gate == 0 || timer->phase == 0) |
| 493 | 465 | { |
| r2942 | r2943 | |
| 497 | 469 | } |
| 498 | 470 | else |
| 499 | 471 | { |
| 500 | | adjusted_value = adjusted_count(bcd,timer->value); |
| 501 | | if ((elapsed_cycles<<1) < adjusted_value) |
| 472 | if ( elapsed_cycles > 0 && timer->phase == 1 ) |
| 502 | 473 | { |
| 503 | | /* Counter didn't wrap around */ |
| 504 | | decrease_counter_value(timer,elapsed_cycles<<1); |
| 474 | --elapsed_cycles; |
| 475 | timer->phase = 2; |
| 476 | load_counter_value( device, timer ); |
| 505 | 477 | } |
| 506 | | else |
| 507 | | { |
| 508 | | /* Counter wrapped around one or more times */ |
| 509 | | elapsed_cycles -= ((adjusted_value+1)>>1); |
| 510 | 478 | |
| 511 | | set_output(device, timer, 1 - timer->output); |
| 512 | | trigger_countdown(device, timer); |
| 479 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 513 | 480 | |
| 514 | | elapsed_cycles %= adjusted_count(bcd,timer->count); |
| 515 | | adjusted_value = adjusted_count(bcd,timer->value); |
| 516 | | if ((elapsed_cycles<<1) >= adjusted_value) |
| 481 | do |
| 482 | { |
| 483 | if ( timer->phase == 2 && elapsed_cycles >= ( ( adjusted_value + 1 ) >> 1 ) ) |
| 517 | 484 | { |
| 518 | | /* Counter wrapped around an even number of times */ |
| 519 | | elapsed_cycles -= ((adjusted_value+1)>>1); |
| 485 | /* High phase expired, output goes low */ |
| 486 | elapsed_cycles -= ( ( adjusted_value + 1 ) >> 1 ); |
| 487 | timer->phase = 3; |
| 488 | load_counter_value( device, timer ); |
| 489 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 490 | set_output( device, timer, 0 ); |
| 491 | } |
| 520 | 492 | |
| 521 | | set_output(device, timer, 1 - timer->output); |
| 522 | | trigger_countdown(device, timer); |
| 493 | if ( timer->phase == 3 && elapsed_cycles >= ( adjusted_value >> 1 ) ) |
| 494 | { |
| 495 | /* Low phase expired, output goes high */ |
| 496 | elapsed_cycles -= ( adjusted_value >> 1 ); |
| 497 | timer->phase = 2; |
| 498 | load_counter_value( device, timer ); |
| 499 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 500 | set_output( device, timer, 1 ); |
| 523 | 501 | } |
| 524 | | decrease_counter_value(timer,elapsed_cycles<<1); |
| 525 | 502 | } |
| 526 | | cycles_to_output = (adjusted_count(bcd,timer->value) + 1) >> 1; |
| 503 | while( ( timer->phase == 2 && elapsed_cycles >= ( ( adjusted_value + 1 ) >> 1 ) ) || |
| 504 | ( timer->phase == 3 && elapsed_cycles >= ( adjusted_value >> 1 ) ) ); |
| 505 | |
| 506 | decrease_counter_value(timer,elapsed_cycles<<1); |
| 507 | |
| 508 | switch( timer->phase ) |
| 509 | { |
| 510 | case 1: cycles_to_output = 1; break; |
| 511 | case 2: cycles_to_output = ( adjusted_count( bcd, timer->value ) + 1 ) >> 1; break; |
| 512 | case 3: cycles_to_output = adjusted_count( bcd, timer->value ) >> 1; break; |
| 513 | } |
| 527 | 514 | } |
| 528 | 515 | break; |
| 529 | 516 | |
| r2942 | r2943 | |
| 531 | 518 | case 4: |
| 532 | 519 | case 5: |
| 533 | 520 | /* Mode 4: (Software Trigger Strobe) |
| 534 | | Mode 5: (Hardware Trigger Strobe) |
| 521 | Mode 5: (Hardware Trigger Strobe) |
| 535 | 522 | |
| 536 | | --------------+ +-------------------- |
| 537 | | | | |
| 538 | | +-+ |
| 539 | | <- n+1 -> |
| 540 | | ^ <1> |
| 541 | | +- counter load (mode 4) or trigger (mode 5) |
| 523 | --------------+ +-------------------- |
| 524 | | | |
| 525 | +-+ |
| 526 | <- n+1 -> |
| 527 | ^ <1> |
| 528 | +- counter load (mode 4) or trigger (mode 5) |
| 542 | 529 | |
| 543 | | phase|output|length |value|next|comment |
| 544 | | -----+------+--------+-----+----+---------------------------------- |
| 545 | | 0|high |infinity|0..1 |0 |waiting for count |
| 546 | | 1|high |1 | |2 |internal delay when counter loaded |
| 547 | | 2|high |n |n..1 |3 |counting down |
| 548 | | 3|low |1 |0 |0 |strobe |
| 530 | phase|output|length |value|next|comment |
| 531 | -----+------+--------+-----+----+---------------------------------- |
| 532 | 0|high |infinity|0..1 |0 |waiting for count/counting down |
| 533 | 1|high |1 | |2 |internal delay when counter loaded |
| 534 | 2|high |n |n..1 |3 |counting down |
| 535 | 3|low |1 |0 |0 |strobe |
| 549 | 536 | |
| 550 | | Mode 4 only: counter rewrite loads new counter |
| 551 | | Mode 5 only: count not reloaded immediately. |
| 552 | | Mode control write doesn't stop count but sets output high |
| 537 | Mode 4 only: counter rewrite loads new counter |
| 538 | Mode 5 only: count not reloaded immediately. |
| 539 | Mode control write doesn't stop count but sets output high |
| 553 | 540 | |
| 554 | | Mode 4 only: Gate level sensitive only. Low disables counting, high enables it. |
| 555 | | Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */ |
| 541 | Mode 4 only: Gate level sensitive only. Low disables counting, high enables it. |
| 542 | Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */ |
| 556 | 543 | |
| 557 | 544 | if (timer->gate == 0 && mode == 4) |
| 558 | 545 | { |
| r2942 | r2943 | |
| 564 | 551 | { |
| 565 | 552 | --elapsed_cycles; |
| 566 | 553 | timer->phase = 2; |
| 554 | load_counter_value( device, timer ); |
| 567 | 555 | } |
| 568 | 556 | |
| 557 | if ( timer->value == 0 && timer->phase == 2 ) |
| 558 | adjusted_value = 0; |
| 559 | else |
| 560 | adjusted_value = adjusted_count( bcd, timer->value ); |
| 561 | |
| 562 | if ( timer->phase == 2 && elapsed_cycles >= adjusted_value ) |
| 563 | { |
| 564 | /* Counter has hit zero, set output to low */ |
| 565 | elapsed_cycles -= adjusted_value; |
| 566 | timer->phase = 3; |
| 567 | timer->value = 0; |
| 568 | set_output( device, timer, 0 ); |
| 569 | } |
| 570 | |
| 569 | 571 | if (elapsed_cycles > 0 && timer->phase == 3) |
| 570 | 572 | { |
| 571 | 573 | --elapsed_cycles; |
| 572 | 574 | timer->phase = 0; |
| 573 | 575 | decrease_counter_value(timer,1); |
| 576 | set_output( device, timer, 1 ); |
| 574 | 577 | } |
| 575 | 578 | |
| 576 | | if (timer->value == 0 && timer->phase == 2) |
| 577 | | adjusted_value = 0; |
| 578 | | else |
| 579 | | adjusted_value = adjusted_count(bcd,timer->value); |
| 579 | decrease_counter_value(timer,elapsed_cycles); |
| 580 | 580 | |
| 581 | | if (elapsed_cycles < adjusted_value) |
| 581 | switch( timer->phase ) |
| 582 | 582 | { |
| 583 | | /* Counter didn't wrap */ |
| 584 | | decrease_counter_value(timer,elapsed_cycles); |
| 583 | case 1: cycles_to_output = 1; break; |
| 584 | case 2: cycles_to_output = adjusted_count( bcd, timer->value ); break; |
| 585 | case 3: cycles_to_output = 1; break; |
| 585 | 586 | } |
| 586 | | else |
| 587 | | { |
| 588 | | elapsed_cycles -= adjusted_value; |
| 589 | | timer->value = 0; |
| 590 | | if (elapsed_cycles == 0) |
| 591 | | { |
| 592 | | /* We hit the strobe cycle */ |
| 593 | | timer->phase = 3; |
| 594 | | } |
| 595 | | else |
| 596 | | { |
| 597 | | decrease_counter_value(timer,elapsed_cycles); |
| 598 | | timer->phase = 0; |
| 599 | | } |
| 600 | | } |
| 601 | | switch(timer->phase) { |
| 602 | | case 0: |
| 603 | | cycles_to_output = CYCLES_NEVER; |
| 604 | | break; |
| 605 | | case 1: |
| 606 | | cycles_to_output = adjusted_count(bcd,timer->value) + 1; |
| 607 | | break; |
| 608 | | case 2: |
| 609 | | cycles_to_output = adjusted_count(bcd,timer->value); |
| 610 | | break; |
| 611 | | case 3: |
| 612 | | cycles_to_output = 1; |
| 613 | | break; |
| 614 | | } |
| 615 | 587 | } |
| 616 | | set_output(device, timer, timer->phase != 3 ? 1 : 0); |
| 617 | 588 | break; |
| 618 | 589 | } |
| 619 | 590 | |
| 620 | | if (timer->output_changed != NULL) |
| 591 | timer->cycles_to_output = cycles_to_output; |
| 592 | if (cycles_to_output == CYCLES_NEVER || timer->clockin == 0) |
| 621 | 593 | { |
| 622 | | timer->cycles_to_output = cycles_to_output; |
| 623 | | if (cycles_to_output == CYCLES_NEVER || timer->clockin == 0) |
| 624 | | { |
| 625 | | timer_reset(timer->outputtimer,attotime_never); |
| 626 | | } |
| 627 | | else |
| 628 | | { |
| 629 | | timer_reset(timer->outputtimer, |
| 630 | | double_to_attotime(cycles_to_output / timer->clockin)); |
| 631 | | } |
| 594 | timer_adjust_oneshot(timer->updatetimer, attotime_never, timer->index); |
| 632 | 595 | } |
| 596 | else |
| 597 | { |
| 598 | attotime next_fire_time = attotime_add( timer->last_updated, double_to_attotime( cycles_to_output / timer->clockin ) ); |
| 633 | 599 | |
| 634 | | if (timer->cycles_to_freq == 0) |
| 635 | | timer->cycles_to_freq = CYCLES_NEVER; |
| 600 | timer_adjust_oneshot(timer->updatetimer, attotime_sub( next_fire_time, timer_get_time() ), timer->index ); |
| 601 | } |
| 602 | |
| 603 | LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x, cycles_to_output = %04x\n", |
| 604 | (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,timer->gate,timer->output,timer->value,cycles_to_output)); |
| 636 | 605 | } |
| 637 | 606 | |
| 638 | 607 | |
| r2942 | r2943 | |
| 653 | 622 | inaccurate by more than one cycle, and the output changed multiple |
| 654 | 623 | times during the discrepancy. In practice updates should still be O(1). |
| 655 | 624 | */ |
| 656 | | static void simulate(const device_config *device, struct pit8253_timer *timer,UINT64 elapsed_cycles) |
| 625 | static void simulate(const device_config *device, struct pit8253_timer *timer, INT64 elapsed_cycles) |
| 657 | 626 | { |
| 658 | | while ((timer->cycles_to_output != CYCLES_NEVER && |
| 659 | | timer->cycles_to_output <= elapsed_cycles) || |
| 660 | | (timer->cycles_to_freq != CYCLES_NEVER && |
| 661 | | timer->cycles_to_freq <= elapsed_cycles)) |
| 662 | | { |
| 663 | | UINT32 cycles_to_callback; |
| 664 | | |
| 665 | | if (timer->cycles_to_output < timer->cycles_to_freq && |
| 666 | | timer->cycles_to_output != CYCLES_NEVER) |
| 667 | | { |
| 668 | | cycles_to_callback = timer->cycles_to_output; |
| 669 | | } |
| 670 | | else |
| 671 | | { |
| 672 | | cycles_to_callback = timer->cycles_to_freq; |
| 673 | | } |
| 674 | | |
| 675 | | simulate2(device, timer, cycles_to_callback); |
| 676 | | elapsed_cycles -= cycles_to_callback; |
| 677 | | } |
| 678 | | simulate2(device, timer, elapsed_cycles); |
| 627 | if ( elapsed_cycles > 0 ) |
| 628 | simulate2(device, timer, elapsed_cycles); |
| 629 | else |
| 630 | if ( timer->clockin ) |
| 631 | timer_adjust_oneshot(timer->updatetimer, double_to_attotime( 1 / timer->clockin ), timer->index ); |
| 679 | 632 | } |
| 680 | 633 | |
| 681 | 634 | |
| r2942 | r2943 | |
| 686 | 639 | years of time. Should be enough for now. */ |
| 687 | 640 | attotime now = timer_get_time(); |
| 688 | 641 | attotime elapsed_time = attotime_sub(now,timer->last_updated); |
| 689 | | INT64 elapsed_cycles = attotime_to_double(elapsed_time) * timer->clockin; |
| 642 | INT64 elapsed_cycles = attotime_to_double(elapsed_time) * timer->clockin; |
| 690 | 643 | |
| 691 | | timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(elapsed_cycles/timer->clockin)); |
| 644 | LOG1(("pit8253: update(): timer %d, %lld elapsed_cycles\n", timer->index, elapsed_cycles)); |
| 692 | 645 | |
| 693 | | simulate(device, timer,elapsed_cycles); |
| 694 | | } |
| 646 | if ( timer->clockin ) |
| 647 | { |
| 648 | timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(elapsed_cycles/timer->clockin)); |
| 649 | } |
| 650 | else |
| 651 | { |
| 652 | timer->last_updated = now; |
| 653 | } |
| 695 | 654 | |
| 696 | | |
| 697 | | static TIMER_CALLBACK( frequency_changed ) |
| 698 | | { |
| 699 | | const device_config *device = ptr; |
| 700 | | pit8253_t *pit8253 = get_safe_token(device); |
| 701 | | struct pit8253_timer *timer = get_timer(pit8253,param); |
| 702 | | INT64 cycles = timer->cycles_to_freq; |
| 703 | | double t; |
| 704 | | |
| 705 | | LOG2(("pit8253: frequency_changed(): timer %d, %d cycles\n",param,(UINT32)cycles)); |
| 706 | | |
| 707 | | simulate(device, timer,cycles); |
| 708 | | |
| 709 | | t = cycles / timer->clockin; |
| 710 | | |
| 711 | | timer->last_updated = attotime_add(timer->last_updated, double_to_attotime(t)); |
| 655 | if ( timer->programmed ) |
| 656 | simulate(device, timer, elapsed_cycles); |
| 712 | 657 | } |
| 713 | 658 | |
| 714 | 659 | |
| 715 | | static TIMER_CALLBACK( output_changed ) |
| 660 | static TIMER_CALLBACK( update_timer_cb ) |
| 716 | 661 | { |
| 717 | 662 | const device_config *device = ptr; |
| 718 | 663 | pit8253_t *pit8253 = get_safe_token(device); |
| 719 | 664 | struct pit8253_timer *timer = get_timer(pit8253,param); |
| 720 | | INT64 cycles = timer->cycles_to_output; |
| 721 | | double t; |
| 722 | 665 | |
| 723 | | LOG2(("pit8253: output_changed(): timer %d, %d cycles\n",param,(UINT32)cycles)); |
| 666 | LOG2(("pit8253: output_changed(): timer %d\n",param)); |
| 724 | 667 | |
| 725 | | simulate(device, timer,cycles); |
| 726 | | |
| 727 | | t = cycles / timer->clockin; |
| 728 | | |
| 729 | | timer->last_updated = attotime_add(timer->last_updated, double_to_attotime(t)); |
| 668 | update( device, timer ); |
| 730 | 669 | } |
| 731 | 670 | |
| 732 | 671 | |
| r2942 | r2943 | |
| 834 | 773 | newcount = 0; |
| 835 | 774 | } |
| 836 | 775 | timer->count = newcount; |
| 837 | | timer->null_count = 1; |
| 838 | 776 | if (mode == 2 || mode == 3) |
| 839 | 777 | { |
| 840 | 778 | if (timer->phase == 0) |
| 841 | 779 | { |
| 842 | | trigger_countdown(device, timer); |
| 780 | timer->phase = 1; |
| 843 | 781 | } |
| 844 | | else |
| 845 | | { |
| 846 | | int bcd = CTRL_BCD(timer->control); |
| 847 | | if (mode == 2) |
| 848 | | { |
| 849 | | freq_callback_in(timer,adjusted_count(bcd,timer->value)); |
| 850 | | } |
| 851 | | else |
| 852 | | { |
| 853 | | freq_callback_in(timer,(adjusted_count(bcd,timer->value) + 1) >> 1); |
| 854 | | } |
| 855 | | } |
| 856 | 782 | } |
| 857 | 783 | else |
| 858 | 784 | { |
| 859 | 785 | if (mode == 0 || mode == 4) |
| 860 | 786 | { |
| 861 | | trigger_countdown(device, timer); |
| 787 | timer->phase = 1; |
| 862 | 788 | } |
| 863 | 789 | } |
| 864 | 790 | } |
| r2942 | r2943 | |
| 960 | 886 | else { |
| 961 | 887 | LOG1(("pit8253_write(): timer=%d bytes=%d mode=%d bcd=%d\n", (data >> 6) & 3, (data >> 4) & 3, (data >> 1) & 7,data & 1)); |
| 962 | 888 | |
| 963 | | timer->control = (data & 0x3f); |
| 964 | | timer->null_count = 1; |
| 965 | | timer->wmsb = timer->rmsb = 0; |
| 966 | | /* Phase 0 is always the phase after a mode control write */ |
| 967 | | timer->phase = 0; |
| 968 | | set_output(device, timer, 1); |
| 969 | | set_freq_count(device, timer); |
| 889 | if ( ( CTRL_MODE(timer->control) != CTRL_MODE(data) ) || ! timer->programmed ) |
| 890 | { |
| 891 | timer->control = (data & 0x3f); |
| 892 | timer->null_count = 1; |
| 893 | timer->wmsb = timer->rmsb = 0; |
| 894 | /* Phase 0 is always the phase after a mode control write */ |
| 895 | timer->phase = 0; |
| 896 | set_output(device, timer, CTRL_MODE(timer->control) ? 1 : 0); |
| 897 | timer->programmed = 1; |
| 898 | } |
| 970 | 899 | } |
| 971 | 900 | } |
| 972 | 901 | else |
| 973 | 902 | { |
| 903 | int middle_of_a_cycle = 0; |
| 904 | |
| 974 | 905 | update(device, timer); |
| 975 | 906 | |
| 907 | if ( attotime_compare( timer_get_time(), timer->last_updated ) > 0 && timer->clockin != 0 ) |
| 908 | { |
| 909 | middle_of_a_cycle = 1; |
| 910 | } |
| 911 | |
| 976 | 912 | switch(CTRL_ACCESS(timer->control)) { |
| 977 | 913 | case 0: |
| 978 | 914 | /* This should never happen */ |
| r2942 | r2943 | |
| 980 | 916 | |
| 981 | 917 | case 1: |
| 982 | 918 | /* read/write counter bits 0-7 only */ |
| 919 | |
| 920 | /* check if we should compensate for not being on a cycle boundary */ |
| 921 | if ( middle_of_a_cycle ) |
| 922 | timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(1/timer->clockin)); |
| 923 | |
| 983 | 924 | load_count(device, timer, data); |
| 925 | simulate2(device, timer, 0 ); |
| 926 | if ( CTRL_MODE(timer->control) == 0 ) |
| 927 | { |
| 928 | set_output( device, timer, 0 ); |
| 929 | } |
| 984 | 930 | break; |
| 985 | 931 | |
| 986 | 932 | case 2: |
| 987 | 933 | /* read/write counter bits 8-15 only */ |
| 934 | |
| 935 | /* check if we should compensate for not being on a cycle boundary */ |
| 936 | if ( middle_of_a_cycle ) |
| 937 | timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(1/timer->clockin)); |
| 938 | |
| 988 | 939 | load_count(device, timer, data << 8); |
| 940 | simulate2(device, timer, 0 ); |
| 989 | 941 | break; |
| 990 | 942 | |
| 991 | 943 | case 3: |
| 992 | 944 | /* read/write bits 0-7 first, then 8-15 */ |
| 993 | 945 | if (timer->wmsb != 0) |
| 994 | 946 | { |
| 947 | /* check if we should compensate for not being on a cycle boundary */ |
| 948 | if ( middle_of_a_cycle ) |
| 949 | timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(1/timer->clockin)); |
| 950 | |
| 995 | 951 | load_count(device, timer,timer->lowcount | (data << 8)); |
| 952 | simulate2(device, timer, 0 ); |
| 996 | 953 | } |
| 997 | 954 | else |
| 998 | 955 | { |
| r2942 | r2943 | |
| 1003 | 960 | 2 won't stop the count, but this was experimentally |
| 1004 | 961 | determined to be false. */ |
| 1005 | 962 | timer->phase = 0; |
| 963 | set_output( device, timer, 0 ); |
| 1006 | 964 | } |
| 1007 | 965 | } |
| 1008 | 966 | timer->wmsb = 1 - timer->wmsb; |
| 1009 | 967 | break; |
| 1010 | 968 | } |
| 1011 | 969 | } |
| 1012 | | update(device, timer); |
| 1013 | 970 | } |
| 1014 | 971 | |
| 1015 | 972 | |
| r2942 | r2943 | |
| 1031 | 988 | { |
| 1032 | 989 | update(device, timer); |
| 1033 | 990 | timer->gate = gate; |
| 1034 | | set_freq_count(device, timer); |
| 1035 | | if (gate != 0 && |
| 1036 | | (mode == 1 || mode == 5 || |
| 1037 | | (timer->phase == 1 && (mode == 2 || mode == 3)))) |
| 991 | if (gate != 0 && ( mode == 1 || mode == 2 || mode == 5 )) |
| 1038 | 992 | { |
| 1039 | | trigger_countdown(device, timer); |
| 993 | timer->phase = 1; |
| 1040 | 994 | } |
| 1041 | 995 | update(device, timer); |
| 1042 | 996 | } |
| r2942 | r2943 | |
| 1046 | 1000 | |
| 1047 | 1001 | /* ----------------------------------------------------------------------- */ |
| 1048 | 1002 | |
| 1049 | | int pit8253_get_frequency(const device_config *device, int timerno) |
| 1050 | | { |
| 1051 | | pit8253_t *pit8253 = get_safe_token(device); |
| 1052 | | struct pit8253_timer *timer = get_timer(pit8253,timerno); |
| 1053 | | |
| 1054 | | update(device, timer); |
| 1055 | | return get_frequency(timer); |
| 1056 | | } |
| 1057 | | |
| 1058 | | |
| 1059 | | |
| 1060 | 1003 | int pit8253_get_output(const device_config *device, int timerno) |
| 1061 | 1004 | { |
| 1062 | 1005 | pit8253_t *pit8253 = get_safe_token(device); |
| r2942 | r2943 | |
| 1081 | 1024 | update(device, timer); |
| 1082 | 1025 | timer->clockin = new_clockin; |
| 1083 | 1026 | update(device, timer); |
| 1027 | } |
| 1084 | 1028 | |
| 1085 | | if (timer->frequency_changed != NULL) |
| 1029 | |
| 1030 | void pit8253_set_clock_signal(const device_config *device, int timerno, int state) |
| 1031 | { |
| 1032 | pit8253_t *pit8253 = get_safe_token(device); |
| 1033 | struct pit8253_timer *timer = get_timer(pit8253,timerno); |
| 1034 | |
| 1035 | LOG2(("pit8253_set_clock_signal(): PIT timer=%d, state = %d\n", timerno, state)); |
| 1036 | |
| 1037 | /* Trigger on low to high transition */ |
| 1038 | if ( !timer->clock && state ) |
| 1086 | 1039 | { |
| 1087 | | timer->frequency_changed(device, get_frequency(timer)); |
| 1088 | | if (timer->cycles_to_freq != CYCLES_NEVER) |
| 1089 | | { |
| 1090 | | freq_callback_in(timer,timer->cycles_to_freq); |
| 1091 | | } |
| 1040 | /* Advance a cycle */ |
| 1041 | simulate2(device, timer, 1); |
| 1092 | 1042 | } |
| 1043 | timer->clock = state; |
| 1093 | 1044 | } |
| 1094 | 1045 | |
| 1095 | 1046 | |
| r2942 | r2943 | |
| 1110 | 1061 | |
| 1111 | 1062 | timer->clockin = pit8253->config->timer[timerno].clockin; |
| 1112 | 1063 | timer->output_changed = pit8253->config->timer[timerno].output_changed; |
| 1113 | | timer->frequency_changed = pit8253->config->timer[timerno].frequency_changed; |
| 1114 | 1064 | |
| 1115 | | if (timer->output_changed == NULL) |
| 1116 | | timer->outputtimer = NULL; |
| 1117 | | else |
| 1118 | | { |
| 1119 | | timer->outputtimer = timer_alloc(output_changed, (void *)device); |
| 1120 | | timer_adjust_oneshot(timer->outputtimer, attotime_never, timerno); |
| 1121 | | } |
| 1122 | | if (timer->frequency_changed == NULL) |
| 1123 | | timer->freqtimer = NULL; |
| 1124 | | else |
| 1125 | | { |
| 1126 | | timer->freqtimer = timer_alloc(frequency_changed, (void *)device); |
| 1127 | | timer_adjust_oneshot(timer->freqtimer, attotime_never, timerno); |
| 1128 | | } |
| 1065 | timer->updatetimer = timer_alloc(update_timer_cb, (void *)device); |
| 1066 | timer_adjust_oneshot(timer->updatetimer, attotime_never, timerno); |
| 1129 | 1067 | |
| 1130 | 1068 | /* set up state save values */ |
| 1131 | 1069 | state_save_register_item(unique_tag, timerno, timer->clockin); |
| r2942 | r2943 | |
| 1144 | 1082 | state_save_register_item(unique_tag, timerno, timer->null_count); |
| 1145 | 1083 | state_save_register_item(unique_tag, timerno, timer->phase); |
| 1146 | 1084 | state_save_register_item(unique_tag, timerno, timer->cycles_to_output); |
| 1147 | | state_save_register_item(unique_tag, timerno, timer->cycles_to_freq); |
| 1148 | | state_save_register_item(unique_tag, timerno, timer->freq_count); |
| 1149 | 1085 | state_save_register_item(unique_tag, timerno, timer->last_updated.seconds); |
| 1150 | 1086 | state_save_register_item(unique_tag, timerno, timer->last_updated.attoseconds); |
| 1087 | state_save_register_item(unique_tag, timerno, timer->programmed); |
| 1088 | state_save_register_item(unique_tag, timerno, timer->clock); |
| 1151 | 1089 | } |
| 1152 | 1090 | } |
| 1153 | 1091 | |
| r2942 | r2943 | |
| 1172 | 1110 | /* According to Intel's 8254 docs, the state of a timer is undefined |
| 1173 | 1111 | until the first mode control word is written. Here we define this |
| 1174 | 1112 | undefined behaviour */ |
| 1113 | timer->index = i; |
| 1175 | 1114 | timer->control = timer->status = 0x30; |
| 1176 | 1115 | timer->rmsb = timer->wmsb = 0; |
| 1177 | 1116 | timer->count = timer->value = timer->latch = 0; |
| r2942 | r2943 | |
| 1181 | 1120 | timer->latched_count = 0; |
| 1182 | 1121 | timer->latched_status = 0; |
| 1183 | 1122 | timer->null_count = 1; |
| 1184 | | timer->cycles_to_output = timer->cycles_to_freq = CYCLES_NEVER; |
| 1123 | timer->cycles_to_output = CYCLES_NEVER; |
| 1185 | 1124 | |
| 1186 | 1125 | timer->last_updated = timer_get_time(); |
| 1187 | 1126 | |
src/mess/machine/at.c
| r2942 | r2943 | |
| 8 | 8 | #include "deprecat.h" |
| 9 | 9 | |
| 10 | 10 | #include "cpu/i386/i386.h" |
| 11 | #include "cpu/i8x41/i8x41.h" |
| 11 | 12 | |
| 12 | 13 | #include "machine/pic8259.h" |
| 13 | 14 | #include "machine/8237dma.h" |
| r2942 | r2943 | |
| 23 | 24 | #include "includes/pc.h" |
| 24 | 25 | #include "includes/at.h" |
| 25 | 26 | #include "machine/pckeybrd.h" |
| 26 | | #include "audio/pc.h" |
| 27 | #include "sound/speaker.h" |
| 27 | 28 | #include "audio/sblaster.h" |
| 28 | 29 | #include "machine/i82439tx.h" |
| 29 | 30 | |
| r2942 | r2943 | |
| 31 | 32 | #include "machine/pc_hdc.h" |
| 32 | 33 | #include "includes/pc_mouse.h" |
| 33 | 34 | |
| 34 | | #define LOG_PORT80 1 |
| 35 | #include "cpu/i8051/i8051.h" |
| 35 | 36 | |
| 37 | #define LOG_PORT80 0 |
| 38 | #define LOG_KBDC 0 |
| 39 | |
| 36 | 40 | static struct { |
| 37 | 41 | const device_config *pic8259_master; |
| 38 | 42 | const device_config *pic8259_slave; |
| 39 | 43 | const device_config *dma8237_1; |
| 40 | 44 | const device_config *dma8237_2; |
| 45 | const device_config *pit8254; |
| 41 | 46 | } at_devices; |
| 42 | 47 | |
| 43 | 48 | static const SOUNDBLASTER_CONFIG soundblaster = { 1,5, {1,0} }; |
| r2942 | r2943 | |
| 70 | 75 | |
| 71 | 76 | |
| 72 | 77 | |
| 78 | /************************************************************************* |
| 79 | * |
| 80 | * PC Speaker related |
| 81 | * |
| 82 | *************************************************************************/ |
| 83 | |
| 84 | static UINT8 at_spkrdata = 0; |
| 85 | static UINT8 at_speaker_input = 0; |
| 86 | |
| 87 | static UINT8 at_speaker_get_spk(void) |
| 88 | { |
| 89 | return at_spkrdata & at_speaker_input; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | static void at_speaker_set_spkrdata(UINT8 data) |
| 94 | { |
| 95 | at_spkrdata = data ? 1 : 0; |
| 96 | speaker_level_w( 0, at_speaker_get_spk() ); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | static void at_speaker_set_input(UINT8 data) |
| 101 | { |
| 102 | at_speaker_input = data ? 1 : 0; |
| 103 | speaker_level_w( 0, at_speaker_get_spk() ); |
| 104 | } |
| 105 | |
| 106 | |
| 107 | |
| 73 | 108 | /************************************************************* |
| 74 | 109 | * |
| 75 | 110 | * pit8254 configuration |
| 76 | 111 | * |
| 77 | 112 | *************************************************************/ |
| 78 | 113 | |
| 79 | | static PIT8253_OUTPUT_CHANGED( pc_timer0_w ) |
| 114 | static PIT8253_OUTPUT_CHANGED( at_pit8254_out0_changed ) |
| 80 | 115 | { |
| 81 | 116 | if ( at_devices.pic8259_master ) { |
| 82 | 117 | pic8259_set_irq_line(at_devices.pic8259_master, 0, state); |
| r2942 | r2943 | |
| 84 | 119 | } |
| 85 | 120 | |
| 86 | 121 | |
| 122 | static PIT8253_OUTPUT_CHANGED( at_pit8254_out2_changed ) |
| 123 | { |
| 124 | at_speaker_set_input( state ? 1 : 0 ); |
| 125 | } |
| 126 | |
| 127 | |
| 87 | 128 | const struct pit8253_config at_pit8254_config = |
| 88 | 129 | { |
| 89 | 130 | { |
| 90 | 131 | { |
| 91 | 132 | 4772720/4, /* heartbeat IRQ */ |
| 92 | | pc_timer0_w, |
| 93 | | NULL |
| 133 | at_pit8254_out0_changed |
| 94 | 134 | }, { |
| 95 | 135 | 4772720/4, /* dram refresh */ |
| 96 | | NULL, |
| 97 | 136 | NULL |
| 98 | 137 | }, { |
| 99 | 138 | 4772720/4, /* pio port c pin 4, and speaker polling enough */ |
| 100 | | NULL, |
| 101 | | pc_sh_speaker_change_clock |
| 139 | at_pit8254_out2_changed |
| 102 | 140 | } |
| 103 | 141 | } |
| 104 | 142 | }; |
| r2942 | r2943 | |
| 183 | 221 | at_pages[offset % 0x10] = data; |
| 184 | 222 | |
| 185 | 223 | if (LOG_PORT80 && (offset == 0)) |
| 224 | { |
| 186 | 225 | logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) activecpu_get_reg(REG_PC)); |
| 226 | } |
| 187 | 227 | |
| 188 | 228 | switch(offset % 8) { |
| 189 | 229 | case 1: |
| r2942 | r2943 | |
| 266 | 306 | }; |
| 267 | 307 | |
| 268 | 308 | |
| 269 | | /* TODO: How is still hooked up in the actual machine? */ |
| 309 | /* TODO: How is this hooked up in the actual machine? */ |
| 270 | 310 | const struct dma8237_interface at_dma8237_2_config = |
| 271 | 311 | { |
| 272 | 312 | 0, |
| 273 | 313 | 1.0e-6, // 1us |
| 274 | 314 | |
| 275 | | NULL, |
| 276 | | NULL, |
| 315 | pc_dma_read_byte, |
| 316 | pc_dma_write_byte, |
| 277 | 317 | |
| 278 | 318 | { NULL, NULL, NULL, NULL }, |
| 279 | 319 | { NULL, NULL, NULL, NULL }, |
| r2942 | r2943 | |
| 358 | 398 | static void at_fdc_interrupt(int state) |
| 359 | 399 | { |
| 360 | 400 | pic8259_set_irq_line(at_devices.pic8259_master, 6, state); |
| 401 | //if ( mess_ram[0x0490] == 0x74 ) |
| 402 | // mess_ram[0x0490] = 0x54; |
| 361 | 403 | } |
| 362 | 404 | |
| 363 | 405 | |
| 364 | 406 | static void at_fdc_dma_drq(int state, int read_) |
| 365 | 407 | { |
| 366 | | dma8237_drq_write((device_config*)device_list_find_by_tag( Machine->config->devicelist, DMA8237, "dma8237_1" ), FDC_DMA, state); |
| 408 | dma8237_drq_write( at_devices.dma8237_1, FDC_DMA, state); |
| 367 | 409 | } |
| 368 | 410 | |
| 369 | 411 | static const struct pc_fdc_interface fdc_interface = |
| 370 | 412 | { |
| 371 | 413 | NEC765A, |
| 372 | | NEC765_RDY_PIN_CONNECTED, |
| 414 | NEC765_RDY_PIN_NOT_CONNECTED, |
| 373 | 415 | at_fdc_interrupt, |
| 374 | 416 | at_fdc_dma_drq, |
| 375 | 417 | }; |
| 376 | 418 | |
| 377 | 419 | |
| 378 | 420 | static int at_get_out2(running_machine *machine) { |
| 379 | | return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "at_pit8254" ), 2 ); |
| 421 | return pit8253_get_output(at_devices.pit8254, 2 ); |
| 380 | 422 | } |
| 381 | 423 | |
| 382 | 424 | |
| 425 | /********************************************************** |
| 426 | * |
| 427 | * 8042 keyboard controller interface |
| 428 | * |
| 429 | * Things connected to the 8042 I/O ports: |
| 430 | * |
| 431 | * AT compatible |
| 432 | * ============= |
| 433 | * |
| 434 | * Port 1 (Input port) |
| 435 | * 0 - P10 - Undefined |
| 436 | * 1 - P11 - Undefined |
| 437 | * 2 - P12 - Undefined |
| 438 | * 3 - P13 - Undefined |
| 439 | * 4 - P14 - External RAM ( 1 = Enable external RAM, 0 = Disable external RAM ) |
| 440 | * 5 - P15 - Manufacturing setting ( 1 = Setting enabled, 0 = Setting disabled ) |
| 441 | * 6 - P16 - Display type switch ( 1 = Color display, 0 = Monochrome display ) |
| 442 | * 7 - P17 - Keyboard inhibit switch ( 1 = Keyboard enabled, 0 = Keyboard inhibited ) |
| 443 | * |
| 444 | * Port 2 (Output port) |
| 445 | * 0 - P20 - System Reset ( 1 = Normal, 0 = Reset comupter ) |
| 446 | * 1 - P21 - Gate A20 |
| 447 | * 2 - P22 - Undefined |
| 448 | * 3 - P23 - Undefined |
| 449 | * 4 - P24 - Input Buffer Full |
| 450 | * 5 - P25 - Output Buffer Empty |
| 451 | * 6 - P26 - Keyboard Clock ( 1 = Pull Clock low, 0 = High-Z ) |
| 452 | * 7 - P27 - Keyboard Data ( 1 = Pull Data low, 0 = High-Z ) |
| 453 | * |
| 454 | * Test Pins (input) |
| 455 | * 0 - T0 - Keyboard Clock input |
| 456 | * 1 - T1 - Keyboard Data input |
| 457 | * |
| 458 | **********************************************************/ |
| 459 | |
| 460 | static UINT8 kbdc8042_speaker; |
| 461 | static UINT8 kbdc8042_offset1 = 0xFF; |
| 462 | static UINT8 keyboard_clock; |
| 463 | static UINT8 keyboard_data; |
| 464 | |
| 465 | |
| 466 | static READ8_HANDLER( at_kbdc8042_p1_r ) |
| 467 | { |
| 468 | logerror("%04x: reading P1\n", activecpu_get_pc() ); |
| 469 | return 0xFF; |
| 470 | } |
| 471 | |
| 472 | |
| 473 | static READ8_HANDLER( at_kbdc8042_p2_r ) |
| 474 | { |
| 475 | return 0xFF; |
| 476 | } |
| 477 | |
| 478 | |
| 479 | static WRITE8_HANDLER( at_kbdc8042_p2_w ) |
| 480 | { |
| 481 | logerror("%04x: writing $%02x to P2\n", activecpu_get_pc(), data ); |
| 482 | |
| 483 | at_set_gate_a20( ( data & 0x02 ) ? 1 : 0 ); |
| 484 | |
| 485 | cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE ); |
| 486 | |
| 487 | keyboard_clock = ( data & 0x40 ) ? 1 : 0; |
| 488 | cpunum_set_input_line( machine, 2, I8051_INT0_LINE, (data & 0x40 ) ? HOLD_LINE : CLEAR_LINE ); |
| 489 | |
| 490 | keyboard_data = ( data & 0x80 ) ? 1 : 0; |
| 491 | cpunum_set_input_line( machine, 2, I8051_T0_LINE, ( data & 0x80 ) ? HOLD_LINE : CLEAR_LINE ); |
| 492 | } |
| 493 | |
| 494 | |
| 495 | static READ8_HANDLER( at_kbdc8042_t0_r ) |
| 496 | { |
| 497 | return keyboard_clock; |
| 498 | } |
| 499 | |
| 500 | |
| 501 | static READ8_HANDLER( at_kbdc8042_t1_r ) |
| 502 | { |
| 503 | return keyboard_data; |
| 504 | } |
| 505 | |
| 506 | |
| 507 | static ADDRESS_MAP_START( kbdc8042_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 508 | AM_RANGE( 0x0000, 0x07FF ) AM_ROM |
| 509 | AM_RANGE( 0x0800, 0x08FF ) AM_RAM |
| 510 | ADDRESS_MAP_END |
| 511 | |
| 512 | |
| 513 | static ADDRESS_MAP_START( kbdc8042_io, ADDRESS_SPACE_IO, 8 ) |
| 514 | AM_RANGE( I8X41_t0, I8X41_t0 ) AM_READ( at_kbdc8042_t0_r ) |
| 515 | AM_RANGE( I8X41_t1, I8X41_t1 ) AM_READ( at_kbdc8042_t1_r ) |
| 516 | AM_RANGE( I8X41_p1, I8X41_p1 ) AM_READ( at_kbdc8042_p1_r ) |
| 517 | AM_RANGE( I8X41_p2, I8X41_p2 ) AM_READWRITE( at_kbdc8042_p2_r, at_kbdc8042_p2_w ) |
| 518 | ADDRESS_MAP_END |
| 519 | |
| 520 | |
| 521 | static const i8x41_config i8042_config = { TYPE_I8X42 }; |
| 522 | |
| 523 | |
| 524 | MACHINE_DRIVER_START( at_kbdc8042 ) |
| 525 | MDRV_CPU_ADD_TAG("kbdc8042", I8X41, 4772720 ) /* Frequency is a wild guess */ |
| 526 | MDRV_CPU_PROGRAM_MAP( kbdc8042_mem, 0 ) |
| 527 | MDRV_CPU_IO_MAP( kbdc8042_io, 0 ) |
| 528 | MDRV_CPU_CONFIG( i8042_config ) |
| 529 | MACHINE_DRIVER_END |
| 530 | |
| 531 | |
| 532 | READ8_HANDLER(at_kbdc8042_r) |
| 533 | { |
| 534 | static int poll_delay = 4; |
| 535 | UINT8 data = 0; |
| 536 | |
| 537 | switch ( offset ) |
| 538 | { |
| 539 | case 0: |
| 540 | data = cpunum_get_reg( 1, I8X41_DATA ); |
| 541 | break; |
| 542 | |
| 543 | case 1: |
| 544 | data = kbdc8042_speaker; |
| 545 | data &= ~0xc0; /* AT BIOS don't likes this being set */ |
| 546 | |
| 547 | /* This needs fixing/updating not sure what this is meant to fix */ |
| 548 | if ( --poll_delay < 0 ) |
| 549 | { |
| 550 | poll_delay = 3; |
| 551 | kbdc8042_offset1 ^= 0x10; |
| 552 | } |
| 553 | data = (data & ~0x10) | ( kbdc8042_offset1 & 0x10 ); |
| 554 | |
| 555 | if ( pit8253_get_output(at_devices.pit8254, 2 ) ) |
| 556 | data |= 0x20; |
| 557 | else |
| 558 | data &= ~0x20; /* ps2m30 wants this */ |
| 559 | break; |
| 560 | |
| 561 | case 2: |
| 562 | if (at_get_out2(machine)) |
| 563 | data |= 0x20; |
| 564 | else |
| 565 | data &= ~0x20; |
| 566 | break; |
| 567 | |
| 568 | case 4: |
| 569 | data = cpunum_get_reg( 1, I8X41_STAT ); |
| 570 | break; |
| 571 | } |
| 572 | |
| 573 | if (LOG_KBDC) |
| 574 | logerror("kbdc8042_8_r(): offset=%d data=0x%02x\n", offset, (unsigned) data); |
| 575 | return data; |
| 576 | } |
| 577 | |
| 578 | |
| 579 | WRITE8_HANDLER(at_kbdc8042_w) |
| 580 | { |
| 581 | if (LOG_KBDC) |
| 582 | logerror("kbdc8042_8_w(): ofset=%d data=0x%02x\n", offset, data); |
| 583 | |
| 584 | switch (offset) { |
| 585 | case 0: |
| 586 | cpunum_set_reg( 1, I8X41_DATA, data ); |
| 587 | break; |
| 588 | |
| 589 | case 1: |
| 590 | kbdc8042_speaker = data; |
| 591 | pit8253_gate_w( at_devices.pit8254, 2, data & 1); |
| 592 | at_speaker_set_spkrdata( data & 0x02 ); |
| 593 | break; |
| 594 | |
| 595 | case 4: |
| 596 | cpunum_set_reg( 1, I8X41_CMND, data ); |
| 597 | break; |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | |
| 602 | /********************************************************** |
| 603 | * |
| 604 | * Keytronic keyboard interface |
| 605 | * |
| 606 | **********************************************************/ |
| 607 | |
| 608 | |
| 609 | static UINT8 keytronic_p1; |
| 610 | static UINT8 keytronic_p2; |
| 611 | static UINT8 keytronic_p3; |
| 612 | |
| 613 | |
| 614 | static READ8_HANDLER( keytronic_p1_r ) |
| 615 | { |
| 616 | UINT8 data = keytronic_p1; |
| 617 | |
| 618 | return data; |
| 619 | } |
| 620 | |
| 621 | |
| 622 | static WRITE8_HANDLER( keytronic_p1_w ) |
| 623 | { |
| 624 | logerror("keytronic_p1_w(): write %02x\n", data ); |
| 625 | |
| 626 | keytronic_p1 = data; |
| 627 | } |
| 628 | |
| 629 | |
| 630 | static READ8_HANDLER( keytronic_p2_r ) |
| 631 | { |
| 632 | UINT8 data = keytronic_p2; |
| 633 | |
| 634 | return data; |
| 635 | } |
| 636 | |
| 637 | |
| 638 | static WRITE8_HANDLER( keytronic_p2_w ) |
| 639 | { |
| 640 | logerror("keytronic_p2_w(): write %02x\n", data ); |
| 641 | |
| 642 | keytronic_p2 = data; |
| 643 | } |
| 644 | |
| 645 | |
| 646 | static READ8_HANDLER( keytronic_p3_r ) |
| 647 | { |
| 648 | UINT8 data = keytronic_p3; |
| 649 | |
| 650 | return data; |
| 651 | } |
| 652 | |
| 653 | |
| 654 | static WRITE8_HANDLER( keytronic_p3_w ) |
| 655 | { |
| 656 | logerror("keytronic_p3_w(): write %02x\n", data ); |
| 657 | |
| 658 | keytronic_p3 = data; |
| 659 | } |
| 660 | |
| 661 | |
| 662 | static READ8_HANDLER( keytronic_data_r ) |
| 663 | { |
| 664 | logerror("keytronic_data_r(): read from %04x\n", offset ); |
| 665 | return 0xFF; |
| 666 | } |
| 667 | |
| 668 | |
| 669 | static WRITE8_HANDLER( keytronic_data_w ) |
| 670 | { |
| 671 | keyboard_data = ( offset & 0x0100 ) ? 1 : 0; |
| 672 | keyboard_clock = ( offset & 0x0200 ) ? 1 : 0; |
| 673 | } |
| 674 | |
| 675 | |
| 676 | static ADDRESS_MAP_START( keytronic_program, ADDRESS_SPACE_PROGRAM, 8 ) |
| 677 | AM_RANGE( 0x0000, 0x0FFF ) AM_ROM |
| 678 | ADDRESS_MAP_END |
| 679 | |
| 680 | |
| 681 | static ADDRESS_MAP_START( keytronic_data, ADDRESS_SPACE_DATA, 8 ) |
| 682 | AM_RANGE( 0x0000, 0xFFFF ) AM_READWRITE( keytronic_data_r, keytronic_data_w ) |
| 683 | ADDRESS_MAP_END |
| 684 | |
| 685 | |
| 686 | static ADDRESS_MAP_START( keytronic_io, ADDRESS_SPACE_IO, 8 ) |
| 687 | AM_RANGE( 0x01, 0x01 ) AM_READWRITE( keytronic_p1_r, keytronic_p1_w ) |
| 688 | AM_RANGE( 0x02, 0x02 ) AM_READWRITE( keytronic_p2_r, keytronic_p2_w ) |
| 689 | AM_RANGE( 0x03, 0x03 ) AM_READWRITE( keytronic_p3_r, keytronic_p3_w ) |
| 690 | ADDRESS_MAP_END |
| 691 | |
| 692 | |
| 693 | MACHINE_DRIVER_START( keytronic_keyboard ) |
| 694 | MDRV_CPU_ADD_TAG( "keytronic_keyboard", I8051, 11060250 ) |
| 695 | MDRV_CPU_PROGRAM_MAP( keytronic_program, 0 ) |
| 696 | MDRV_CPU_DATA_MAP( keytronic_data, 0 ) |
| 697 | MDRV_CPU_IO_MAP( keytronic_io, 0 ) |
| 698 | MACHINE_DRIVER_END |
| 699 | |
| 700 | |
| 701 | /********************************************************** |
| 702 | * |
| 703 | * Init functions |
| 704 | * |
| 705 | **********************************************************/ |
| 706 | |
| 707 | |
| 383 | 708 | DRIVER_INIT( atcga ) |
| 384 | 709 | { |
| 385 | 710 | static const struct kbdc8042_interface at8042 = |
| r2942 | r2943 | |
| 505 | 830 | |
| 506 | 831 | MACHINE_RESET( at ) |
| 507 | 832 | { |
| 508 | | at_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" ); |
| 509 | | at_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" ); |
| 510 | | at_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" ); |
| 511 | | at_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" ); |
| 833 | at_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" ); |
| 834 | at_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" ); |
| 835 | at_devices.dma8237_1 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" ); |
| 836 | at_devices.dma8237_2 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" ); |
| 837 | at_devices.pit8254 = device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ); |
| 512 | 838 | pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, NS16450, "ns16450_0" ) ); |
| 513 | 839 | } |
| 514 | 840 | |
src/mess/machine/pc.c
| r2942 | r2943 | |
| 44 | 44 | #include "includes/ibmpc.h" |
| 45 | 45 | #include "machine/pcshare.h" |
| 46 | 46 | #include "devices/cassette.h" |
| 47 | | #include "audio/pc.h" |
| 47 | #include "sound/speaker.h" |
| 48 | 48 | |
| 49 | 49 | #include "machine/8237dma.h" |
| 50 | 50 | |
| r2942 | r2943 | |
| 58 | 58 | const device_config *pic8259_master; |
| 59 | 59 | const device_config *pic8259_slave; |
| 60 | 60 | const device_config *dma8237; |
| 61 | const device_config *pit8253; |
| 61 | 62 | } pc_devices; |
| 62 | 63 | |
| 63 | 64 | /************************************************************************* |
| r2942 | r2943 | |
| 147 | 148 | } |
| 148 | 149 | |
| 149 | 150 | |
| 150 | | const struct dma8237_interface pc_dma8237_config = |
| 151 | const struct dma8237_interface ibm5150_dma8237_config = |
| 151 | 152 | { |
| 152 | 153 | 0, |
| 153 | 154 | 1.0e-6, // 1us |
| r2942 | r2943 | |
| 179 | 180 | } |
| 180 | 181 | |
| 181 | 182 | |
| 182 | | const struct pic8259_interface pc_pic8259_master_config = |
| 183 | const struct pic8259_interface ibm5150_pic8259_master_config = |
| 183 | 184 | { |
| 184 | 185 | pc_pic8259_master_set_int_line |
| 185 | 186 | }; |
| 186 | 187 | |
| 187 | 188 | |
| 188 | | const struct pic8259_interface pc_pic8259_slave_config = |
| 189 | const struct pic8259_interface ibm5150_pic8259_slave_config = |
| 189 | 190 | { |
| 190 | 191 | pc_pic8259_slave_set_int_line |
| 191 | 192 | }; |
| r2942 | r2943 | |
| 234 | 235 | }; |
| 235 | 236 | |
| 236 | 237 | |
| 238 | /************************************************************************* |
| 239 | * |
| 240 | * PC Speaker related |
| 241 | * |
| 242 | *************************************************************************/ |
| 243 | |
| 244 | static UINT8 pc_spkrdata = 0; |
| 245 | static UINT8 pc_input = 0; |
| 246 | |
| 247 | UINT8 pc_speaker_get_spk(void) |
| 248 | { |
| 249 | return pc_spkrdata & pc_input; |
| 250 | } |
| 251 | |
| 252 | |
| 253 | void pc_speaker_set_spkrdata(UINT8 data) |
| 254 | { |
| 255 | pc_spkrdata = data ? 1 : 0; |
| 256 | speaker_level_w( 0, pc_speaker_get_spk() ); |
| 257 | } |
| 258 | |
| 259 | |
| 260 | void pc_speaker_set_input(UINT8 data) |
| 261 | { |
| 262 | pc_input = data ? 1 : 0; |
| 263 | speaker_level_w( 0, pc_speaker_get_spk() ); |
| 264 | } |
| 265 | |
| 266 | |
| 237 | 267 | /************************************************************* |
| 238 | 268 | * |
| 239 | 269 | * pit8253 configuration |
| 240 | 270 | * |
| 241 | 271 | *************************************************************/ |
| 242 | 272 | |
| 243 | | static PIT8253_OUTPUT_CHANGED( pc_timer0_w ) |
| 273 | static PIT8253_OUTPUT_CHANGED( ibm5150_timer0_w ) |
| 244 | 274 | { |
| 245 | 275 | pic8259_set_irq_line(pc_devices.pic8259_master, 0, state); |
| 246 | 276 | } |
| 247 | 277 | |
| 248 | 278 | |
| 249 | | const struct pit8253_config pc_pit8253_config = |
| 279 | static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out1_changed ) |
| 250 | 280 | { |
| 281 | /* Trigger DMA channel #0 */ |
| 282 | } |
| 283 | |
| 284 | |
| 285 | static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out2_changed ) |
| 286 | { |
| 287 | pc_speaker_set_input( state ); |
| 288 | } |
| 289 | |
| 290 | |
| 291 | const struct pit8253_config ibm5150_pit8253_config = |
| 292 | { |
| 251 | 293 | { |
| 252 | 294 | { |
| 253 | 295 | 4772720/4, /* heartbeat IRQ */ |
| 254 | | pc_timer0_w, |
| 255 | | NULL |
| 296 | ibm5150_timer0_w |
| 256 | 297 | }, { |
| 257 | 298 | 4772720/4, /* dram refresh */ |
| 258 | | NULL, |
| 259 | | NULL |
| 299 | ibm5150_pit8253_out1_changed |
| 260 | 300 | }, { |
| 261 | 301 | 4772720/4, /* pio port c pin 4, and speaker polling enough */ |
| 262 | | NULL, |
| 263 | | pc_sh_speaker_change_clock |
| 302 | ibm5150_pit8253_out2_changed |
| 264 | 303 | } |
| 265 | 304 | } |
| 266 | 305 | }; |
| r2942 | r2943 | |
| 277 | 316 | { |
| 278 | 317 | { |
| 279 | 318 | 4772720/4, /* heartbeat IRQ */ |
| 280 | | pc_timer0_w, |
| 281 | | NULL |
| 319 | ibm5150_timer0_w |
| 282 | 320 | }, { |
| 283 | 321 | 4772720/4, /* dram refresh */ |
| 284 | | NULL, |
| 285 | 322 | NULL |
| 286 | 323 | }, { |
| 287 | 324 | 4772720/4, /* pio port c pin 4, and speaker polling enough */ |
| 288 | | NULL, |
| 289 | | NULL /* TIMER AUDIO signal */ |
| 325 | ibm5150_pit8253_out2_changed |
| 290 | 326 | } |
| 291 | 327 | } |
| 292 | 328 | }; |
| r2942 | r2943 | |
| 324 | 360 | |
| 325 | 361 | /* PC interface to PC-com hardware. Done this way because PCW16 also |
| 326 | 362 | uses PC-com hardware and doesn't have the same setup! */ |
| 327 | | const ins8250_interface ibmpc_com_interface[4]= |
| 363 | const ins8250_interface ibm5150_com_interface[4]= |
| 328 | 364 | { |
| 329 | 365 | { |
| 330 | 366 | 1843200, |
| r2942 | r2943 | |
| 544 | 580 | * |
| 545 | 581 | * PPI8255 interface |
| 546 | 582 | * |
| 583 | * |
| 584 | * PORT A (input) |
| 585 | * |
| 586 | * Directly attached to shift register which stores data |
| 587 | * received from the keyboard. |
| 588 | * |
| 589 | * PORT B (output) |
| 590 | * 0 - PB0 - TIM2GATESPK - Enable/disable counting on timer 2 of the 8253 |
| 591 | * 1 - PB1 - SPKRDATA - Speaker data |
| 592 | * 2 - PB2 - - Enable receiving data from the keyboard when keyboard is not locked. |
| 593 | * 3 - PB3 - - Dipsswitch set selector |
| 594 | * 4 - PB4 - ENBRAMPCK - Enable ram parity check |
| 595 | * 5 - PB5 - ENABLEI/OCK - Enable expansion I/O check |
| 596 | * 6 - PB6 - - Connected to keyboard clock signal |
| 597 | * 7 - PB7 - - Clear/disable shift register and IRQ1 line |
| 598 | * |
| 599 | * PORT C |
| 600 | * 0 - PC0 - - Dipswitch 0/4 |
| 601 | * 1 - PC1 - - Dipswitch 1/5 |
| 602 | * 2 - PC2 - - Dipswitch 2/6 |
| 603 | * 3 - PC3 - - Dipswitch 3/7 |
| 604 | * 4 - PC4 - SPK - Speaker/cassette data |
| 605 | * 5 - PC5 - I/OCHCK - Expansion I/O check result |
| 606 | * 6 - PC6 - T/C2OUT - Output of 8253 timer 2 |
| 607 | * 7 - PC7 - PCK - Parity check result |
| 608 | * |
| 547 | 609 | **********************************************************/ |
| 548 | 610 | |
| 549 | 611 | static struct { |
| r2942 | r2943 | |
| 597 | 659 | |
| 598 | 660 | static READ8_HANDLER ( pc_ppi_portc_r ) |
| 599 | 661 | { |
| 600 | | int timer2_output = pit8253_get_output( device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2 ); |
| 662 | int timer2_output = pit8253_get_output( pc_devices.pit8253, 2 ); |
| 601 | 663 | int data=0xff; |
| 602 | 664 | |
| 603 | 665 | data&=~0x80; // no parity error |
| r2942 | r2943 | |
| 657 | 719 | pc_ppi.portc_switch_high = data & 0x08; |
| 658 | 720 | pc_ppi.keyboard_disabled = data & 0x80; |
| 659 | 721 | pc_ppi.keyb_clock = data & 0x40; |
| 660 | | pit8253_gate_w( device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1); |
| 661 | | pc_sh_speaker(machine, data & 0x03); |
| 722 | pit8253_gate_w( pc_devices.pit8253, 2, data & 1); |
| 723 | pc_speaker_set_spkrdata( data & 0x02 ); |
| 662 | 724 | pc_keyb_set_clock( pc_ppi.keyb_clock ); |
| 663 | 725 | |
| 664 | 726 | cassette_change_state( image_from_devtype_and_index( IO_CASSETTE, 0 ), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| r2942 | r2943 | |
| 675 | 737 | } |
| 676 | 738 | |
| 677 | 739 | |
| 678 | | /* PC-XT has a 8255 which is connected to keyboard and other |
| 740 | /* IBM PC has a 8255 which is connected to keyboard and other |
| 679 | 741 | status information */ |
| 680 | | const ppi8255_interface pc_ppi8255_interface = |
| 742 | const ppi8255_interface ibm5150_ppi8255_interface = |
| 681 | 743 | { |
| 682 | 744 | pc_ppi_porta_r, |
| 683 | 745 | pc_ppi_portb_r, |
| r2942 | r2943 | |
| 688 | 750 | }; |
| 689 | 751 | |
| 690 | 752 | |
| 753 | static READ8_HANDLER ( ibm5160_ppi_portc_r ) |
| 754 | { |
| 755 | int timer2_output = pit8253_get_output( pc_devices.pit8253, 2 ); |
| 756 | int data=0xff; |
| 757 | |
| 758 | data&=~0x80; // no parity error |
| 759 | data&=~0x40; // no error on expansion board |
| 760 | /* KB port C: equipment flags */ |
| 761 | // if (pc_port[0x61] & 0x08) |
| 762 | if (pc_ppi.portc_switch_high) |
| 763 | { |
| 764 | /* read hi nibble of S2 */ |
| 765 | data = (data & 0xf0) | ((input_port_read(machine, "DSW0") >> 4) & 0x0f); |
| 766 | PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); |
| 767 | } |
| 768 | else |
| 769 | { |
| 770 | /* read lo nibble of S2 */ |
| 771 | data = (data & 0xf0) | (input_port_read(machine, "DSW0") & 0x0f); |
| 772 | PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data)); |
| 773 | } |
| 774 | |
| 775 | if ( pc_ppi.portb & 0x01 ) |
| 776 | { |
| 777 | data = ( data & ~0x10 ) | ( timer2_output ? 0x10 : 0x00 ); |
| 778 | } |
| 779 | data = ( data & ~0x20 ) | ( timer2_output ? 0x20 : 0x00 ); |
| 780 | |
| 781 | return data; |
| 782 | } |
| 783 | |
| 784 | |
| 785 | static WRITE8_HANDLER( ibm5160_ppi_portb_w ) |
| 786 | { |
| 787 | pc_ppi.portb = data; |
| 788 | pc_ppi.portc_switch_high = data & 0x08; |
| 789 | pc_ppi.keyboard_disabled = data & 0x80; |
| 790 | pc_ppi.keyb_clock = data & 0x40; |
| 791 | pit8253_gate_w( pc_devices.pit8253, 2, data & 0x01 ); |
| 792 | pc_speaker_set_spkrdata( data & 0x02 ); |
| 793 | pc_keyb_set_clock( pc_ppi.keyb_clock ); |
| 794 | |
| 795 | if ( data & 0x80 ) |
| 796 | pc_keyb_clear(); |
| 797 | } |
| 798 | |
| 799 | |
| 800 | const ppi8255_interface ibm5160_ppi8255_interface = |
| 801 | { |
| 802 | pc_ppi_porta_r, |
| 803 | pc_ppi_portb_r, |
| 804 | ibm5160_ppi_portc_r, |
| 805 | pc_ppi_porta_w, |
| 806 | ibm5160_ppi_portb_w, |
| 807 | pc_ppi_portc_w |
| 808 | }; |
| 809 | |
| 810 | |
| 691 | 811 | static WRITE8_HANDLER ( pcjr_ppi_portb_w ) |
| 692 | 812 | { |
| 693 | 813 | /* KB controller port B */ |
| 694 | 814 | pc_ppi.portb = data; |
| 695 | 815 | pc_ppi.portc_switch_high = data & 0x08; |
| 696 | 816 | pit8253_gate_w( device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1); |
| 697 | | pc_sh_speaker(machine, data & 0x03); |
| 817 | pc_speaker_set_spkrdata( data & 0x02 ); |
| 698 | 818 | |
| 699 | 819 | cassette_change_state( image_from_devtype_and_index( IO_CASSETTE, 0 ), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 700 | 820 | } |
| r2942 | r2943 | |
| 807 | 927 | pc_set_irq_line( 1, state ); |
| 808 | 928 | } |
| 809 | 929 | |
| 930 | |
| 931 | /********************************************************** |
| 932 | * |
| 933 | * Initialization code |
| 934 | * |
| 935 | **********************************************************/ |
| 936 | |
| 810 | 937 | void mess_init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int)) |
| 811 | 938 | { |
| 812 | 939 | init_pc_common(machine, flags, set_keyb_int_func); |
| r2942 | r2943 | |
| 1018 | 1145 | pc_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" ); |
| 1019 | 1146 | pc_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" ); |
| 1020 | 1147 | pc_devices.dma8237 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237" ); |
| 1148 | pc_devices.pit8253 = device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ); |
| 1021 | 1149 | pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, INS8250, "ins8250_0" ) ); |
| 1022 | 1150 | pc_hdc_set_dma8237_device( pc_devices.dma8237 ); |
| 1151 | speaker_level_w( 0, 0 ); |
| 1023 | 1152 | } |
| 1024 | 1153 | |
| 1025 | 1154 | |
src/mess/drivers/at.c
| r2942 | r2943 | |
| 34 | 34 | #include "includes/ps2.h" |
| 35 | 35 | |
| 36 | 36 | #include "machine/pcshare.h" |
| 37 | | #include "audio/pc.h" |
| 38 | 37 | |
| 39 | 38 | #include "devices/mflopimg.h" |
| 40 | 39 | #include "devices/harddriv.h" |
| r2942 | r2943 | |
| 46 | 45 | /* window resizing with dirtybuffering traping in xmess window */ |
| 47 | 46 | |
| 48 | 47 | #define ym3812_StdClock 3579545 |
| 49 | | #define AT_PIT8254 "at_pit8254" |
| 50 | 48 | |
| 51 | 49 | /* |
| 52 | 50 | adlib (YM3812/OPL2 chip), part of many many soundcards (soundblaster) |
| r2942 | r2943 | |
| 77 | 75 | AM_RANGE(0x0c8000, 0x0cffff) AM_ROM |
| 78 | 76 | AM_RANGE(0x0d0000, 0x0effff) AM_RAM |
| 79 | 77 | AM_RANGE(0x0f0000, 0x0fffff) AM_ROM |
| 78 | AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION(REGION_CPU1, 0x0f0000) |
| 80 | 79 | ADDRESS_MAP_END |
| 81 | 80 | |
| 82 | 81 | |
| r2942 | r2943 | |
| 133 | 132 | static ADDRESS_MAP_START(at16_io, ADDRESS_SPACE_IO, 16) |
| 134 | 133 | AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffff) |
| 135 | 134 | AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffff) |
| 136 | | AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, AT_PIT8254, pit8253_r, pit8253_w, 0xffff) |
| 137 | | AM_RANGE(0x0060, 0x006f) AM_READWRITE8(kbdc8042_8_r, kbdc8042_8_w, 0xffff) |
| 135 | AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffff) |
| 136 | AM_RANGE(0x0060, 0x006f) AM_READWRITE8(at_kbdc8042_r, at_kbdc8042_w, 0xffff) |
| 138 | 137 | AM_RANGE(0x0070, 0x007f) AM_READWRITE8(mc146818_port_r, mc146818_port_w, 0xffff) |
| 139 | 138 | AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff) |
| 140 | 139 | AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8(PIC8259, "pic8259_slave", pic8259_r, pic8259_w, 0xffff) |
| r2942 | r2943 | |
| 145 | 144 | AM_RANGE(0x0278, 0x027f) AM_READWRITE8(pc_parallelport2_r, pc_parallelport2_w, 0xffff) |
| 146 | 145 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8(NS16450, "ns16450_3", ins8250_r, ins8250_w, 0xffff) |
| 147 | 146 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8(NS16450, "ns16450_1", ins8250_r, ins8250_w, 0xffff) |
| 148 | | AM_RANGE(0x0320, 0x0323) AM_READWRITE8(pc_HDC1_r, pc_HDC1_w, 0xffff) |
| 149 | | AM_RANGE(0x0324, 0x0327) AM_READWRITE8(pc_HDC2_r, pc_HDC2_w, 0xffff) |
| 147 | // AM_RANGE(0x0320, 0x0323) AM_READWRITE8(pc_HDC1_r, pc_HDC1_w, 0xffff) |
| 148 | // AM_RANGE(0x0324, 0x0327) AM_READWRITE8(pc_HDC2_r, pc_HDC2_w, 0xffff) |
| 150 | 149 | AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_parallelport1_r, pc_parallelport1_w, 0xffff) |
| 151 | 150 | #ifdef ADLIB |
| 152 | 151 | AM_RANGE(0x0388, 0x0389) AM_READWRITE8(at_adlib_r, at_adlib_w, 0xffff) |
| r2942 | r2943 | |
| 161 | 160 | static ADDRESS_MAP_START(at386_io, ADDRESS_SPACE_IO, 32) |
| 162 | 161 | AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffffffff) |
| 163 | 162 | AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffffffff) |
| 164 | | AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, AT_PIT8254, pit8253_r, pit8253_w, 0xffffffff) |
| 163 | AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffffffff) |
| 165 | 164 | AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w) |
| 166 | 165 | AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w) |
| 167 | 166 | AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff) |
| r2942 | r2943 | |
| 183 | 182 | static ADDRESS_MAP_START(at586_io, ADDRESS_SPACE_IO, 32) |
| 184 | 183 | AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffffffff) |
| 185 | 184 | AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffffffff) |
| 186 | | AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, AT_PIT8254, pit8253_r, pit8253_w, 0xffffffff) |
| 185 | AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffffffff) |
| 187 | 186 | AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w) |
| 188 | 187 | AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w) |
| 189 | 188 | AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff) |
| r2942 | r2943 | |
| 417 | 416 | |
| 418 | 417 | static MACHINE_DRIVER_START( ibm5170 ) |
| 419 | 418 | /* basic machine hardware */ |
| 420 | | MDRV_CPU_ATPC(at16, at16, I80286, 12000000 /*6000000*/) |
| 419 | MDRV_CPU_ATPC(at16, at16, I80286, 6000000 /*6000000*/) |
| 421 | 420 | |
| 422 | | MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 ) |
| 421 | MDRV_INTERLEAVE(1) |
| 422 | |
| 423 | MDRV_DEVICE_ADD( "pit8254", PIT8254 ) |
| 423 | 424 | MDRV_DEVICE_CONFIG( at_pit8254_config ) |
| 424 | 425 | |
| 425 | 426 | MDRV_DEVICE_ADD( "dma8237_1", DMA8237 ) |
| r2942 | r2943 | |
| 453 | 454 | |
| 454 | 455 | /* sound hardware */ |
| 455 | 456 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 456 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 457 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 457 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 458 | 458 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 459 | 459 | #ifdef ADLIB |
| 460 | 460 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 467 | 467 | MDRV_SOUND_ADD(SAA1099, 8000000) |
| 468 | 468 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 469 | 469 | #endif |
| 470 | MDRV_IMPORT_FROM( at_kbdc8042 ) |
| 470 | 471 | |
| 471 | 472 | MDRV_NVRAM_HANDLER( mc146818 ) |
| 472 | 473 | |
| r2942 | r2943 | |
| 482 | 483 | MDRV_CPU_REPLACE("main", I80286, 8000000) |
| 483 | 484 | MACHINE_DRIVER_END |
| 484 | 485 | |
| 486 | |
| 487 | static MACHINE_DRIVER_START( ibm5162 ) |
| 488 | /* basic machine hardware */ |
| 489 | MDRV_CPU_ATPC(at16, at16, I80286, 6000000 /*6000000*/) |
| 490 | |
| 491 | MDRV_INTERLEAVE(1) |
| 492 | |
| 493 | MDRV_DEVICE_ADD( "pit8254", PIT8254 ) |
| 494 | MDRV_DEVICE_CONFIG( at_pit8254_config ) |
| 495 | |
| 496 | MDRV_DEVICE_ADD( "dma8237_1", DMA8237 ) |
| 497 | MDRV_DEVICE_CONFIG( at_dma8237_1_config ) |
| 498 | |
| 499 | MDRV_DEVICE_ADD( "dma8237_2", DMA8237 ) |
| 500 | MDRV_DEVICE_CONFIG( at_dma8237_2_config ) |
| 501 | |
| 502 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 503 | MDRV_DEVICE_CONFIG( at_pic8259_master_config ) |
| 504 | |
| 505 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 506 | MDRV_DEVICE_CONFIG( at_pic8259_slave_config ) |
| 507 | |
| 508 | MDRV_DEVICE_ADD( "ns16450_0", NS16450 ) /* TODO: verify model */ |
| 509 | MDRV_DEVICE_CONFIG( ibm5170_com_interface[0] ) |
| 510 | |
| 511 | MDRV_DEVICE_ADD( "ns16450_1", NS16450 ) /* TODO: verify model */ |
| 512 | MDRV_DEVICE_CONFIG( ibm5170_com_interface[1] ) |
| 513 | |
| 514 | MDRV_DEVICE_ADD( "ns16450_2", NS16450 ) /* TODO: verify model */ |
| 515 | MDRV_DEVICE_CONFIG( ibm5170_com_interface[2] ) |
| 516 | |
| 517 | MDRV_DEVICE_ADD( "ns16450_3", NS16450 ) /* TODO: verify model */ |
| 518 | MDRV_DEVICE_CONFIG( ibm5170_com_interface[3] ) |
| 519 | |
| 520 | MDRV_MACHINE_START( at ) |
| 521 | MDRV_MACHINE_RESET( at ) |
| 522 | |
| 523 | MDRV_IMPORT_FROM( pcvideo_cga ) |
| 524 | |
| 525 | /* sound hardware */ |
| 526 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 527 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 528 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 529 | |
| 530 | MDRV_IMPORT_FROM( at_kbdc8042 ) |
| 531 | |
| 532 | MDRV_IMPORT_FROM( keytronic_keyboard ) |
| 533 | |
| 534 | MDRV_NVRAM_HANDLER( mc146818 ) |
| 535 | |
| 536 | /* printers */ |
| 537 | MDRV_DEVICE_ADD("printer1", PRINTER) |
| 538 | MDRV_DEVICE_ADD("printer2", PRINTER) |
| 539 | MDRV_DEVICE_ADD("printer3", PRINTER) |
| 540 | MACHINE_DRIVER_END |
| 541 | |
| 542 | |
| 485 | 543 | static MACHINE_DRIVER_START( ps2m30286 ) |
| 486 | 544 | /* basic machine hardware */ |
| 487 | 545 | MDRV_CPU_ATPC(at16, at16, I80286, 12000000) |
| 488 | 546 | |
| 489 | | MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 ) |
| 547 | MDRV_DEVICE_ADD( "pit8254", PIT8254 ) |
| 490 | 548 | MDRV_DEVICE_CONFIG( at_pit8254_config ) |
| 491 | 549 | |
| 492 | 550 | MDRV_DEVICE_ADD( "dma8237_1", DMA8237 ) |
| r2942 | r2943 | |
| 524 | 582 | |
| 525 | 583 | /* sound hardware */ |
| 526 | 584 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 527 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 528 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 585 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 529 | 586 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 530 | 587 | #ifdef ADLIB |
| 531 | 588 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 552 | 609 | /* basic machine hardware */ |
| 553 | 610 | MDRV_CPU_ATPC(at16, at16, I80286, 12000000) |
| 554 | 611 | |
| 555 | | MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 ) |
| 612 | MDRV_DEVICE_ADD( "pit8254", PIT8254 ) |
| 556 | 613 | MDRV_DEVICE_CONFIG( at_pit8254_config ) |
| 557 | 614 | |
| 558 | 615 | MDRV_DEVICE_ADD( "dma8237_1", DMA8237 ) |
| r2942 | r2943 | |
| 590 | 647 | |
| 591 | 648 | /* sound hardware */ |
| 592 | 649 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 593 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 594 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 650 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 595 | 651 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 596 | 652 | #ifdef ADLIB |
| 597 | 653 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 624 | 680 | MDRV_MACHINE_START( at ) |
| 625 | 681 | MDRV_MACHINE_RESET( at ) |
| 626 | 682 | |
| 627 | | MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 ) |
| 683 | MDRV_DEVICE_ADD( "pit8254", PIT8254 ) |
| 628 | 684 | MDRV_DEVICE_CONFIG( at_pit8254_config ) |
| 629 | 685 | |
| 630 | 686 | MDRV_DEVICE_ADD( "dma8237_1", DMA8237 ) |
| r2942 | r2943 | |
| 655 | 711 | |
| 656 | 712 | /* sound hardware */ |
| 657 | 713 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 658 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 659 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 714 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 660 | 715 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 661 | 716 | #ifdef ADLIB |
| 662 | 717 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 727 | 782 | #endif |
| 728 | 783 | |
| 729 | 784 | ROM_START( ibm5170 ) |
| 730 | | ROM_REGION(0x1000000,REGION_CPU1, 0) |
| 785 | ROM_REGION(0x100000,REGION_CPU1, 0) |
| 731 | 786 | |
| 732 | 787 | ROM_SYSTEM_BIOS( 0, "rev1", "IBM PC/AT 5170 01/10/84") |
| 733 | 788 | ROMX_LOAD("t6181028.u27", 0xf0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(1)) |
| 734 | | ROMX_LOAD("t6181028.u27", 0xff0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(1)) |
| 735 | 789 | ROMX_LOAD("t6181029.u47", 0xf0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(1)) |
| 736 | | ROMX_LOAD("t6181029.u47", 0xff0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(1)) |
| 737 | 790 | |
| 738 | 791 | ROM_SYSTEM_BIOS( 1, "rev2", "IBM PC/AT 5170 06/10/85") /* Another verifaction of these crcs would be nice */ |
| 739 | 792 | ROMX_LOAD("6480090.u27", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2)) |
| 740 | | ROMX_LOAD("6480090.u27", 0xff0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2)) |
| 741 | 793 | ROMX_LOAD("6480091.u47", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2)) |
| 742 | | ROMX_LOAD("6480091.u47", 0xff0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2)) |
| 743 | 794 | |
| 795 | ROM_SYSTEM_BIOS( 2, "atdiag", "IBM PC/AT 5170 w/Super Diagnostics") |
| 796 | ROMX_LOAD("atdiage.bin", 0xf8000, 0x4000, CRC(e8855d0c) SHA1(c9d53e61c08da0a64f43d691bf6cadae5393843a), ROM_SKIP(1) | ROM_BIOS(3)) |
| 797 | ROMX_LOAD("atdiago.bin", 0xf8001, 0x4000, CRC(606fa71d) SHA1(165e45bae7ae2da274f1e645c763c5bfcbde027b), ROM_SKIP(1) | ROM_BIOS(3)) |
| 798 | |
| 744 | 799 | ROM_REGION(0x08100, REGION_GFX1, 0) |
| 745 | 800 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| 746 | 801 | |
| r2942 | r2943 | |
| 749 | 804 | /* This region holds the original EGA Video bios */ |
| 750 | 805 | ROM_REGION(0x4000, REGION_USER1, 0) |
| 751 | 806 | ROM_LOAD("6277356.u44", 0x0000, 0x4000, CRC(dc146448) SHA1(dc0794499b3e499c5777b3aa39554bbf0f2cc19b)) |
| 807 | |
| 808 | /* 8042 keyboard controller */ |
| 809 | ROM_REGION( 0x0800, REGION_CPU2, 0 ) |
| 810 | ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729)) |
| 752 | 811 | ROM_END |
| 753 | 812 | |
| 754 | 813 | |
| 755 | 814 | ROM_START( ibm5170a ) |
| 756 | | ROM_REGION(0x1000000,REGION_CPU1, 0) |
| 815 | ROM_REGION(0x100000,REGION_CPU1, 0) |
| 757 | 816 | // ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 758 | 817 | ROM_LOAD16_BYTE("at111585.0", 0xf0000, 0x8000, CRC(4995be7a) SHA1(8e8e5c863ae3b8c55fd394e345d8cca48b6e575c)) |
| 759 | | ROM_RELOAD(0xff0000,0x8000) |
| 760 | 818 | ROM_LOAD16_BYTE("at111585.1", 0xf0001, 0x8000, CRC(c32713e4) SHA1(22ed4e2be9f948682891e2fd056a97dbea01203c)) |
| 761 | | ROM_RELOAD(0xff0001,0x8000) |
| 762 | 819 | ROM_REGION(0x08100, REGION_GFX1, 0) |
| 763 | 820 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| 764 | 821 | |
| 765 | 822 | /* This region holds the original EGA Video bios */ |
| 766 | 823 | ROM_REGION(0x4000, REGION_USER1, 0) |
| 767 | 824 | ROM_LOAD("6277356.u44", 0x0000, 0x4000, CRC(dc146448) SHA1(dc0794499b3e499c5777b3aa39554bbf0f2cc19b)) |
| 825 | |
| 826 | /* 8042 keyboard controller */ |
| 827 | ROM_REGION( 0x0800, REGION_CPU2, 0 ) |
| 828 | ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729)) |
| 768 | 829 | ROM_END |
| 769 | 830 | |
| 770 | 831 | |
| 832 | ROM_START( ibm5162 ) |
| 833 | ROM_REGION16_LE(0x1000000,REGION_CPU1, 0) |
| 834 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 835 | |
| 836 | ROM_LOAD16_BYTE("78x7460.u34", 0xf0000, 0x8000, CRC(1db4bd8f) SHA1(7be669fbb998d8b4626fefa7cd1208d3b2a88c31)) |
| 837 | ROM_LOAD16_BYTE("78x7461.u35", 0xf0001, 0x8000, CRC(be14b453) SHA1(ec7c10087dbd53f9c6d1174e8f14212e2aec1818)) |
| 838 | |
| 839 | /* Character rom */ |
| 840 | ROM_REGION(0x2000,REGION_GFX1, 0) |
| 841 | ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) |
| 842 | |
| 843 | /* 8042 keyboard controller */ |
| 844 | ROM_REGION( 0x0800, REGION_CPU2, 0 ) |
| 845 | ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729)) |
| 846 | |
| 847 | /* 8051 keytronic keyboard controller */ |
| 848 | ROM_REGION( 0x2000, REGION_CPU3, 0 ) |
| 849 | ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e)) |
| 850 | ROM_END |
| 851 | |
| 852 | |
| 771 | 853 | ROM_START( i8530286 ) |
| 772 | 854 | ROM_REGION(0x1000000,REGION_CPU1, 0) |
| 773 | 855 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| r2942 | r2943 | |
| 788 | 870 | ROM_RELOAD(0xff0000,0x8000) |
| 789 | 871 | ROM_REGION(0x08100, REGION_GFX1, 0) |
| 790 | 872 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| 873 | |
| 874 | /* 8042 keyboard controller */ |
| 875 | ROM_REGION( 0x0800, REGION_CPU2, 0 ) |
| 876 | ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729)) |
| 791 | 877 | ROM_END |
| 792 | 878 | |
| 793 | 879 | |
| r2942 | r2943 | |
| 893 | 979 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 894 | 980 | COMP ( 1984, ibm5170, 0, ibm5160, ibm5170, atcga, atega, ibmat, "International Business Machines", "IBM PC/AT 5170", GAME_NOT_WORKING ) |
| 895 | 981 | COMP ( 1985, ibm5170a, ibm5170, 0, ibm5170a, atcga, atega, ibmat, "International Business Machines", "IBM PC/AT 5170 8MHz", GAME_NOT_WORKING ) |
| 982 | COMP ( 1985, ibm5162, ibm5170, 0, ibm5162, atcga, atcga, ibmat, "International Business Machines", "IBM PC/XT 5162", GAME_NOT_WORKING ) |
| 896 | 983 | COMP ( 1988, i8530286, ibm5170, 0, ps2m30286, atvga, ps2m30286, ibmat, "International Business Machines", "IBM PS2 Model 30 286", GAME_NOT_WORKING ) |
| 897 | 984 | COMP ( 1987, at, ibm5170, 0, ibm5170a, atcga, atcga, ibmat, "", "PC/AT (CGA, MF2 Keyboard)", GAME_NOT_WORKING ) |
| 898 | 985 | COMP ( 1989, neat, ibm5170, 0, ibm5170a, atcga, atcga, ibmat, "", "NEAT (CGA, MF2 Keyboard)", GAME_NOT_WORKING ) |
src/mess/drivers/pc.c
| r2942 | r2943 | |
| 2 | 2 | |
| 3 | 3 | drivers/pc.c |
| 4 | 4 | |
| 5 | Driver file for IBM PC, IBM PC XT, and related machines. |
| 6 | |
| 5 | 7 | PC-XT memory map |
| 6 | 8 | |
| 7 | 9 | 00000-9FFFF RAM |
| r2942 | r2943 | |
| 15 | 17 | F0000-FDFFF NOP or ROM Basic + other Extensions |
| 16 | 18 | FE000-FFFFF ROM |
| 17 | 19 | |
| 20 | IBM PC 5150 |
| 21 | =========== |
| 18 | 22 | |
| 23 | IBM PC-JR |
| 24 | ========= |
| 25 | |
| 26 | IBM PC-XT 5160 |
| 27 | ============== |
| 28 | |
| 19 | 29 | Tandy 1000 (8086/8088) variations: |
| 20 | 30 | 1000 128KB-640KB RAM 4.77 MHz v01.00.00, v01.01.00 |
| 21 | 31 | 1000A/1000HD 128KB-640KB RAM 4.77 MHz v01.01.00 |
| r2942 | r2943 | |
| 76 | 86 | #include "includes/ibmpc.h" |
| 77 | 87 | |
| 78 | 88 | #include "machine/pcshare.h" |
| 79 | | #include "audio/pc.h" |
| 80 | 89 | #include "includes/pc.h" |
| 81 | 90 | |
| 82 | 91 | #include "machine/pc_hdc.h" |
| r2942 | r2943 | |
| 1196 | 1205 | MDRV_MACHINE_RESET(pc) |
| 1197 | 1206 | |
| 1198 | 1207 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1199 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1208 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1200 | 1209 | |
| 1201 | 1210 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1202 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1211 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1203 | 1212 | |
| 1204 | 1213 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1205 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1214 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1206 | 1215 | |
| 1207 | 1216 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1208 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1217 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1209 | 1218 | |
| 1210 | 1219 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1211 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1220 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1212 | 1221 | |
| 1213 | 1222 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1214 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1223 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1215 | 1224 | |
| 1216 | 1225 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1217 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1226 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1218 | 1227 | |
| 1219 | 1228 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1220 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1229 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1221 | 1230 | |
| 1222 | 1231 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1223 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1232 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1224 | 1233 | |
| 1225 | 1234 | /* video hardware */ |
| 1226 | 1235 | MDRV_IMPORT_FROM( pcvideo_mda ) |
| 1227 | 1236 | |
| 1228 | 1237 | /* sound hardware */ |
| 1229 | 1238 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1230 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1231 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1239 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1232 | 1240 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1233 | 1241 | #ifdef ADLIB |
| 1234 | 1242 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 1260 | 1268 | MDRV_MACHINE_RESET(pc) |
| 1261 | 1269 | |
| 1262 | 1270 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1263 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1271 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1264 | 1272 | |
| 1265 | 1273 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1266 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1274 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1267 | 1275 | |
| 1268 | 1276 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1269 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1277 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1270 | 1278 | |
| 1271 | 1279 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1272 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1280 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1273 | 1281 | |
| 1274 | 1282 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1275 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1283 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1276 | 1284 | |
| 1277 | 1285 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1278 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1286 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1279 | 1287 | |
| 1280 | 1288 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1281 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1289 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1282 | 1290 | |
| 1283 | 1291 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1284 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1292 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1285 | 1293 | |
| 1286 | 1294 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1287 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1295 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1288 | 1296 | |
| 1289 | 1297 | /* video hardware */ |
| 1290 | 1298 | MDRV_IMPORT_FROM( pcvideo_hercules ) |
| 1291 | 1299 | |
| 1292 | 1300 | /* sound hardware */ |
| 1293 | 1301 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1294 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1295 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1302 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1296 | 1303 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1297 | 1304 | #ifdef ADLIB |
| 1298 | 1305 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 1320 | 1327 | MDRV_MACHINE_RESET(pc) |
| 1321 | 1328 | |
| 1322 | 1329 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1323 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1330 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1324 | 1331 | |
| 1325 | 1332 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1326 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1333 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1327 | 1334 | |
| 1328 | 1335 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1329 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1336 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1330 | 1337 | |
| 1331 | 1338 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1332 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1339 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1333 | 1340 | |
| 1334 | 1341 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1335 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1342 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1336 | 1343 | |
| 1337 | 1344 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1338 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1345 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1339 | 1346 | |
| 1340 | 1347 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1341 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1348 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1342 | 1349 | |
| 1343 | 1350 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1344 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1351 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1345 | 1352 | |
| 1346 | 1353 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1347 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1354 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1348 | 1355 | |
| 1349 | 1356 | /* video hardware */ |
| 1350 | 1357 | MDRV_IMPORT_FROM( pcvideo_cga ) |
| 1351 | 1358 | |
| 1352 | 1359 | /* sound hardware */ |
| 1353 | 1360 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1354 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1355 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1361 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1356 | 1362 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1357 | 1363 | #ifdef ADLIB |
| 1358 | 1364 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 1381 | 1387 | MDRV_MACHINE_RESET(pc) |
| 1382 | 1388 | |
| 1383 | 1389 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1384 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1390 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1385 | 1391 | |
| 1386 | 1392 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1387 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1393 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1388 | 1394 | |
| 1389 | 1395 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1390 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1396 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1391 | 1397 | |
| 1392 | 1398 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1393 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1399 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1394 | 1400 | |
| 1395 | 1401 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1396 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1402 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1397 | 1403 | |
| 1398 | 1404 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1399 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1405 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1400 | 1406 | |
| 1401 | 1407 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1402 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1408 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1403 | 1409 | |
| 1404 | 1410 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1405 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1411 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1406 | 1412 | |
| 1407 | 1413 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1408 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1414 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1409 | 1415 | |
| 1410 | 1416 | /* video hardware */ |
| 1411 | 1417 | MDRV_IMPORT_FROM( pcvideo_aga ) |
| 1412 | 1418 | |
| 1413 | 1419 | /* sound hardware */ |
| 1414 | 1420 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1415 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1416 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1421 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1417 | 1422 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1418 | 1423 | #ifdef ADLIB |
| 1419 | 1424 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 1438 | 1443 | MDRV_MACHINE_RESET(pc) |
| 1439 | 1444 | |
| 1440 | 1445 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1441 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1446 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1442 | 1447 | |
| 1443 | 1448 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1444 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1449 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1445 | 1450 | |
| 1446 | 1451 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1447 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1452 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1448 | 1453 | |
| 1449 | 1454 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1450 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1455 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1451 | 1456 | |
| 1452 | 1457 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1453 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1458 | MDRV_DEVICE_CONFIG( ibm5160_ppi8255_interface ) |
| 1454 | 1459 | |
| 1455 | 1460 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1456 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1461 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1457 | 1462 | |
| 1458 | 1463 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1459 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1464 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1460 | 1465 | |
| 1461 | 1466 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1462 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1467 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1463 | 1468 | |
| 1464 | 1469 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1465 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1470 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1466 | 1471 | |
| 1467 | 1472 | /* video hardware */ |
| 1468 | 1473 | MDRV_IMPORT_FROM( pcvideo_cga ) |
| 1469 | 1474 | |
| 1470 | 1475 | /* sound hardware */ |
| 1471 | 1476 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1472 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1473 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1477 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1474 | 1478 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1475 | 1479 | #ifdef ADLIB |
| 1476 | 1480 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 1499 | 1503 | MDRV_MACHINE_RESET(pc) |
| 1500 | 1504 | |
| 1501 | 1505 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1502 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1506 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1503 | 1507 | |
| 1504 | 1508 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1505 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1509 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1506 | 1510 | |
| 1507 | 1511 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1508 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1512 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1509 | 1513 | |
| 1510 | 1514 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1511 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1515 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1512 | 1516 | |
| 1513 | 1517 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1514 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1518 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1515 | 1519 | |
| 1516 | 1520 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1517 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1521 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1518 | 1522 | |
| 1519 | 1523 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1520 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1524 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1521 | 1525 | |
| 1522 | 1526 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1523 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1527 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1524 | 1528 | |
| 1525 | 1529 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1526 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1530 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1527 | 1531 | |
| 1528 | 1532 | /* video hardware */ |
| 1529 | 1533 | MDRV_IMPORT_FROM( pcvideo_pc200 ) |
| 1530 | 1534 | |
| 1531 | 1535 | /* sound hardware */ |
| 1532 | 1536 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1533 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1534 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1537 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1535 | 1538 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1536 | 1539 | |
| 1537 | 1540 | /* printer */ |
| r2942 | r2943 | |
| 1549 | 1552 | MDRV_MACHINE_RESET(pc) |
| 1550 | 1553 | |
| 1551 | 1554 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1552 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1555 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1553 | 1556 | |
| 1554 | 1557 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1555 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1558 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1556 | 1559 | |
| 1557 | 1560 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1558 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1561 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1559 | 1562 | |
| 1560 | 1563 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1561 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1564 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1562 | 1565 | |
| 1563 | 1566 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1564 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1567 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1565 | 1568 | |
| 1566 | 1569 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1567 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1570 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1568 | 1571 | |
| 1569 | 1572 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1570 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1573 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1571 | 1574 | |
| 1572 | 1575 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1573 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1576 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1574 | 1577 | |
| 1575 | 1578 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1576 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1579 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1577 | 1580 | |
| 1578 | 1581 | /* video hardware */ |
| 1579 | 1582 | MDRV_IMPORT_FROM( pcvideo_pc1512 ) |
| 1580 | 1583 | |
| 1581 | 1584 | /* sound hardware */ |
| 1582 | 1585 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1583 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1584 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1586 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1585 | 1587 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1586 | 1588 | |
| 1587 | 1589 | MDRV_NVRAM_HANDLER( mc146818 ) |
| r2942 | r2943 | |
| 1601 | 1603 | MDRV_MACHINE_RESET(pc) |
| 1602 | 1604 | |
| 1603 | 1605 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1604 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1606 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1605 | 1607 | |
| 1606 | 1608 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1607 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1609 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1608 | 1610 | |
| 1609 | 1611 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1610 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1612 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1611 | 1613 | |
| 1612 | 1614 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1613 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1615 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1614 | 1616 | |
| 1615 | 1617 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1616 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1618 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1617 | 1619 | |
| 1618 | 1620 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1619 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1621 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1620 | 1622 | |
| 1621 | 1623 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1622 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1624 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1623 | 1625 | |
| 1624 | 1626 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1625 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1627 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1626 | 1628 | |
| 1627 | 1629 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1628 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1630 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1629 | 1631 | |
| 1630 | 1632 | /* video hardware */ |
| 1631 | 1633 | MDRV_IMPORT_FROM(pcvideo_pc1640) |
| r2942 | r2943 | |
| 1635 | 1637 | |
| 1636 | 1638 | /* sound hardware */ |
| 1637 | 1639 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1638 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1639 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1640 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1640 | 1641 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1641 | 1642 | |
| 1642 | 1643 | MDRV_NVRAM_HANDLER( mc146818 ) |
| r2942 | r2943 | |
| 1656 | 1657 | MDRV_MACHINE_RESET(pc) |
| 1657 | 1658 | |
| 1658 | 1659 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1659 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1660 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1660 | 1661 | |
| 1661 | 1662 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1662 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1663 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1663 | 1664 | |
| 1664 | 1665 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1665 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1666 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1666 | 1667 | |
| 1667 | 1668 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1668 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1669 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1669 | 1670 | |
| 1670 | 1671 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1671 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1672 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1672 | 1673 | |
| 1673 | 1674 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1674 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1675 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1675 | 1676 | |
| 1676 | 1677 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1677 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1678 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1678 | 1679 | |
| 1679 | 1680 | MDRV_DEVICE_ADD( "ins8250_2", INS8250 ) /* TODO: Verify model */ |
| 1680 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] ) |
| 1681 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] ) |
| 1681 | 1682 | |
| 1682 | 1683 | MDRV_DEVICE_ADD( "ins8250_3", INS8250 ) /* TODO: Verify model */ |
| 1683 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] ) |
| 1684 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] ) |
| 1684 | 1685 | |
| 1685 | 1686 | /* video hardware */ |
| 1686 | 1687 | MDRV_IMPORT_FROM( pcvideo_vga ) |
| r2942 | r2943 | |
| 1690 | 1691 | |
| 1691 | 1692 | /* sound hardware */ |
| 1692 | 1693 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1693 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1694 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1694 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1695 | 1695 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1696 | 1696 | #ifdef ADLIB |
| 1697 | 1697 | MDRV_SOUND_ADD(YM3812, ym3812_StdClock) |
| r2942 | r2943 | |
| 1715 | 1715 | MDRV_MACHINE_RESET(pc) |
| 1716 | 1716 | |
| 1717 | 1717 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1718 | | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1718 | MDRV_DEVICE_CONFIG( ibm5150_pit8253_config ) |
| 1719 | 1719 | |
| 1720 | 1720 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1721 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1721 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1722 | 1722 | |
| 1723 | 1723 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1724 | | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1724 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config ) |
| 1725 | 1725 | |
| 1726 | 1726 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1727 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1727 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1728 | 1728 | |
| 1729 | 1729 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1730 | | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1730 | MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface ) |
| 1731 | 1731 | |
| 1732 | 1732 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1733 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1733 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1734 | 1734 | |
| 1735 | 1735 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1736 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1736 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1737 | 1737 | |
| 1738 | 1738 | /* video hardware */ |
| 1739 | 1739 | MDRV_IMPORT_FROM( pcvideo_t1000 ) |
| 1740 | 1740 | |
| 1741 | 1741 | /* sound hardware */ |
| 1742 | 1742 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1743 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1744 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1743 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1745 | 1744 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1746 | 1745 | MDRV_SOUND_ADD(SN76496, 2386360) |
| 1747 | 1746 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| r2942 | r2943 | |
| 1766 | 1765 | MDRV_DEVICE_CONFIG( pcjr_pit8253_config ) |
| 1767 | 1766 | |
| 1768 | 1767 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1769 | | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1768 | MDRV_DEVICE_CONFIG( ibm5150_dma8237_config ) |
| 1770 | 1769 | |
| 1771 | 1770 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1772 | 1771 | MDRV_DEVICE_CONFIG( pcjr_pic8259_master_config ) |
| 1773 | 1772 | |
| 1774 | 1773 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1775 | | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1774 | MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config ) |
| 1776 | 1775 | |
| 1777 | 1776 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1778 | 1777 | MDRV_DEVICE_CONFIG( pcjr_ppi8255_interface ) |
| 1779 | 1778 | |
| 1780 | 1779 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1781 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1780 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] ) |
| 1782 | 1781 | |
| 1783 | 1782 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1784 | | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1783 | MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] ) |
| 1785 | 1784 | |
| 1786 | 1785 | /* video hardware */ |
| 1787 | 1786 | MDRV_IMPORT_FROM( pcvideo_pcjr ) |
| 1788 | 1787 | |
| 1789 | 1788 | /* sound hardware */ |
| 1790 | 1789 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1791 | | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1792 | | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1790 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 1793 | 1791 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1794 | 1792 | MDRV_SOUND_ADD(SN76496, 2386360) |
| 1795 | 1793 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| r2942 | r2943 | |
| 2095 | 2093 | ROMX_LOAD("68x4370.u19", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2), ROM_BIOS(4)) |
| 2096 | 2094 | ROMX_LOAD("62x0890.u18", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb), ROM_BIOS(4)) |
| 2097 | 2095 | |
| 2098 | | // ROM_SYSTEM_BIOS( 4, "xtdiag", "IBM XT 5160 w/Supersoft Diagnostics" ) /* ROMs marked as BAD_DUMP for now. We expect the data to be in a different ROM chip layout */ |
| 2099 | | // ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) ) |
| 2100 | | // ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) ) |
| 2101 | | // ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) ) |
| 2102 | | // ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) ) |
| 2103 | | // ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) ) |
| 2096 | ROM_SYSTEM_BIOS( 4, "xtdiag", "IBM XT 5160 w/Supersoft Diagnostics" ) /* ROMs marked as BAD_DUMP for now. We expect the data to be in a different ROM chip layout */ |
| 2097 | ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) ) |
| 2098 | ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) ) |
| 2099 | ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) ) |
| 2100 | ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) ) |
| 2101 | ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) ) |
| 2104 | 2102 | |
| 2105 | 2103 | /* Character rom */ |
| 2106 | 2104 | ROM_REGION(0x2000,REGION_GFX1, 0) |
| 2107 | 2105 | ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) |
| 2108 | 2106 | ROM_END |
| 2109 | 2107 | |
| 2108 | |
| 2110 | 2109 | ROM_START( xtvga ) |
| 2111 | 2110 | ROM_REGION(0x100000,REGION_CPU1, 0) |
| 2112 | 2111 | ROM_LOAD("et4000.bin", 0xc0000, 0x8000, CRC(f01e4be0) SHA1(95d75ff41bcb765e50bd87a8da01835fd0aa01d5)) |
| r2942 | r2943 | |
| 2269 | 2268 | CONFIG_DEVICE(ibmpc_harddisk_getinfo) |
| 2270 | 2269 | SYSTEM_CONFIG_END |
| 2271 | 2270 | |
| 2271 | |
| 2272 | static SYSTEM_CONFIG_START(ibm5160) |
| 2273 | CONFIG_RAM_DEFAULT( 640 * 1024 ) |
| 2274 | CONFIG_DEVICE(ibmpc_floppy_getinfo) |
| 2275 | CONFIG_DEVICE(ibmpc_harddisk_getinfo) |
| 2276 | SYSTEM_CONFIG_END |
| 2277 | |
| 2278 | |
| 2272 | 2279 | static SYSTEM_CONFIG_START(pcjr) |
| 2273 | 2280 | CONFIG_RAM_DEFAULT( 640 * 1024 ) |
| 2274 | 2281 | CONFIG_DEVICE(ibmpc_cassette_getinfo) |
| r2942 | r2943 | |
| 2295 | 2302 | COMP( 1987, t1000sx, ibm5150, 0, t1000hx, tandy1t, t1000hx, ibmpc, "Tandy Radio Shack", "Tandy 1000SX", 0) |
| 2296 | 2303 | |
| 2297 | 2304 | // xt class (pc but 8086) |
| 2298 | | COMP( 1982, ibm5160, ibm5150, 0, ibm5160, xtcga, pccga, ibmpc, "International Business Machines", "IBM XT 5160" , 0) |
| 2305 | COMP( 1982, ibm5160, ibm5150, 0, ibm5160, xtcga, pccga, ibm5160, "International Business Machines", "IBM XT 5160" , 0) |
| 2299 | 2306 | COMP( 1988, pc200, ibm5150, 0, pc200, pc200, pc200, ibmpc, "Sinclair Research", "PC200 Professional Series", GAME_NOT_WORKING) |
| 2300 | 2307 | COMP( 1988, pc20, ibm5150, 0, pc200, pc200, pc200, ibmpc, "Amstrad plc", "Amstrad PC20" , GAME_NOT_WORKING) |
| 2301 | 2308 | COMP( 1987, ppc512, ibm5150, 0, pc200, pc200, pc200, ibmpc, "Amstrad plc", "Amstrad PPC512", 0) |