src/mess/machine/trs80.c
| r5892 | r5893 | |
| 316 | 316 | |
| 317 | 317 | WRITE8_HANDLER( trs80m4_84_w ) |
| 318 | 318 | { |
| 319 | | /* Hi-res graphics control - d6..d4,d1..d0 not emulated |
| 319 | /* Hi-res graphics control - d6..d4 not emulated |
| 320 | 320 | d7 Page Control |
| 321 | 321 | d6 Fix upper memory |
| 322 | 322 | d5 Memory bit 1 |
| r5892 | r5893 | |
| 324 | 324 | d3 Invert Video |
| 325 | 325 | d2 80/64 width |
| 326 | 326 | d1 Select bit 1 |
| 327 | | d0 Select bit 0 */ |
| 327 | d0 Select bit 0 |
| 328 | 328 | |
| 329 | Note: Area from 0000-0FFF is controlled by tr80m4p_9c_w below */ |
| 330 | |
| 329 | 331 | /* get address space instead of io space */ |
| 330 | 332 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 331 | 333 | |
| 332 | 334 | trs80_mode = (trs80_mode & 0x73) | (data & 0x8c); |
| 333 | 335 | |
| 334 | | trs80_model4 = 1; |
| 336 | trs80_model4 &= 0xce; |
| 337 | trs80_model4 |= (data & 3) << 4; |
| 335 | 338 | |
| 336 | 339 | switch (data & 3) |
| 337 | 340 | { |
| 338 | 341 | case 0: /* normal operation */ |
| 339 | | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu")); |
| 340 | | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x01000); |
| 341 | | memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x037ea); |
| 342 | |
| 343 | if (trs80_model4 & 4) /* Model 4P gets RAM while Model 4 gets ROM */ |
| 344 | { |
| 345 | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000); |
| 346 | memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x137ea); |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x01000); |
| 351 | memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x037ea); |
| 352 | } |
| 353 | |
| 342 | 354 | memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000); |
| 343 | 355 | memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400); |
| 344 | 356 | memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800); |
| r5892 | r5893 | |
| 349 | 361 | memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000); |
| 350 | 362 | memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400); |
| 351 | 363 | memory_set_bankptr(mem->machine, 19, memory_region(mem->machine, "maincpu") + 0x1f800); |
| 352 | | memory_install_readwrite8_handler (mem, 0x37e8, 0x37e9, 0, 0, trs80_printer_r, trs80_printer_w); |
| 353 | | memory_install_read8_handler (mem, 0x3800, 0x3bff, 0, 0, trs80_keyboard_r); |
| 354 | | memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, trs80_videoram_r, trs80_videoram_w); |
| 364 | memory_install_readwrite8_handler (mem, 0x37e8, 0x37e9, 0, 0, trs80_printer_r, trs80_printer_w); /* 3 & 13 */ |
| 365 | memory_install_read8_handler (mem, 0x3800, 0x3bff, 0, 0, trs80_keyboard_r); /* 5 */ |
| 366 | memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, trs80_videoram_r, trs80_videoram_w); /* 6 & 16 */ |
| 355 | 367 | break; |
| 368 | |
| 356 | 369 | case 1: /* write-only ram backs up the rom */ |
| 357 | | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu")); |
| 358 | | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x01000); |
| 359 | | memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "maincpu") + 0x037e8); |
| 360 | | memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x037ea); |
| 370 | |
| 371 | if (trs80_model4 & 4) /* Model 4P gets RAM while Model 4 gets ROM */ |
| 372 | { |
| 373 | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000); |
| 374 | memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "maincpu") + 0x137e8); |
| 375 | memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x137ea); |
| 376 | } |
| 377 | else |
| 378 | { |
| 379 | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x01000); |
| 380 | memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "maincpu") + 0x037e8); |
| 381 | memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x037ea); |
| 382 | } |
| 383 | |
| 361 | 384 | memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000); |
| 362 | 385 | memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400); |
| 363 | 386 | memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800); |
| r5892 | r5893 | |
| 369 | 392 | memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000); |
| 370 | 393 | memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400); |
| 371 | 394 | memory_set_bankptr(mem->machine, 19, memory_region(mem->machine, "maincpu") + 0x1f800); |
| 372 | | memory_install_read8_handler (mem, 0x3800, 0x3bff, 0, 0, trs80_keyboard_r); |
| 373 | | memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, trs80_videoram_r, trs80_videoram_w); |
| 395 | memory_install_read8_handler (mem, 0x3800, 0x3bff, 0, 0, trs80_keyboard_r); /* 5 */ |
| 396 | memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, trs80_videoram_r, trs80_videoram_w); /* 6 & 16 */ |
| 374 | 397 | break; |
| 398 | |
| 375 | 399 | case 2: /* keyboard and video are moved to high memory, and the rest is ram */ |
| 376 | 400 | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000); |
| 377 | 401 | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000); |
| r5892 | r5893 | |
| 388 | 412 | memory_set_bankptr(mem->machine, 16, memory_region(mem->machine, "maincpu") + 0x13c00); |
| 389 | 413 | memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000); |
| 390 | 414 | memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x0a000); |
| 391 | | memory_install_read8_handler (mem, 0xf400, 0xf7ff, 0, 0, trs80_keyboard_r); |
| 392 | | memory_install_readwrite8_handler (mem, 0xf800, 0xffff, 0, 0, trs80_videoram_r, trs80_videoram_w); |
| 393 | | trs80_model4 = 2; |
| 415 | memory_install_read8_handler (mem, 0xf400, 0xf7ff, 0, 0, trs80_keyboard_r); /* 8 */ |
| 416 | memory_install_readwrite8_handler (mem, 0xf800, 0xffff, 0, 0, trs80_videoram_r, trs80_videoram_w); /* 9 & 19 */ |
| 417 | trs80_model4++; |
| 394 | 418 | break; |
| 419 | |
| 395 | 420 | case 3: /* 64k of ram */ |
| 396 | 421 | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000); |
| 397 | 422 | memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000); |
| r5892 | r5893 | |
| 420 | 445 | speaker_level_w(trs80_speaker, ~data & 1); |
| 421 | 446 | } |
| 422 | 447 | |
| 448 | WRITE8_HANDLER( trs80m4p_9c_w ) /* model 4P only - swaps the ROM with read-only RAM */ |
| 449 | { |
| 450 | /* Meaning of trs80_model4 variable: |
| 451 | d5..d4 memory mode (as described in section above) |
| 452 | d3 rom switch (1=enabled) only effective in mode0 and 1 |
| 453 | d2 this is a Model 4P |
| 454 | d1 this is a Model 4 |
| 455 | d0 Video banking exists yes/no (1=not banked) */ |
| 456 | |
| 457 | /* get address space instead of io space */ |
| 458 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 459 | |
| 460 | trs80_model4 &= 0xf7; |
| 461 | trs80_model4 |= (data << 3); |
| 462 | |
| 463 | if ((trs80_model4) && (~trs80_model4 & 0x20)) |
| 464 | { |
| 465 | switch (trs80_model4 & 8) |
| 466 | { |
| 467 | case 0: /* Read-only RAM replaces rom */ |
| 468 | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000); |
| 469 | break; |
| 470 | case 8: /* Normal setup - rom enabled */ |
| 471 | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu")); |
| 472 | break; |
| 473 | } |
| 474 | } |
| 475 | } |
| 476 | |
| 423 | 477 | WRITE8_HANDLER( trs80m4_e0_w ) |
| 424 | 478 | { |
| 425 | 479 | /* Interrupt settings - which devices are allowed to interrupt - bits align with read of E0 |
| r5892 | r5893 | |
| 896 | 950 | memory_install_readwrite8_handler (mem, 0x4000, 0xf3ff, 0, 0, SMH_BANK(7), SMH_BANK(17)); |
| 897 | 951 | memory_install_readwrite8_handler (mem, 0xf400, 0xf7ff, 0, 0, SMH_BANK(8), SMH_BANK(18)); |
| 898 | 952 | memory_install_readwrite8_handler (mem, 0xf800, 0xffff, 0, 0, SMH_BANK(9), SMH_BANK(19)); |
| 899 | | trs80m4_84_w(mem, 0, 0); |
| 953 | trs80m4_84_w(mem, 0, 0); /* switch in devices at power-on */ |
| 954 | trs80m4p_9c_w(mem, 0, 1); /* Enable the ROM */ |
| 900 | 955 | } |
| 901 | 956 | |
| 902 | 957 | MACHINE_RESET( lnw80 ) |
src/mess/drivers/trs80.c
| r5892 | r5893 | |
| 112 | 112 | Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM |
| 113 | 113 | Mode 3: All RAM |
| 114 | 114 | In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video, |
| 115 | | while the second 64k is RAM that is switched in as needed. |
| 115 | while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF |
| 116 | is considered a "black hole", any writes to there will disappear. |
| 116 | 117 | The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous. |
| 117 | 118 | |
| 118 | 119 | Model 4P - is the same as Model 4 except: |
| r5892 | r5893 | |
| 220 | 221 | |
| 221 | 222 | static ADDRESS_MAP_START( model3_io, ADDRESS_SPACE_IO, 8 ) |
| 222 | 223 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 224 | AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) |
| 225 | AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) |
| 226 | AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) |
| 227 | AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) |
| 228 | AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) |
| 229 | AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) |
| 230 | AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) |
| 231 | AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("wd179x", trs80_wd179x_r, wd17xx_command_w) |
| 232 | AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", wd17xx_track_r, wd17xx_track_w) |
| 233 | AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", wd17xx_sector_r, wd17xx_sector_w) |
| 234 | AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", wd17xx_data_r, wd17xx_data_w) |
| 235 | AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) |
| 236 | AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) |
| 237 | AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) |
| 238 | ADDRESS_MAP_END |
| 239 | |
| 240 | static ADDRESS_MAP_START( model4_io, ADDRESS_SPACE_IO, 8 ) |
| 241 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 223 | 242 | AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w) |
| 224 | 243 | AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w) |
| 225 | 244 | AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w) |
| r5892 | r5893 | |
| 239 | 258 | AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) |
| 240 | 259 | ADDRESS_MAP_END |
| 241 | 260 | |
| 261 | static ADDRESS_MAP_START( model4p_io, ADDRESS_SPACE_IO, 8 ) |
| 262 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 263 | AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w) |
| 264 | AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w) |
| 265 | AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w) |
| 266 | AM_RANGE(0x9c, 0x9f) AM_WRITE(trs80m4p_9c_w) |
| 267 | AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) |
| 268 | AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) |
| 269 | AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) |
| 270 | AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) |
| 271 | AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) |
| 272 | AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) |
| 273 | AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) |
| 274 | AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("wd179x", trs80_wd179x_r, wd17xx_command_w) |
| 275 | AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("wd179x", wd17xx_track_r, wd17xx_track_w) |
| 276 | AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("wd179x", wd17xx_sector_r, wd17xx_sector_w) |
| 277 | AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("wd179x", wd17xx_data_r, wd17xx_data_w) |
| 278 | AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) |
| 279 | AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) |
| 280 | AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) |
| 281 | ADDRESS_MAP_END |
| 242 | 282 | |
| 243 | 283 | |
| 284 | |
| 244 | 285 | /************************************************************************** |
| 245 | 286 | w/o SHIFT with SHIFT |
| 246 | 287 | +-------------------------------+ +-------------------------------+ |
| r5892 | r5893 | |
| 483 | 524 | MDRV_SCREEN_VISIBLE_AREA(0,80*8-1,0,239) |
| 484 | 525 | MACHINE_DRIVER_END |
| 485 | 526 | |
| 527 | static MACHINE_DRIVER_START( model4 ) |
| 528 | MDRV_IMPORT_FROM( model3 ) |
| 529 | MDRV_CPU_MODIFY( "maincpu" ) |
| 530 | MDRV_CPU_IO_MAP( model4_io) |
| 531 | MACHINE_DRIVER_END |
| 532 | |
| 533 | static MACHINE_DRIVER_START( model4p ) |
| 534 | MDRV_IMPORT_FROM( model3 ) |
| 535 | MDRV_CPU_MODIFY( "maincpu" ) |
| 536 | MDRV_CPU_IO_MAP( model4p_io) |
| 537 | MACHINE_DRIVER_END |
| 538 | |
| 486 | 539 | static MACHINE_DRIVER_START( sys80 ) |
| 487 | 540 | MDRV_IMPORT_FROM( model1 ) |
| 488 | 541 | MDRV_CPU_MODIFY( "maincpu" ) |
| r5892 | r5893 | |
| 637 | 690 | ROM_END |
| 638 | 691 | |
| 639 | 692 | ROM_START(trs80m4p) // uses a completely different memory map scheme to the others; the trs-80 model 3 roms are loaded from a boot disk, the only rom on the machine is a bootloader; bootloader can be banked out of 0x0000-0x1000 space which is replaced with ram; see the tech ref pdf, pdf page 62 |
| 640 | | // Currently this fails miserably due to lack of ram banking; it does some i/o stuff, copies some of the int vectors to 0x4000, then does some more i/o stuff and fills the entire 0x4000-43ff space with 0x20 (space? is it trying to clear the screen?), then immediately afterward it executes a RET; since the stack pointer is still pointing to 0x40A2, it RETs to 0x2020, which is in unmapped, nop-filled space. |
| 641 | | // Clearly there's some major ram-bank related stuff that isn't working at all here. |
| 642 | 693 | ROM_REGION(0x20000, "maincpu",0) |
| 643 | 694 | ROM_SYSTEM_BIOS(0, "trs80m4p", "Level 2 bios, gate array machine") |
| 644 | 695 | ROMX_LOAD("8075332.u69", 0x0000, 0x1000, CRC(3a738aa9) SHA1(6393396eaa10a84b9e9f0cf5930aba73defc5c52), ROM_BIOS(1)) // Label: "SCM95060P // 8075332 // TANDY (C) 1983 // 8421" at location U69 (may be located at U70 on some pcb revisions) |
| r5892 | r5893 | |
| 691 | 742 | static DRIVER_INIT( trs80m4 ) |
| 692 | 743 | { |
| 693 | 744 | trs80_mode = 0; |
| 694 | | trs80_model4 = 1; |
| 745 | trs80_model4 = 2; |
| 695 | 746 | videoram = memory_region(machine, "maincpu")+0x4000; |
| 696 | 747 | } |
| 697 | 748 | |
| 749 | static DRIVER_INIT( trs80m4p ) |
| 750 | { |
| 751 | trs80_mode = 0; |
| 752 | trs80_model4 = 4; |
| 753 | videoram = memory_region(machine, "maincpu")+0x4000; |
| 754 | } |
| 755 | |
| 698 | 756 | static DRIVER_INIT( lnw80 ) |
| 699 | 757 | { |
| 700 | 758 | trs80_mode = 0; |
| r5892 | r5893 | |
| 710 | 768 | COMP( 1980, sys80, trs80, 0, sys80, trs80, trs80l2, 0, "EACA Computers Ltd.","System-80" , 0 ) |
| 711 | 769 | COMP( 1981, lnw80, trs80, 0, lnw80, trs80m3, lnw80, 0, "LNW Research","LNW-80", 0 ) |
| 712 | 770 | COMP( 1980, trs80m3, trs80, 0, model3, trs80m3, trs80m4, 0, "Tandy Radio Shack", "TRS-80 Model III", 0 ) |
| 713 | | COMP( 1980, trs80m4, trs80, 0, model3, trs80m3, trs80m4, 0, "Tandy Radio Shack", "TRS-80 Model 4", 0 ) |
| 714 | | COMP( 1983, trs80m4p, trs80, 0, model3, trs80m3, trs80m4, 0, "Tandy Radio Shack", "TRS-80 Model 4P", GAME_NOT_WORKING ) |
| 771 | COMP( 1980, trs80m4, trs80, 0, model4, trs80m3, trs80m4, 0, "Tandy Radio Shack", "TRS-80 Model 4", 0 ) |
| 772 | COMP( 1983, trs80m4p, trs80, 0, model4p, trs80m3, trs80m4p, 0, "Tandy Radio Shack", "TRS-80 Model 4P", 0 ) |
| 715 | 773 | COMP( 1983, ht1080z, trs80, 0, ht1080z, trs80, trs80l2, 0, "Hiradastechnika Szovetkezet", "HT-1080Z Series I" , 0 ) |
| 716 | 774 | COMP( 1984, ht1080z2, trs80, 0, ht1080z, trs80, trs80l2, 0, "Hiradastechnika Szovetkezet", "HT-1080Z Series II" , 0 ) |
| 717 | 775 | COMP( 1985, ht108064, trs80, 0, ht1080z, trs80, trs80, 0, "Hiradastechnika Szovetkezet", "HT-1080Z/64" , 0 ) |