Previous 15994 Revisions Next

r5893 Sunday 27th September, 2009 at 02:13:56 UTC by Robbbert
[TRS80] Fixed Model 4P memory banking. Model 4P now boots TRSDOS. Removed model 4 specifics from Model 3.
[src/mess/drivers]trs80.c
[src/mess/includes]trs80.h
[src/mess/machine]trs80.c

src/mess/includes/trs80.h
r5892r5893
4343WRITE8_HANDLER ( trs80m4_e8_w );
4444WRITE8_HANDLER ( trs80m4_e4_w );
4545WRITE8_HANDLER ( trs80m4_e0_w );
46WRITE8_HANDLER ( trs80m4p_9c_w );
4647WRITE8_HANDLER ( trs80m4_90_w );
4748WRITE8_HANDLER ( trs80m4_84_w );
4849READ8_HANDLER ( lnw80_fe_r );
src/mess/machine/trs80.c
r5892r5893
316316
317317WRITE8_HANDLER( trs80m4_84_w )
318318{
319/* Hi-res graphics control - d6..d4,d1..d0 not emulated
319/* Hi-res graphics control - d6..d4 not emulated
320320   d7 Page Control
321321   d6 Fix upper memory
322322   d5 Memory bit 1
r5892r5893
324324   d3 Invert Video
325325   d2 80/64 width
326326   d1 Select bit 1
327   d0 Select bit 0 */
327   d0 Select bit 0
328328
329   Note: Area from 0000-0FFF is controlled by tr80m4p_9c_w below */
330
329331   /* get address space instead of io space */
330332   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
331333
332334   trs80_mode = (trs80_mode & 0x73) | (data & 0x8c);
333335
334   trs80_model4 = 1;
336   trs80_model4 &= 0xce;
337   trs80_model4 |= (data & 3) << 4;
335338
336339   switch (data & 3)
337340   {
338341      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
342354         memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000);
343355         memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400);
344356         memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800);
r5892r5893
349361         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
350362         memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400);
351363         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 */
355367         break;
368
356369      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
361384         memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000);
362385         memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400);
363386         memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800);
r5892r5893
369392         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
370393         memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400);
371394         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 */
374397         break;
398
375399      case 2:   /* keyboard and video are moved to high memory, and the rest is ram */
376400         memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000);
377401         memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000);
r5892r5893
388412         memory_set_bankptr(mem->machine, 16, memory_region(mem->machine, "maincpu") + 0x13c00);
389413         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
390414         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++;
394418         break;
419
395420      case 3:   /* 64k of ram */
396421         memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000);
397422         memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000);
r5892r5893
420445   speaker_level_w(trs80_speaker, ~data & 1);
421446}
422447
448WRITE8_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
423477WRITE8_HANDLER( trs80m4_e0_w )
424478{
425479/* Interrupt settings - which devices are allowed to interrupt - bits align with read of E0
r5892r5893
896950   memory_install_readwrite8_handler (mem, 0x4000, 0xf3ff, 0, 0, SMH_BANK(7), SMH_BANK(17));
897951   memory_install_readwrite8_handler (mem, 0xf400, 0xf7ff, 0, 0, SMH_BANK(8), SMH_BANK(18));
898952   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 */
900955}
901956
902957MACHINE_RESET( lnw80 )
src/mess/drivers/trs80.c
r5892r5893
112112      Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM
113113      Mode 3: All RAM
114114      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.
116117      The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous.
117118
118119Model 4P - is the same as Model 4 except:
r5892r5893
220221
221222static ADDRESS_MAP_START( model3_io, ADDRESS_SPACE_IO, 8 )
222223   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)
238ADDRESS_MAP_END
239
240static ADDRESS_MAP_START( model4_io, ADDRESS_SPACE_IO, 8 )
241   ADDRESS_MAP_GLOBAL_MASK(0xff)
223242   AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w)
224243   AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w)
225244   AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w)
r5892r5893
239258   AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w)
240259ADDRESS_MAP_END
241260
261static 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)
281ADDRESS_MAP_END
242282
243283
284
244285/**************************************************************************
245286   w/o SHIFT                             with SHIFT
246287   +-------------------------------+     +-------------------------------+
r5892r5893
483524   MDRV_SCREEN_VISIBLE_AREA(0,80*8-1,0,239)
484525MACHINE_DRIVER_END
485526
527static MACHINE_DRIVER_START( model4 )
528   MDRV_IMPORT_FROM( model3 )
529   MDRV_CPU_MODIFY( "maincpu" )
530   MDRV_CPU_IO_MAP( model4_io)
531MACHINE_DRIVER_END
532
533static MACHINE_DRIVER_START( model4p )
534   MDRV_IMPORT_FROM( model3 )
535   MDRV_CPU_MODIFY( "maincpu" )
536   MDRV_CPU_IO_MAP( model4p_io)
537MACHINE_DRIVER_END
538
486539static MACHINE_DRIVER_START( sys80 )
487540   MDRV_IMPORT_FROM( model1 )
488541   MDRV_CPU_MODIFY( "maincpu" )
r5892r5893
637690ROM_END
638691
639692ROM_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.
642693   ROM_REGION(0x20000, "maincpu",0)
643694   ROM_SYSTEM_BIOS(0, "trs80m4p", "Level 2 bios, gate array machine")
644695   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)
r5892r5893
691742static DRIVER_INIT( trs80m4 )
692743{
693744   trs80_mode = 0;
694   trs80_model4 = 1;
745   trs80_model4 = 2;
695746   videoram = memory_region(machine, "maincpu")+0x4000;
696747}
697748
749static DRIVER_INIT( trs80m4p )
750{
751   trs80_mode = 0;
752   trs80_model4 = 4;
753   videoram = memory_region(machine, "maincpu")+0x4000;
754}
755
698756static DRIVER_INIT( lnw80 )
699757{
700758   trs80_mode = 0;
r5892r5893
710768COMP( 1980, sys80,    trs80,   0,   sys80,    trs80,   trs80l2,  0,   "EACA Computers Ltd.","System-80" , 0 )
711769COMP( 1981, lnw80,    trs80,   0,   lnw80,    trs80m3, lnw80,    0,   "LNW Research","LNW-80", 0 )
712770COMP( 1980, trs80m3,  trs80,   0,   model3,   trs80m3, trs80m4,  0,   "Tandy Radio Shack",  "TRS-80 Model III", 0 )
713COMP( 1980, trs80m4,  trs80,   0,   model3,   trs80m3, trs80m4,  0,   "Tandy Radio Shack",  "TRS-80 Model 4", 0 )
714COMP( 1983, trs80m4p, trs80,   0,   model3,   trs80m3, trs80m4,  0,   "Tandy Radio Shack",  "TRS-80 Model 4P", GAME_NOT_WORKING )
771COMP( 1980, trs80m4,  trs80,   0,   model4,   trs80m3, trs80m4,  0,   "Tandy Radio Shack",  "TRS-80 Model 4", 0 )
772COMP( 1983, trs80m4p, trs80,   0,   model4p,  trs80m3, trs80m4p, 0,   "Tandy Radio Shack",  "TRS-80 Model 4P", 0 )
715773COMP( 1983, ht1080z,  trs80,   0,   ht1080z,  trs80,   trs80l2,  0,   "Hiradastechnika Szovetkezet",  "HT-1080Z Series I" , 0 )
716774COMP( 1984, ht1080z2, trs80,   0,   ht1080z,  trs80,   trs80l2,  0,   "Hiradastechnika Szovetkezet",  "HT-1080Z Series II" , 0 )
717775COMP( 1985, ht108064, trs80,   0,   ht1080z,  trs80,   trs80,    0,   "Hiradastechnika Szovetkezet",  "HT-1080Z/64" , 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team