src/mess/machine/ti85.c
| r5211 | r5212 | |
| 21 | 21 | TI_NOT_INITIALIZED, |
| 22 | 22 | TI_81, |
| 23 | 23 | TI_82, |
| 24 | TI_83, |
| 25 | TI_83p, |
| 24 | 26 | TI_85, |
| 25 | 27 | TI_86 |
| 26 | 28 | }; |
| r5211 | r5212 | |
| 34 | 36 | static UINT8 ti85_ON_interrupt_status; |
| 35 | 37 | static UINT8 ti85_ON_pressed; |
| 36 | 38 | |
| 37 | | static UINT8 ti85_memory_page_0x4000; |
| 38 | | static UINT8 ti86_memory_page_0x8000; |
| 39 | static UINT8 ti8x_memory_page_1; |
| 40 | static UINT8 ti8x_memory_page_2; |
| 39 | 41 | |
| 40 | 42 | UINT8 ti85_LCD_memory_base; |
| 41 | 43 | UINT8 ti85_LCD_contrast; |
| r5211 | r5212 | |
| 51 | 53 | |
| 52 | 54 | static UINT8 ti81_port_7_data; |
| 53 | 55 | |
| 54 | | static UINT8 *ti86_ram = NULL; |
| 56 | static UINT8 *ti8x_ram = NULL; |
| 55 | 57 | |
| 56 | 58 | static ti85_serial_data ti85_serial_stream; |
| 57 | 59 | |
| r5211 | r5212 | |
| 71 | 73 | static UINT8 ti82_video_bit; |
| 72 | 74 | static UINT8 ti82_video_col; |
| 73 | 75 | static UINT8 ti8x_port2; |
| 76 | static UINT8 ti83p_port4; |
| 74 | 77 | UINT8 ti82_video_buffer[0x300]; |
| 75 | 78 | |
| 76 | 79 | enum |
| r5211 | r5212 | |
| 143 | 146 | |
| 144 | 147 | static void update_ti85_memory (running_machine *machine) |
| 145 | 148 | { |
| 146 | | memory_set_bankptr(machine, 2,memory_region(machine, "maincpu") + 0x010000 + 0x004000*ti85_memory_page_0x4000); |
| 149 | memory_set_bankptr(machine, 2,memory_region(machine, "maincpu") + 0x010000 + 0x004000*ti8x_memory_page_1); |
| 147 | 150 | } |
| 148 | 151 | |
| 152 | static void update_ti83p_memory (running_machine *machine) |
| 153 | { |
| 154 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 155 | |
| 156 | if (ti8x_memory_page_1 & 0x40) |
| 157 | { |
| 158 | if (ti83p_port4 & 1) |
| 159 | { |
| 160 | |
| 161 | memory_set_bankptr(machine, 3, ti8x_ram + 0x004000*(ti8x_memory_page_1&0x01)); |
| 162 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_BANK(3)); |
| 163 | } |
| 164 | else |
| 165 | { |
| 166 | memory_set_bankptr(machine, 2, ti8x_ram + 0x004000*(ti8x_memory_page_1&0x01)); |
| 167 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK(2)); |
| 168 | } |
| 169 | } |
| 170 | else |
| 171 | { |
| 172 | if (ti83p_port4 & 1) |
| 173 | { |
| 174 | memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti8x_memory_page_1&0x1f)); |
| 175 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_UNMAP); |
| 176 | } |
| 177 | else |
| 178 | { |
| 179 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti8x_memory_page_1&0x1f)); |
| 180 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | if (ti8x_memory_page_2 & 0x40) |
| 185 | { |
| 186 | if (ti83p_port4 & 1) |
| 187 | { |
| 188 | memory_set_bankptr(machine, 4, ti8x_ram + 0x004000*(ti8x_memory_page_2&0x01)); |
| 189 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, SMH_BANK(4)); |
| 190 | } |
| 191 | else |
| 192 | { |
| 193 | memory_set_bankptr(machine, 3, ti8x_ram + 0x004000*(ti8x_memory_page_2&0x01)); |
| 194 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_BANK(3)); |
| 195 | } |
| 196 | |
| 197 | } |
| 198 | else |
| 199 | { |
| 200 | if (ti83p_port4 & 1) |
| 201 | { |
| 202 | memory_set_bankptr(machine, 4, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti8x_memory_page_2&0x1f)); |
| 203 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, SMH_UNMAP); |
| 204 | } |
| 205 | else |
| 206 | { |
| 207 | memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti8x_memory_page_2&0x1f)); |
| 208 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_UNMAP); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 149 | 213 | static void update_ti86_memory (running_machine *machine) |
| 150 | 214 | { |
| 151 | 215 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 152 | 216 | write8_space_func wh; |
| 153 | 217 | |
| 154 | | if (ti85_memory_page_0x4000 & 0x40) |
| 218 | if (ti8x_memory_page_1 & 0x40) |
| 155 | 219 | { |
| 156 | | memory_set_bankptr(machine, 2, ti86_ram + 0x004000*(ti85_memory_page_0x4000&0x07)); |
| 157 | | memory_set_bankptr(machine, 6, ti86_ram + 0x004000*(ti85_memory_page_0x4000&0x07)); |
| 158 | | wh = SMH_BANK(6); |
| 220 | memory_set_bankptr(machine, 2, ti8x_ram + 0x004000*(ti8x_memory_page_1&0x07)); |
| 221 | wh = SMH_BANK(2); |
| 159 | 222 | } |
| 160 | 223 | else |
| 161 | 224 | { |
| 162 | | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti85_memory_page_0x4000&0x0f)); |
| 225 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti8x_memory_page_1&0x0f)); |
| 163 | 226 | wh = SMH_UNMAP; |
| 164 | 227 | } |
| 165 | 228 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, wh); |
| 166 | 229 | |
| 167 | | if (ti86_memory_page_0x8000 & 0x40) |
| 230 | if (ti8x_memory_page_2 & 0x40) |
| 168 | 231 | { |
| 169 | | memory_set_bankptr(machine, 3, ti86_ram + 0x004000*(ti86_memory_page_0x8000&0x07)); |
| 170 | | memory_set_bankptr(machine, 7, ti86_ram + 0x004000*(ti86_memory_page_0x8000&0x07)); |
| 171 | | wh = SMH_BANK(7); |
| 232 | memory_set_bankptr(machine, 3, ti8x_ram + 0x004000*(ti8x_memory_page_2&0x07)); |
| 233 | wh = SMH_BANK(3); |
| 172 | 234 | } |
| 173 | 235 | else |
| 174 | 236 | { |
| 175 | | memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti86_memory_page_0x8000&0x0f)); |
| 237 | memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x010000 + 0x004000*(ti8x_memory_page_2&0x0f)); |
| 176 | 238 | wh = SMH_UNMAP; |
| 177 | 239 | } |
| 178 | 240 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, wh); |
| r5211 | r5212 | |
| 194 | 256 | ti85_ON_pressed = 0; |
| 195 | 257 | ti85_power_mode = 0; |
| 196 | 258 | ti85_keypad_mask = 0; |
| 197 | | ti85_memory_page_0x4000 = 0; |
| 259 | ti8x_memory_page_1 = 0; |
| 198 | 260 | ti85_LCD_memory_base = 0; |
| 199 | 261 | ti85_LCD_status = 0; |
| 200 | 262 | ti85_LCD_mask = 0; |
| r5211 | r5212 | |
| 226 | 288 | ti85_ON_interrupt_mask = 0; |
| 227 | 289 | ti85_ON_interrupt_status = 0; |
| 228 | 290 | ti85_ON_pressed = 0; |
| 229 | | ti85_memory_page_0x4000 = 0; |
| 291 | ti8x_memory_page_1 = 0; |
| 230 | 292 | ti85_LCD_status = 0; |
| 231 | 293 | ti85_LCD_mask = 0; |
| 232 | 294 | ti85_power_mode = 0; |
| r5211 | r5212 | |
| 269 | 331 | ti85_ON_interrupt_mask = 0; |
| 270 | 332 | ti85_ON_interrupt_status = 0; |
| 271 | 333 | ti85_ON_pressed = 0; |
| 272 | | ti85_memory_page_0x4000 = 0; |
| 334 | ti8x_memory_page_1 = 0; |
| 273 | 335 | ti85_LCD_memory_base = 0; |
| 274 | 336 | ti85_LCD_status = 0; |
| 275 | 337 | ti85_LCD_mask = 0; |
| r5211 | r5212 | |
| 295 | 357 | add_exit_callback(machine, ti85_free_serial_data_memory); |
| 296 | 358 | } |
| 297 | 359 | |
| 360 | MACHINE_START( ti83p ) |
| 361 | { |
| 362 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 363 | UINT8 *mem = memory_region(machine, "maincpu"); |
| 364 | |
| 365 | ti85_timer_interrupt_mask = 0; |
| 366 | ti85_timer_interrupt_status = 0; |
| 367 | ti85_ON_interrupt_mask = 0; |
| 368 | ti85_ON_interrupt_status = 0; |
| 369 | ti85_ON_pressed = 0; |
| 370 | ti8x_memory_page_1 = 0; |
| 371 | ti8x_memory_page_2 = 0; |
| 372 | ti85_LCD_memory_base = 0; |
| 373 | ti85_LCD_status = 0; |
| 374 | ti85_LCD_mask = 0; |
| 375 | ti85_power_mode = 0; |
| 376 | ti85_keypad_mask = 0; |
| 377 | ti85_video_buffer_width = 0; |
| 378 | ti85_interrupt_speed = 0; |
| 379 | ti85_port4_bit0 = 0; |
| 380 | ti82_video_mode = 0; |
| 381 | ti82_video_x = 0; |
| 382 | ti82_video_y = 0; |
| 383 | ti82_video_dir = 0; |
| 384 | ti82_video_scroll = 0; |
| 385 | ti82_video_bit = 0; |
| 386 | ti82_video_col = 0; |
| 387 | memset(ti82_video_buffer, 0x00, 0x300); |
| 388 | |
| 389 | ti8x_ram = auto_alloc_array(machine, UINT8, 32*1024); |
| 390 | { |
| 391 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 392 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); |
| 393 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_UNMAP); |
| 394 | |
| 395 | memory_set_bankptr(machine, 1, mem + 0x010000); |
| 396 | memory_set_bankptr(machine, 2, mem + 0x010000); |
| 397 | memory_set_bankptr(machine, 3, mem + 0x010000); |
| 398 | memory_set_bankptr(machine, 4, ti8x_ram); |
| 399 | |
| 400 | if (ti_calculator_model == TI_83p) |
| 401 | memset(ti8x_ram, 0, sizeof(unsigned char)*32*1024); |
| 402 | |
| 403 | // memset(mem + 0x83000, 0xff, 0x1000); |
| 404 | |
| 405 | ti_calculator_model = TI_83p; |
| 406 | |
| 407 | timer_pulse(machine, ATTOTIME_IN_HZ(200), NULL, 0, ti85_timer_callback); |
| 408 | } |
| 409 | |
| 410 | add_reset_callback(machine, ti85_reset_serial); |
| 411 | add_exit_callback(machine, ti85_free_serial_data_memory); |
| 412 | } |
| 413 | |
| 414 | |
| 298 | 415 | MACHINE_START( ti86 ) |
| 299 | 416 | { |
| 300 | 417 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5211 | r5212 | |
| 305 | 422 | ti85_ON_interrupt_mask = 0; |
| 306 | 423 | ti85_ON_interrupt_status = 0; |
| 307 | 424 | ti85_ON_pressed = 0; |
| 308 | | ti85_memory_page_0x4000 = 0; |
| 309 | | ti86_memory_page_0x8000 = 0; |
| 425 | ti8x_memory_page_1 = 0; |
| 426 | ti8x_memory_page_2 = 0; |
| 310 | 427 | ti85_LCD_memory_base = 0; |
| 311 | 428 | ti85_LCD_status = 0; |
| 312 | 429 | ti85_LCD_mask = 0; |
| r5211 | r5212 | |
| 316 | 433 | ti85_interrupt_speed = 0; |
| 317 | 434 | ti85_port4_bit0 = 0; |
| 318 | 435 | |
| 319 | | ti86_ram = auto_alloc_array(machine, UINT8, 128*1024); |
| 436 | ti8x_ram = auto_alloc_array(machine, UINT8, 128*1024); |
| 320 | 437 | { |
| 321 | 438 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 322 | 439 | |
| 323 | 440 | memory_set_bankptr(machine, 1, mem + 0x010000); |
| 324 | 441 | memory_set_bankptr(machine, 2, mem + 0x014000); |
| 325 | 442 | |
| 326 | | memory_set_bankptr(machine, 4, ti86_ram); |
| 327 | | memory_set_bankptr(machine, 8, ti86_ram); |
| 443 | memory_set_bankptr(machine, 4, ti8x_ram); |
| 328 | 444 | |
| 329 | 445 | if (ti_calculator_model == TI_86) |
| 330 | | memset(ti86_ram, 0, sizeof(unsigned char)*128*1024); |
| 446 | memset(ti8x_ram, 0, sizeof(unsigned char)*128*1024); |
| 331 | 447 | |
| 332 | 448 | ti_calculator_model = TI_86; |
| 333 | 449 | |
| r5211 | r5212 | |
| 396 | 512 | |
| 397 | 513 | READ8_HANDLER ( ti85_port_0005_r ) |
| 398 | 514 | { |
| 399 | | return ti85_memory_page_0x4000; |
| 515 | return ti8x_memory_page_1; |
| 400 | 516 | } |
| 401 | 517 | |
| 402 | 518 | READ8_HANDLER ( ti85_port_0006_r ) |
| r5211 | r5212 | |
| 414 | 530 | | ti85_PCR; |
| 415 | 531 | } |
| 416 | 532 | |
| 533 | READ8_HANDLER ( ti82_port_0000_r ) |
| 534 | { |
| 535 | return 0xff; // TODO |
| 536 | } |
| 537 | |
| 417 | 538 | READ8_HANDLER ( ti82_port_0002_r ) |
| 418 | 539 | { |
| 419 | 540 | return ti8x_port2; |
| r5211 | r5212 | |
| 465 | 586 | |
| 466 | 587 | READ8_HANDLER ( ti86_port_0005_r ) |
| 467 | 588 | { |
| 468 | | return ti85_memory_page_0x4000; |
| 589 | return ti8x_memory_page_1; |
| 469 | 590 | } |
| 470 | 591 | |
| 471 | 592 | READ8_HANDLER ( ti86_port_0006_r ) |
| 472 | 593 | { |
| 473 | | return ti86_memory_page_0x8000; |
| 594 | return ti8x_memory_page_2; |
| 474 | 595 | } |
| 475 | 596 | |
| 476 | 597 | READ8_HANDLER ( ti83_port_0000_r ) |
| 477 | 598 | { |
| 478 | | return ((ti85_memory_page_0x4000 & 0x08) << 1) | 0x0C; |
| 599 | return ((ti8x_memory_page_1 & 0x08) << 1) | 0x0C; |
| 479 | 600 | } |
| 480 | 601 | |
| 481 | 602 | READ8_HANDLER ( ti83_port_0002_r ) |
| r5211 | r5212 | |
| 498 | 619 | return data; |
| 499 | 620 | } |
| 500 | 621 | |
| 622 | READ8_HANDLER ( ti83p_port_0002_r ) |
| 623 | { |
| 624 | return ti8x_port2|3; |
| 625 | } |
| 626 | |
| 501 | 627 | WRITE8_HANDLER ( ti81_port_0007_w ) |
| 502 | 628 | { |
| 503 | 629 | ti81_port_7_data = data; |
| r5211 | r5212 | |
| 536 | 662 | |
| 537 | 663 | WRITE8_HANDLER ( ti85_port_0005_w ) |
| 538 | 664 | { |
| 539 | | ti85_memory_page_0x4000 = data; |
| 665 | ti8x_memory_page_1 = data; |
| 540 | 666 | update_ti85_memory(space->machine); |
| 541 | 667 | } |
| 542 | 668 | |
| r5211 | r5212 | |
| 557 | 683 | |
| 558 | 684 | WRITE8_HANDLER ( ti86_port_0005_w ) |
| 559 | 685 | { |
| 560 | | ti85_memory_page_0x4000 = data&((data&0x40)?0x47:0x4f); |
| 686 | ti8x_memory_page_1 = data&((data&0x40)?0x47:0x4f); |
| 561 | 687 | update_ti86_memory(space->machine); |
| 562 | 688 | } |
| 563 | 689 | |
| 564 | 690 | WRITE8_HANDLER ( ti86_port_0006_w ) |
| 565 | 691 | { |
| 566 | | ti86_memory_page_0x8000 = data&((data&0x40)?0x47:0x4f); |
| 692 | ti8x_memory_page_2 = data&((data&0x40)?0x47:0x4f); |
| 567 | 693 | update_ti86_memory(space->machine); |
| 568 | 694 | } |
| 569 | 695 | |
| 696 | WRITE8_HANDLER ( ti82_port_0000_w ) |
| 697 | { |
| 698 | // TODO |
| 699 | } |
| 700 | |
| 570 | 701 | WRITE8_HANDLER ( ti82_port_0002_w ) |
| 571 | 702 | { |
| 572 | | ti85_memory_page_0x4000 = (data & 0x07); |
| 703 | ti8x_memory_page_1 = (data & 0x07); |
| 573 | 704 | update_ti85_memory(space->machine); |
| 574 | 705 | ti8x_port2 = data; |
| 575 | 706 | } |
| r5211 | r5212 | |
| 622 | 753 | |
| 623 | 754 | WRITE8_HANDLER ( ti83_port_0000_w ) |
| 624 | 755 | { |
| 625 | | ti85_memory_page_0x4000 = (ti85_memory_page_0x4000 & 7) | ((data & 16) >> 1); |
| 756 | ti8x_memory_page_1 = (ti8x_memory_page_1 & 7) | ((data & 16) >> 1); |
| 626 | 757 | update_ti85_memory(space->machine); |
| 627 | 758 | } |
| 628 | 759 | |
| 629 | 760 | WRITE8_HANDLER ( ti83_port_0002_w ) |
| 630 | 761 | { |
| 631 | | ti85_memory_page_0x4000 = (ti85_memory_page_0x4000 & 8) | (data & 7); |
| 762 | ti8x_memory_page_1 = (ti8x_memory_page_1 & 8) | (data & 7); |
| 632 | 763 | update_ti85_memory(space->machine); |
| 633 | 764 | ti8x_port2 = data; |
| 634 | 765 | } |
| r5211 | r5212 | |
| 642 | 773 | ti85_LCD_status = data&0x08; |
| 643 | 774 | } |
| 644 | 775 | |
| 776 | WRITE8_HANDLER ( ti83p_port_0002_w ) |
| 777 | { |
| 778 | ti8x_port2 = data; |
| 779 | } |
| 780 | |
| 781 | WRITE8_HANDLER ( ti83p_port_0003_w ) |
| 782 | { |
| 783 | ti85_LCD_mask = (data&0x08) >> 2; |
| 784 | ti85_ON_interrupt_mask = data & 0x01; |
| 785 | } |
| 786 | |
| 787 | WRITE8_HANDLER ( ti83p_port_0004_w ) |
| 788 | { |
| 789 | if ((data & 1) && !(ti83p_port4 & 1)) |
| 790 | { |
| 791 | ti8x_memory_page_1 = 0x1f; |
| 792 | ti8x_memory_page_2 = 0x1f; |
| 793 | } |
| 794 | else if (!(data & 1) && (ti83p_port4 & 1)) |
| 795 | { |
| 796 | ti8x_memory_page_1 = 0x1f; |
| 797 | ti8x_memory_page_2 = 0x40; |
| 798 | } |
| 799 | update_ti83p_memory(space->machine); |
| 800 | ti83p_port4 = data; |
| 801 | } |
| 802 | |
| 803 | WRITE8_HANDLER ( ti83p_port_0006_w ) |
| 804 | { |
| 805 | ti8x_memory_page_1 = data & ((data&0x40) ? 0x41 : 0x5f); |
| 806 | update_ti83p_memory(space->machine); |
| 807 | } |
| 808 | |
| 809 | WRITE8_HANDLER ( ti83p_port_0007_w ) |
| 810 | { |
| 811 | ti8x_memory_page_2 = data & ((data&0x40) ? 0x41 : 0x5f); |
| 812 | update_ti83p_memory(space->machine); |
| 813 | } |
| 814 | |
| 815 | WRITE8_HANDLER ( ti83p_port_0010_w) |
| 816 | { |
| 817 | if (data == 0x00 || data == 0x01) |
| 818 | ti82_video_mode = data; |
| 819 | if (data == 0x02 || data == 0x03) |
| 820 | ti85_LCD_status = data - 0x02; |
| 821 | if (data >= 0x04 && data <= 0x07) |
| 822 | ti82_video_dir = data; |
| 823 | if (data >= 0x20 && data <= 0x30) |
| 824 | ti82_video_x = data - 0x20; |
| 825 | if (data >= 0x40 && data <= 0x7F) |
| 826 | ti82_video_scroll = data - 0x40; |
| 827 | if (data >= 0x80 && data <= 0xBF) |
| 828 | ti82_video_y = data - 0x80; |
| 829 | if (data >= 0xc8) |
| 830 | ti85_LCD_contrast = data - 0xc8; |
| 831 | |
| 832 | } |
| 833 | |
| 645 | 834 | /* NVRAM functions */ |
| 835 | NVRAM_HANDLER( ti83p ) |
| 836 | { |
| 837 | if (read_or_write) |
| 838 | { |
| 839 | mame_fwrite(file, ti8x_ram, sizeof(unsigned char)*32*1024); |
| 840 | } |
| 841 | else |
| 842 | { |
| 843 | if (file) |
| 844 | { |
| 845 | mame_fread(file, ti8x_ram, sizeof(unsigned char)*32*1024); |
| 846 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0c59); |
| 847 | } |
| 848 | else |
| 849 | memset(ti8x_ram, 0, sizeof(unsigned char)*32*1024); |
| 850 | } |
| 851 | } |
| 852 | |
| 646 | 853 | NVRAM_HANDLER( ti86 ) |
| 647 | 854 | { |
| 648 | 855 | if (read_or_write) |
| 649 | 856 | { |
| 650 | | mame_fwrite(file, ti86_ram, sizeof(unsigned char)*128*1024); |
| 857 | mame_fwrite(file, ti8x_ram, sizeof(unsigned char)*128*1024); |
| 651 | 858 | } |
| 652 | 859 | else |
| 653 | 860 | { |
| 654 | 861 | if (file) |
| 655 | 862 | { |
| 656 | | mame_fread(file, ti86_ram, sizeof(unsigned char)*128*1024); |
| 863 | mame_fread(file, ti8x_ram, sizeof(unsigned char)*128*1024); |
| 657 | 864 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0c59); |
| 658 | 865 | } |
| 659 | 866 | else |
| 660 | | memset(ti86_ram, 0, sizeof(unsigned char)*128*1024); |
| 867 | memset(ti8x_ram, 0, sizeof(unsigned char)*128*1024); |
| 661 | 868 | } |
| 662 | 869 | } |
| 663 | 870 | |
| r5211 | r5212 | |
| 735 | 942 | |
| 736 | 943 | ti85_keypad_mask = hdw[0x00]&0x7f; |
| 737 | 944 | |
| 738 | | ti85_memory_page_0x4000 = hdw[0x08]&0xff; |
| 945 | ti8x_memory_page_1 = hdw[0x08]&0xff; |
| 739 | 946 | update_ti85_memory(machine); |
| 740 | 947 | |
| 741 | 948 | ti85_power_mode = hdw[0x14]&0xff; |
| r5211 | r5212 | |
| 768 | 975 | ti8x_snapshot_setup_registers (machine, data); |
| 769 | 976 | |
| 770 | 977 | /* Memory dump */ |
| 771 | | memcpy(ti86_ram, data+0x94, 0x20000); |
| 978 | memcpy(ti8x_ram, data+0x94, 0x20000); |
| 772 | 979 | |
| 773 | 980 | ti85_keypad_mask = hdw[0x00]&0x7f; |
| 774 | 981 | |
| 775 | | ti85_memory_page_0x4000 = hdw[0x04]&0xff ? 0x40 : 0x00; |
| 776 | | ti85_memory_page_0x4000 |= hdw[0x08]&0x0f; |
| 982 | ti8x_memory_page_1 = hdw[0x04]&0xff ? 0x40 : 0x00; |
| 983 | ti8x_memory_page_1 |= hdw[0x08]&0x0f; |
| 777 | 984 | |
| 778 | | ti86_memory_page_0x8000 = hdw[0x0c]&0xff ? 0x40 : 0x00; |
| 779 | | ti86_memory_page_0x8000 |= hdw[0x10]&0x0f; |
| 985 | ti8x_memory_page_2 = hdw[0x0c]&0xff ? 0x40 : 0x00; |
| 986 | ti8x_memory_page_2 |= hdw[0x10]&0x0f; |
| 780 | 987 | |
| 781 | 988 | update_ti86_memory(machine); |
| 782 | 989 | |
src/mess/drivers/ti85.c
| r5211 | r5212 | |
| 92 | 92 | |
| 93 | 93 | CPU: Z80 6MHz |
| 94 | 94 | 0000-3fff ROM 0 |
| 95 | | 4000-7fff ROM 1-7 (switched) |
| 95 | 4000-7fff ROM 1-15 (switched) |
| 96 | 96 | 8000-ffff RAM |
| 97 | 97 | |
| 98 | TI-83Plus memory map |
| 99 | |
| 100 | CPU: Z80 8MHz (running at 6 MHz) |
| 101 | 0000-3fff ROM 0 |
| 102 | 4000-7fff ROM 0-31 or RAM 0-1 (switched) |
| 103 | 7000-bfff ROM 0-31 or RAM 0-1 (switched) |
| 104 | c000-ffff RAM 0-31 or RAM 0-1 (switched) |
| 105 | |
| 98 | 106 | TI-85 memory map |
| 99 | 107 | |
| 100 | 108 | CPU: Z80 6MHz |
| r5211 | r5212 | |
| 142 | 150 | 4: Video buffer width, interrupt control (write only) |
| 143 | 151 | 10: Controll port for the display controller |
| 144 | 152 | 11: Data port for the display controller |
| 153 | 14: Battery Status |
| 145 | 154 | |
| 155 | TI-83Plus ports: |
| 156 | 0: Link |
| 157 | 1: Keypad |
| 158 | 2: ? |
| 159 | 3: ON status, LCD power |
| 160 | 4: Interrupt status |
| 161 | 6: Memory page 1 |
| 162 | 7: Memory page 2 |
| 163 | 10: Controll port for the display controller |
| 164 | 11: Data port for the display controller |
| 165 | |
| 146 | 166 | TI-85 ports: |
| 147 | 167 | 0: Video buffer offset (write only) |
| 148 | 168 | 1: Keypad |
| r5211 | r5212 | |
| 198 | 218 | |
| 199 | 219 | static ADDRESS_MAP_START( ti82_io, ADDRESS_SPACE_IO, 8) |
| 200 | 220 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 201 | | AM_RANGE(0x0000, 0x0000) AM_READWRITE( ti85_port_0000_r, ti85_port_0000_w ) |
| 221 | AM_RANGE(0x0000, 0x0000) AM_READWRITE( ti82_port_0000_r, ti82_port_0000_w ) //TODO |
| 202 | 222 | AM_RANGE(0x0001, 0x0001) AM_READWRITE( ti8x_keypad_r, ti8x_keypad_w ) |
| 203 | 223 | AM_RANGE(0x0002, 0x0002) AM_READWRITE( ti82_port_0002_r, ti82_port_0002_w ) |
| 204 | 224 | AM_RANGE(0x0003, 0x0003) AM_READWRITE( ti85_port_0003_r, ti85_port_0003_w ) |
| r5211 | r5212 | |
| 209 | 229 | |
| 210 | 230 | static ADDRESS_MAP_START( ti83_io, ADDRESS_SPACE_IO, 8) |
| 211 | 231 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 212 | | AM_RANGE(0x0000, 0x0000) AM_READWRITE( ti83_port_0000_r, ti83_port_0000_w ) |
| 232 | AM_RANGE(0x0000, 0x0000) AM_READWRITE( ti83_port_0000_r, ti83_port_0000_w ) //TODO |
| 213 | 233 | AM_RANGE(0x0001, 0x0001) AM_READWRITE( ti8x_keypad_r, ti8x_keypad_w ) |
| 214 | 234 | AM_RANGE(0x0002, 0x0002) AM_READWRITE( ti83_port_0002_r, ti83_port_0002_w ) |
| 215 | 235 | AM_RANGE(0x0003, 0x0003) AM_READWRITE( ti83_port_0003_r, ti83_port_0003_w ) |
| r5211 | r5212 | |
| 219 | 239 | AM_RANGE(0x0014, 0x0014) AM_READ_PORT( "BATTERY" ) |
| 220 | 240 | ADDRESS_MAP_END |
| 221 | 241 | |
| 242 | static ADDRESS_MAP_START( ti83p_io, ADDRESS_SPACE_IO, 8) |
| 243 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 244 | AM_RANGE(0x0000, 0x0000) AM_READWRITE( ti82_port_0000_r, ti82_port_0000_w) //TODO |
| 245 | AM_RANGE(0x0001, 0x0001) AM_READWRITE( ti8x_keypad_r, ti8x_keypad_w ) |
| 246 | AM_RANGE(0x0002, 0x0002) AM_READWRITE( ti83p_port_0002_r, ti83p_port_0002_w ) |
| 247 | AM_RANGE(0x0003, 0x0003) AM_READWRITE( ti83_port_0003_r, ti83p_port_0003_w ) |
| 248 | AM_RANGE(0x0004, 0x0004) AM_READWRITE( ti83_port_0003_r, ti83p_port_0004_w ) |
| 249 | AM_RANGE(0x0006, 0x0006) AM_READWRITE( ti86_port_0005_r, ti83p_port_0006_w ) |
| 250 | AM_RANGE(0x0007, 0x0007) AM_READWRITE( ti86_port_0006_r, ti83p_port_0007_w ) |
| 251 | AM_RANGE(0x0010, 0x0010) AM_READWRITE( ti82_port_0010_r, ti83p_port_0010_w ) |
| 252 | AM_RANGE(0x0011, 0x0011) AM_READWRITE( ti82_port_0011_r, ti82_port_0011_w ) |
| 253 | ADDRESS_MAP_END |
| 254 | |
| 222 | 255 | static ADDRESS_MAP_START( ti86_io, ADDRESS_SPACE_IO, 8) |
| 223 | 256 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 224 | 257 | AM_RANGE(0x0000, 0x0000) AM_READWRITE( ti85_port_0000_r, ti85_port_0000_w ) |
| r5211 | r5212 | |
| 234 | 267 | /* memory w/r functions */ |
| 235 | 268 | |
| 236 | 269 | static ADDRESS_MAP_START( ti81_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 237 | | AM_RANGE(0x0000, 0x3fff) AM_READWRITE( SMH_BANK(1), SMH_BANK(3) ) |
| 238 | | AM_RANGE(0x4000, 0x7fff) AM_READWRITE( SMH_BANK(2), SMH_BANK(4) ) |
| 270 | AM_RANGE(0x0000, 0x3fff) AM_ROMBANK(1) |
| 271 | AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(2) |
| 239 | 272 | AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) |
| 240 | 273 | ADDRESS_MAP_END |
| 241 | 274 | |
| 242 | | static ADDRESS_MAP_START( ti85_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 243 | | AM_RANGE(0x0000, 0x3fff) AM_READWRITE( SMH_BANK(1), SMH_BANK(3) ) |
| 244 | | AM_RANGE(0x4000, 0x7fff) AM_READWRITE( SMH_BANK(2), SMH_BANK(4) ) |
| 245 | | AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) |
| 246 | | ADDRESS_MAP_END |
| 247 | | |
| 248 | 275 | static ADDRESS_MAP_START( ti86_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 249 | | AM_RANGE(0x0000, 0x3fff) AM_READWRITE( SMH_BANK(1), SMH_BANK(5) ) |
| 250 | | AM_RANGE(0x4000, 0x7fff) AM_READWRITE( SMH_BANK(2), SMH_BANK(6) ) |
| 251 | | AM_RANGE(0x8000, 0xbfff) AM_READWRITE( SMH_BANK(3), SMH_BANK(7) ) |
| 252 | | AM_RANGE(0xc000, 0xffff) AM_READWRITE( SMH_BANK(4), SMH_BANK(8) ) |
| 276 | AM_RANGE(0x0000, 0x3fff) AM_ROMBANK(1) |
| 277 | AM_RANGE(0x4000, 0x7fff) AM_RAMBANK(2) |
| 278 | AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(3) |
| 279 | AM_RANGE(0xc000, 0xffff) AM_RAMBANK(4) |
| 253 | 280 | ADDRESS_MAP_END |
| 254 | 281 | |
| 255 | 282 | /* keyboard input */ |
| r5211 | r5212 | |
| 487 | 514 | static MACHINE_DRIVER_START( ti85 ) |
| 488 | 515 | MDRV_IMPORT_FROM( ti81 ) |
| 489 | 516 | MDRV_CPU_REPLACE("maincpu", Z80, 6000000) /* 6 MHz */ |
| 490 | | MDRV_CPU_PROGRAM_MAP(ti85_mem) |
| 491 | 517 | MDRV_CPU_IO_MAP(ti85_io) |
| 492 | 518 | |
| 493 | 519 | MDRV_MACHINE_START( ti85 ) |
| r5211 | r5212 | |
| 512 | 538 | static MACHINE_DRIVER_START( ti82 ) |
| 513 | 539 | MDRV_IMPORT_FROM( ti81 ) |
| 514 | 540 | MDRV_CPU_REPLACE("maincpu", Z80, 6000000) /* 6 MHz */ |
| 515 | | MDRV_CPU_PROGRAM_MAP(ti85_mem) |
| 516 | 541 | MDRV_CPU_IO_MAP(ti82_io) |
| 517 | 542 | |
| 518 | 543 | MDRV_MACHINE_START( ti82 ) |
| r5211 | r5212 | |
| 522 | 547 | static MACHINE_DRIVER_START( ti83 ) |
| 523 | 548 | MDRV_IMPORT_FROM( ti81 ) |
| 524 | 549 | MDRV_CPU_REPLACE("maincpu", Z80, 6000000) /* 6 MHz */ |
| 525 | | MDRV_CPU_PROGRAM_MAP(ti85_mem) |
| 526 | 550 | MDRV_CPU_IO_MAP(ti83_io) |
| 527 | 551 | |
| 528 | 552 | MDRV_MACHINE_START( ti82 ) |
| r5211 | r5212 | |
| 540 | 564 | MDRV_NVRAM_HANDLER( ti86 ) |
| 541 | 565 | MACHINE_DRIVER_END |
| 542 | 566 | |
| 567 | static MACHINE_DRIVER_START( ti83p ) |
| 568 | MDRV_IMPORT_FROM( ti81 ) |
| 569 | MDRV_CPU_REPLACE("maincpu", Z80, 6000000) /* 8 MHz running at 6 MHz */ |
| 543 | 570 | |
| 571 | MDRV_CPU_MODIFY("maincpu") |
| 572 | MDRV_CPU_PROGRAM_MAP(ti86_mem) |
| 573 | MDRV_CPU_IO_MAP(ti83p_io) |
| 574 | |
| 575 | MDRV_MACHINE_START( ti83p ) |
| 576 | MDRV_VIDEO_UPDATE( ti82 ) |
| 577 | |
| 578 | MDRV_NVRAM_HANDLER(ti83p) |
| 579 | MACHINE_DRIVER_END |
| 580 | |
| 544 | 581 | static MACHINE_DRIVER_START( ti86d ) |
| 545 | 582 | MDRV_IMPORT_FROM( ti86 ) |
| 546 | 583 | MDRV_SNAPSHOT_ADD("snapshot", ti8x, "sav", 0) |
| r5211 | r5212 | |
| 599 | 636 | |
| 600 | 637 | ROM_START (ti83p) |
| 601 | 638 | ROM_REGION (0x90000, "maincpu",0) |
| 602 | | ROM_DEFAULT_BIOS("v112") |
| 639 | ROM_DEFAULT_BIOS("v116") |
| 603 | 640 | ROM_SYSTEM_BIOS( 0, "v103", "V 1.03" ) |
| 604 | 641 | ROMX_LOAD( "ti83pv103.bin", 0x10000, 0x80000, CRC(da466be0) SHA1(37eaeeb9fb5c18fb494e322b75070e80cc4d858e), ROM_BIOS(1) ) |
| 605 | 642 | ROM_SYSTEM_BIOS( 1, "v103m", "V 1.03 [m]" ) |
| r5211 | r5212 | |
| 728 | 765 | SYSTEM_CONFIG_END |
| 729 | 766 | |
| 730 | 767 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 731 | | COMP( 1998, ti73, 0, 0, ti85, ti85, 0, NULL, "Texas Instruments", "TI-73", GAME_NOT_WORKING ) |
| 768 | COMP( 1998, ti73, 0, 0, ti83p, ti82, 0, NULL, "Texas Instruments", "TI-73", GAME_NOT_WORKING ) |
| 732 | 769 | COMP( 1990, ti81, 0, 0, ti81, ti81, 0, NULL, "Texas Instruments", "TI-81", 0 ) |
| 733 | 770 | COMP( 1992, ti85, 0, 0, ti85d, ti85, 0, ti85, "Texas Instruments", "TI-85", 0 ) |
| 734 | 771 | COMP( 1993, ti82, 0, 0, ti82, ti82, 0, NULL, "Texas Instruments", "TI-82", 0 ) |
| 735 | 772 | COMP( 1996, ti83, 0, 0, ti83, ti83, 0, NULL, "Texas Instruments", "TI-83", 0 ) |
| 736 | 773 | COMP( 1997, ti86, 0, 0, ti86d, ti85, 0, ti86, "Texas Instruments", "TI-86", 0 ) |
| 737 | | COMP( 1999, ti83p, 0, 0, ti83, ti83, 0, NULL, "Texas Instruments", "TI-83 Plus", GAME_NOT_WORKING ) |
| 774 | COMP( 1999, ti83p, 0, 0, ti83p, ti82, 0, NULL, "Texas Instruments", "TI-83 Plus", 0 ) |
| 738 | 775 | COMP( 2001, ti83pse, 0, 0, ti85, ti85, 0, NULL, "Texas Instruments", "TI-83 Plus Silver Edition", GAME_NOT_WORKING ) |
| 739 | 776 | //COMP( 2004, ti84p, 0, 0, ti85, ti85, 0, NULL, "Texas Instruments", "TI-84 Plus", GAME_NOT_WORKING ) |
| 740 | 777 | COMP( 2004, ti84pse, 0, 0, ti85, ti85, 0, NULL, "Texas Instruments", "TI-84 Plus Silver Edition", GAME_NOT_WORKING ) |
| 741 | 778 | |
| 742 | 779 | |
| 743 | 780 | |
| 781 | |