Previous 15994 Revisions Next

r5878 Thursday 24th September, 2009 at 11:57:47 UTC by Robbbert
[TRS80] Added some memory banking. Model4/4p produces a TRSDOS screen then hangs.
[src/mess/drivers]trs80.c
[src/mess/includes]trs80.h
[src/mess/machine]trs80.c

src/mess/includes/trs80.h
r5877r5878
2727QUICKLOAD_LOAD( trs80_cmd );
2828
2929MACHINE_RESET( trs80 );
30MACHINE_RESET( trs80m4 );
3031MACHINE_RESET( lnw80 );
3132
3233WRITE8_HANDLER ( trs80_ff_w );
src/mess/machine/trs80.c
r5877r5878
326326   d1 Select bit 1
327327   d0 Select bit 0 */
328328
329   /* get address space instead of io space */
330   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
331
329332   trs80_mode = (trs80_mode & 0x73) | (data & 0x8c);
333
334   switch (data & 3)
335   {
336      case 0:   /* normal operation */
337         memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu"));
338         memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x01000);
339         memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x037ea);
340         memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000);
341         memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400);
342         memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800);
343         memory_set_bankptr(mem->machine, 11, memory_region(mem->machine, "maincpu") + 0x05000);
344         memory_set_bankptr(mem->machine, 12, memory_region(mem->machine, "maincpu") + 0x06000);
345         memory_set_bankptr(mem->machine, 14, memory_region(mem->machine, "maincpu") + 0x09000);
346         memory_set_bankptr(mem->machine, 15, memory_region(mem->machine, "maincpu") + 0x0a000);
347         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
348         memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400);
349         memory_set_bankptr(mem->machine, 19, memory_region(mem->machine, "maincpu") + 0x1f800);
350         memory_install_readwrite8_handler (mem, 0x37e8, 0x37e9, 0, 0, trs80_printer_r, trs80_printer_w);
351         memory_install_read8_handler (mem, 0x3800, 0x3bff, 0, 0, trs80_keyboard_r);
352         memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, trs80_videoram_r, trs80_videoram_w);
353         break;
354      case 1:   /* write-only ram backs up the rom */
355         memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu"));
356         memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x01000);
357         memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "maincpu") + 0x037e8);
358         memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x037ea);
359         memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000);
360         memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400);
361         memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800);
362         memory_set_bankptr(mem->machine, 11, memory_region(mem->machine, "maincpu") + 0x10000);
363         memory_set_bankptr(mem->machine, 12, memory_region(mem->machine, "maincpu") + 0x11000);
364         memory_set_bankptr(mem->machine, 13, memory_region(mem->machine, "maincpu") + 0x137e8);
365         memory_set_bankptr(mem->machine, 14, memory_region(mem->machine, "maincpu") + 0x137ea);
366         memory_set_bankptr(mem->machine, 15, memory_region(mem->machine, "maincpu") + 0x0a000);
367         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
368         memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400);
369         memory_set_bankptr(mem->machine, 19, memory_region(mem->machine, "maincpu") + 0x1f800);
370         memory_install_read8_handler (mem, 0x3800, 0x3bff, 0, 0, trs80_keyboard_r);
371         memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, trs80_videoram_r, trs80_videoram_w);
372         break;
373      case 2:   /* keyboard and video are moved to high memory, and the rest is ram */
374         memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000);
375         memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000);
376         memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "maincpu") + 0x137e8);
377         memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x137ea);
378         memory_set_bankptr(mem->machine, 5, memory_region(mem->machine, "maincpu") + 0x13800);
379         memory_set_bankptr(mem->machine, 6, memory_region(mem->machine, "maincpu") + 0x13c00);
380         memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000);
381         memory_set_bankptr(mem->machine, 11, memory_region(mem->machine, "maincpu") + 0x10000);
382         memory_set_bankptr(mem->machine, 12, memory_region(mem->machine, "maincpu") + 0x11000);
383         memory_set_bankptr(mem->machine, 13, memory_region(mem->machine, "maincpu") + 0x137e8);
384         memory_set_bankptr(mem->machine, 14, memory_region(mem->machine, "maincpu") + 0x137ea);
385         memory_set_bankptr(mem->machine, 15, memory_region(mem->machine, "maincpu") + 0x13800);
386         memory_set_bankptr(mem->machine, 16, memory_region(mem->machine, "maincpu") + 0x13c00);
387         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
388         memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x0a000);
389         memory_install_read8_handler (mem, 0xf400, 0xf7ff, 0, 0, trs80_keyboard_r);
390         memory_install_readwrite8_handler (mem, 0xf800, 0xffff, 0, 0, trs80_videoram_r, trs80_videoram_w);
391         break;
392      case 3:   /* 64k of ram */
393         memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu") + 0x10000);
394         memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "maincpu") + 0x11000);
395         memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "maincpu") + 0x137e8);
396         memory_set_bankptr(mem->machine, 4, memory_region(mem->machine, "maincpu") + 0x137ea);
397         memory_set_bankptr(mem->machine, 5, memory_region(mem->machine, "maincpu") + 0x13800);
398         memory_set_bankptr(mem->machine, 6, memory_region(mem->machine, "maincpu") + 0x13c00);
399         memory_set_bankptr(mem->machine, 7, memory_region(mem->machine, "maincpu") + 0x14000);
400         memory_set_bankptr(mem->machine, 8, memory_region(mem->machine, "maincpu") + 0x1f400);
401         memory_set_bankptr(mem->machine, 9, memory_region(mem->machine, "maincpu") + 0x1f800);
402         memory_set_bankptr(mem->machine, 11, memory_region(mem->machine, "maincpu") + 0x10000);
403         memory_set_bankptr(mem->machine, 12, memory_region(mem->machine, "maincpu") + 0x11000);
404         memory_set_bankptr(mem->machine, 13, memory_region(mem->machine, "maincpu") + 0x137e8);
405         memory_set_bankptr(mem->machine, 14, memory_region(mem->machine, "maincpu") + 0x137ea);
406         memory_set_bankptr(mem->machine, 15, memory_region(mem->machine, "maincpu") + 0x13800);
407         memory_set_bankptr(mem->machine, 16, memory_region(mem->machine, "maincpu") + 0x13c00);
408         memory_set_bankptr(mem->machine, 17, memory_region(mem->machine, "maincpu") + 0x14000);
409         memory_set_bankptr(mem->machine, 18, memory_region(mem->machine, "maincpu") + 0x1f400);
410         memory_set_bankptr(mem->machine, 19, memory_region(mem->machine, "maincpu") + 0x1f800);
411         break;
412   }
330413}
331414
332415WRITE8_HANDLER( trs80m4_90_w )
r5877r5878
797880   videoram_size = 0x800;
798881}
799882
883MACHINE_RESET( trs80m4 )
884{
885   const address_space *mem = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
886   MACHINE_RESET_CALL(trs80);
887   memory_install_readwrite8_handler (mem, 0x0000, 0x0fff, 0, 0, SMH_BANK(1), SMH_BANK(11));
888   memory_install_readwrite8_handler (mem, 0x1000, 0x37e7, 0, 0, SMH_BANK(2), SMH_BANK(12));
889   memory_install_readwrite8_handler (mem, 0x37e8, 0x37e9, 0, 0, SMH_BANK(3), SMH_BANK(13));
890   memory_install_readwrite8_handler (mem, 0x37ea, 0x37ff, 0, 0, SMH_BANK(4), SMH_BANK(14));
891   memory_install_readwrite8_handler (mem, 0x3800, 0x3bff, 0, 0, SMH_BANK(5), SMH_BANK(15));
892   memory_install_readwrite8_handler (mem, 0x3c00, 0x3fff, 0, 0, SMH_BANK(6), SMH_BANK(16));
893   memory_install_readwrite8_handler (mem, 0x4000, 0xf3ff, 0, 0, SMH_BANK(7), SMH_BANK(17));
894   memory_install_readwrite8_handler (mem, 0xf400, 0xf7ff, 0, 0, SMH_BANK(8), SMH_BANK(18));
895   memory_install_readwrite8_handler (mem, 0xf800, 0xffff, 0, 0, SMH_BANK(9), SMH_BANK(19));
896   trs80m4_84_w(mem, 0, 0);
897}
898
800899MACHINE_RESET( lnw80 )
801900{
802901   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
src/mess/drivers/trs80.c
r5877r5878
9595Expansion interface for more floppy drives. The drives use 8-inch floppies holding 0.5mb of data.
9696It was extremely expensive, non-standard, and not many were sold. A rom dump does not seem to exist.
9797
98About the Model 4 - This has 4 memory maps.
99      We emulate Map 1 (see address map for Model 3).
100      Map 2 - RAM=0..37FF, Keyboard=3800..3Bff, Video=3C00..3FFF, RAM=4000..FFFF
101      Map 3 - RAM=0..F3FF, Keyboard=F400..F7FF, Video=F800..FFFF
102      Map 4 - RAM=0..FFFF
103
10498About the ht1080z - This was made for schools in Hungary. Each comes with a BASIC extension roms
10599      which activated Hungarian features. To activate - start emulation - enter SYSTEM
106100      Enter /12288 and the extensions will be installed and you are returned to READY.
r5877r5878
112106      seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at
113107      0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero.
114108
109Model 4 memory organisation -
110      Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF
111      Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM
112      Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM
113      Mode 3: All RAM
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.
116      The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous.
117
118Model 4P - is the same as Model 4 except:
119      - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM
120      - There is no cassette support in hardware.
121
115122***************************************************************************
116123
117124Not dumped (to our knowledge):
r5877r5878
209216ADDRESS_MAP_END
210217
211218static ADDRESS_MAP_START( model3_map, ADDRESS_SPACE_PROGRAM, 8 )
212   AM_RANGE(0x0000, 0x37e7) AM_ROM
213   AM_RANGE(0x37e8, 0x37e9) AM_READWRITE(trs80_printer_r, trs80_printer_w)
214   AM_RANGE(0x37ea, 0x37ff) AM_ROM
215   AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r)
216   AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w)
217   AM_RANGE(0x4000, 0xffff) AM_RAM
218219ADDRESS_MAP_END
219220
220221static ADDRESS_MAP_START( model3_io, ADDRESS_SPACE_IO, 8 )
r5877r5878
474475   MDRV_CPU_IO_MAP( model3_io)
475476   MDRV_CPU_PERIODIC_INT(trs80_rtc_interrupt, 30)
476477
478   MDRV_MACHINE_RESET( trs80m4 )
479
477480   MDRV_VIDEO_UPDATE( trs80m4 )
478481   MDRV_SCREEN_MODIFY("screen")
479482   MDRV_SCREEN_SIZE(80*8, 240)
r5877r5878
603606Note: Be careful when dumping rom C: if dumped on the trs-80 m3 with software, bytes 0x7e8 and 0x7e9 (addresses 0x37e8, 0x0x37e9)
604607      will read as 0xFF 0xFF; on the original rom, these bytes are 0x00 0x00 (for eproms) or 0xAA 0xAA (for mask roms), those two bytes are used for printer status on the trs-80 and are mapped on top of the rom; This problem should be avoided by pulling the rom chips and dumping them directly.
605608*/
606   ROM_REGION(0x10800, "maincpu",0)
609   ROM_REGION(0x20000, "maincpu",0)
607610   ROM_SYSTEM_BIOS(0, "trs80m3_revc", "Level 2 bios, RomC Rev C")
608611   ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(1)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639')
609612   ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(1)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117", (Level 2 bios ROM B '407c')
r5877r5878
626629
627630// for model 4 and 4p info, see http://vt100.net/mirror/harte/Radio%20Shack/TRS-80%20Model%204_4P%20Soft%20Tech%20Ref.pdf
628631ROM_START(trs80m4)
629   ROM_REGION(0x10800, "maincpu",0)
632   ROM_REGION(0x20000, "maincpu",0)
630633   ROM_LOAD("trs80m4.rom",  0x0000, 0x3800, BAD_DUMP CRC(1a92d54d) SHA1(752555fdd0ff23abc9f35c6e03d9d9b4c0e9677b)) // should be split into 3 roms, roms A, B, C, exactly like trs80m3; in fact, roms A and B are shared between both systems.
631634
632635   ROM_REGION(0x00800, "gfx1",0)
r5877r5878
636639ROM_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
637640// 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.
638641// Clearly there's some major ram-bank related stuff that isn't working at all here.
639   ROM_REGION(0x10800, "maincpu",0)
642   ROM_REGION(0x20000, "maincpu",0)
640643   ROM_SYSTEM_BIOS(0, "trs80m4p", "Level 2 bios, gate array machine")
641644   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)
642645   ROM_SYSTEM_BIOS(1, "trs80m4p_hack", "Disk loader hack")
r5877r5878
689692{
690693   trs80_mode = 0;
691694   trs80_model4 = 1;
692   videoram = memory_region(machine, "maincpu")+0x10000;
695   videoram = memory_region(machine, "maincpu")+0x4000;
693696}
694697
695698static DRIVER_INIT( lnw80 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team