src/mess/drivers/vtech1.c
| r2085 | r2086 | |
| 270 | 270 | PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 271 | 271 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) |
| 272 | 272 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 273 | |
| 274 | /* Enhanced options not available on real hardware */ |
| 275 | PORT_START_TAG("CONFIG") |
| 276 | PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") |
| 277 | PORT_CONFSETTING( 0x00, DEF_STR(No)) |
| 278 | PORT_CONFSETTING( 0x01, DEF_STR(Yes)) |
| 279 | // PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") |
| 280 | // PORT_CONFSETTING( 0x08, DEF_STR(On)) |
| 281 | // PORT_CONFSETTING( 0x00, DEF_STR(Off)) |
| 273 | 282 | INPUT_PORTS_END |
| 274 | 283 | |
| 275 | 284 | |
| r2085 | r2086 | |
| 394 | 403 | System Config |
| 395 | 404 | ******************************************************************************/ |
| 396 | 405 | |
| 406 | static QUICKLOAD_LOAD( vtech1 ) |
| 407 | { |
| 408 | UINT8 sw = readinputportbytag("CONFIG") & 1; /* reading the dipswitch: 1 = autorun */ |
| 409 | UINT16 exec_addr, start_addr, end_addr; |
| 410 | |
| 411 | if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL) |
| 412 | return INIT_FAIL; |
| 413 | |
| 414 | /* A Microsoft Basic program needs some manipulation before it can be run. |
| 415 | 1. A start address of 7ae9 indicates a basic program which needs its pointers fixed up. |
| 416 | 2. If autorun is turned off, the pointers still need fixing, but then display READY. |
| 417 | NOTE: This overrides the exec_addr of 0xffff. |
| 418 | Important addresses: |
| 419 | 7ae9 = start (load) address of a conventional basic program |
| 420 | 791e = custom routine to fix basic pointers */ |
| 421 | |
| 422 | program_write_word_16le(0x791c,end_addr+1); |
| 423 | program_write_word_16le(0x781e,exec_addr); |
| 424 | |
| 425 | if (start_addr == 0x7ae9) |
| 426 | { |
| 427 | UINT8 i, data[17]={ |
| 428 | 0xe5, // PUSH HL ;save pcode pointer |
| 429 | 0x2a, 0x1c, 0x79, // LD HL,(791C) ;get saved end_addr+1 |
| 430 | 0x22, 0xf9, 0x78, // LD (78F9),HL ;move it to correct place |
| 431 | 0x21, 0x39, 0x78, // LD HL,7839 ;point to control flag |
| 432 | 0xcb, 0xf6, // SET 6,(HL) ;turn on autorun (cb b6 = manual run) |
| 433 | 0xcb, 0x9e, // RES 3,(HL) ;turn off verify (just in case) |
| 434 | 0xc3, 0xcf, 0x36,}; // JP 36CF ;enter bios at autorun point |
| 435 | |
| 436 | for (i = 0; i < 17; i++) program_write_byte(0x791e + i, data[i]); |
| 437 | if (!sw) program_write_byte(0x7929, 0xb6); /* turn off autorun */ |
| 438 | cpunum_set_reg(0, REG_PC, 0x791e); |
| 439 | } |
| 440 | else |
| 441 | if ((exec_addr != 0xffff) && (sw)) cpunum_set_reg(0, REG_PC, exec_addr); |
| 442 | |
| 443 | return INIT_PASS; |
| 444 | } |
| 445 | |
| 446 | static void vtech1_quickload_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 447 | { |
| 448 | /* quickload */ |
| 449 | switch(state) |
| 450 | { |
| 451 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 452 | case MESS_DEVINFO_STR_DEV_FILE: strcpy(info->s = device_temp_str(), __FILE__); break; |
| 453 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "bin"); break; |
| 454 | |
| 455 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 456 | case MESS_DEVINFO_PTR_QUICKLOAD_LOAD: info->f = (genf *) quickload_load_vtech1; break; |
| 457 | |
| 458 | default: quickload_device_getinfo(devclass, state, info); break; |
| 459 | } |
| 460 | } |
| 461 | |
| 397 | 462 | static void vtech1_printer_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 398 | 463 | { |
| 399 | 464 | /* printer */ |
| r2085 | r2086 | |
| 477 | 542 | CONFIG_DEVICE(vtech1_cassette_getinfo) |
| 478 | 543 | CONFIG_DEVICE(vtech1_snapshot_getinfo) |
| 479 | 544 | CONFIG_DEVICE(vtech1_floppy_getinfo) |
| 480 | | CONFIG_DEVICE(z80bin_quickload_getinfo) |
| 545 | CONFIG_DEVICE(vtech1_quickload_getinfo) |
| 481 | 546 | CONFIG_RAM_DEFAULT (66 * 1024) /* with 64K memory expansion */ |
| 482 | 547 | CONFIG_RAM (4098 * 1024) /* with 4MB memory expansion */ |
| 483 | 548 | SYSTEM_CONFIG_END |