Previous 15994 Revisions Next

r4044 Thursday 1st January, 2009 at 20:05:55 UTC by Nathan Woods
[COCO] Minor cartridge loading code cleanups
[docs]messnew.txt
[src/mess/drivers]coco.c
[src/mess/includes]coco.h
[src/mess/machine]coco.c

src/mess/includes/coco.h
r4043r4044
5656MACHINE_RESET( coco3 );
5757
5858DEVICE_IMAGE_LOAD(coco_rom);
59DEVICE_IMAGE_LOAD(coco3_rom);
6059DEVICE_IMAGE_UNLOAD(coco_rom);
61DEVICE_IMAGE_UNLOAD(coco3_rom);
6260
6361INPUT_CHANGED(coco_keyboard_changed);
6462INPUT_CHANGED(coco_joystick_mode_changed);
src/mess/machine/coco.c
r4043r4044
660660  be used in place of PAK files, when possible
661661***************************************************************************/
662662
663static int generic_rom_load(const device_config *image, UINT8 *dest, UINT16 destlength)
663DEVICE_IMAGE_LOAD(coco_rom)
664664{
665   UINT8 *dest = memory_region(image->machine, "cart");
666   UINT16 destlength = (UINT16) memory_region_length(image->machine, "cart");
665667   UINT8 *rombase;
666668   int   romsize;
667669
r4043r4044
705707   return INIT_PASS;
706708}
707709
708DEVICE_IMAGE_LOAD(coco_rom)
709{
710   UINT8 *ROM = memory_region(image->machine, "main");
711   return generic_rom_load(image, &ROM[0x4000], 0x4000);
712}
713
714710DEVICE_IMAGE_UNLOAD(coco_rom)
715711{
716   UINT8 *ROM = memory_region(image->machine, "main");
717   memset(&ROM[0x4000], 0, 0x4000);
712   UINT8 *dest = memory_region(image->machine, "cart");
713   UINT16 destlength = (UINT16) memory_region_length(image->machine, "cart");
714   memset(dest, 0, destlength);
718715}
719716
720DEVICE_IMAGE_LOAD(coco3_rom)
721{
722   UINT8 *ROM = memory_region(image->machine, "main");
723   return generic_rom_load(image, &ROM[0x8000], 0x8000);
724}
725
726DEVICE_IMAGE_UNLOAD(coco3_rom)
727{
728   UINT8 *ROM = memory_region(image->machine, "main");
729   memset(&ROM[0x8000], 0, 0x8000);
730}
731
732717/***************************************************************************
733718  Interrupts
734719
r4043r4044
20051990   /* If in maptype 0 we need to map in the rom also, for now this just maps in the system and cart roms */
20061991   if(!maptype)
20071992   {
1993      UINT8 *cart_rom = memory_region(machine, "cart");
1994
20081995      for(block_index=0;block_index<=7;block_index++)
20091996      {
20101997         /* If we are in the BASIC rom area $8000-$BFFF, then we map to the bas_rom_bank */
20111998         /* as this may be in a different block of coco_rom, in the Dragon 64 and Alpha */
20121999         /* as these machines have mutiple bios roms that can ocupy this area */
2013         if(block_index<4)
2014            offset=&bas_rom_bank[0x1000*block_index];
2000         if (block_index < 4)
2001            offset = &bas_rom_bank[0x1000*block_index];
20152002         else
2016            offset=&coco_rom[0x4000+(0x1000*(block_index-4))];
2003            offset = &cart_rom[(0x1000*(block_index-4))];
20172004
20182005         memory_set_bankptr(machine, block_index + 9,offset);
20192006         memory_install_write_handler(space, memmap[block_index+8].start, memmap[block_index+8].end, 0, 0, STATIC_NOP);
r4043r4044
22952282   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
22962283   int i, offset, writebank;
22972284   UINT8 *readbank;
2285   UINT8 *cart_rom = memory_region(machine, "cart");
22982286
22992287   for (i = lowblock; i <= hiblock; i++)
23002288   {
r4043r4044
23022290      if (offset & 0x80000000)
23032291      {
23042292         /* an offset into the CoCo 3 ROM */
2305         readbank = &coco_rom[offset & ~0x80000000];
2293         if (offset & 0x8000)
2294            readbank = &cart_rom[offset & ~0x80008000];
2295         else
2296            readbank = &coco_rom[offset & ~0x80000000];
23062297         writebank = STATIC_UNMAP;
23072298      }
23082299      else
r4043r4044
27472738
27482739
27492740/*-------------------------------------------------
2750    generic_mapmemory
2741    coco_mapmemory
27512742-------------------------------------------------*/
27522743
2753static void generic_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask, UINT8 *cartmem, UINT32 cartmem_size)
2744static void coco_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask)
27542745{
2746   UINT8 *cartmem = memory_region(machine, "cart");
2747   UINT32 cartmem_size = memory_region_length(machine, "cart");
27552748   const device_config *image = cartslot_image(machine);
27562749   const UINT8 *cart_ptr;
27572750   UINT32 cart_size, i;
r4043r4044
27672760}
27682761
27692762
2770
27712763/*-------------------------------------------------
2772    coco_mapmemory
2773-------------------------------------------------*/
2774
2775static void coco_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask)
2776{
2777   generic_mapmemory(machine, cartridge, offset, mask, &coco_rom[0x4000], 0x3FFF);
2778}
2779
2780
2781
2782/*-------------------------------------------------
2783    coco3_mapmemory
2784-------------------------------------------------*/
2785
2786static void coco3_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask)
2787{
2788   generic_mapmemory(machine, cartridge, offset, mask, &coco_rom[0xC000], 0x3FFF);
2789}
2790
2791
2792
2793/*-------------------------------------------------
27942764    twiddle_cart_line_if_q - hack function to begin
27952765   a "twiddle session" on the CART line if it is
27962766   connected to Q
r4043r4044
30903060   init.recalc_interrupts_   = coco3_recalc_interrupts;
30913061   init.printer_out_      = printer_out_coco;
30923062   init.cart_timer_proc   = coco3_cart_timer_proc;
3093   init.map_memory         = coco3_mapmemory;
3063   init.map_memory         = coco_mapmemory;
30943064   init.fdc_cart_hardware   = "coco3_plus_fdc";
30953065
30963066   generic_init_machine(machine, &init);
src/mess/drivers/coco.c
r4043r4044
647647   MDRV_CARTSLOT_UNLOAD(coco_rom)
648648MACHINE_DRIVER_END
649649
650static MACHINE_DRIVER_START( coco3_cartslot )
651   MDRV_CARTSLOT_ADD("cart")
652   MDRV_CARTSLOT_EXTENSION_LIST("ccc,rom")
653   MDRV_CARTSLOT_NOT_MANDATORY
654   MDRV_CARTSLOT_LOAD(coco3_rom)
655   MDRV_CARTSLOT_UNLOAD(coco3_rom)
656MACHINE_DRIVER_END
657
658650static MACHINE_DRIVER_START( dragon32 )
659651   /* basic machine hardware */
660652   MDRV_CPU_ADD("main", M6809E, COCO_CPU_SPEED_HZ * 4)        /* 0,894886 MHz */
r4043r4044
1007999   
10081000   MDRV_SAM6883_GIME_ADD("sam", coco3_sam_intf)
10091001   
1010   MDRV_IMPORT_FROM(coco3_cartslot)
1002   MDRV_IMPORT_FROM(coco_cartslot)
10111003MACHINE_DRIVER_END
10121004
10131005static MACHINE_DRIVER_START( coco3p )
r4043r4044
10341026***************************************************************************/
10351027
10361028ROM_START(dragon32)
1037   ROM_REGION(0xC000,"main",0)
1029   ROM_REGION(0xC000, "main",0)
10381030   ROM_LOAD(           "d32.rom",      0x0000,  0x4000, CRC(e3879310) SHA1(f2dab125673e653995a83bf6b793e3390ec7f65a))
1039   ROM_LOAD_OPTIONAL(  "ddos10.rom",   0x4000,  0x2000, CRC(b44536f6) SHA1(a8918c71d319237c1e3155bb38620acb114a80bc))
1031
1032   ROM_REGION(0x2000,"cart",0)
1033   ROM_LOAD_OPTIONAL(  "ddos10.rom",   0x0000,  0x2000, CRC(b44536f6) SHA1(a8918c71d319237c1e3155bb38620acb114a80bc))
10401034ROM_END
10411035
10421036ROM_START(dragon64)
10431037   ROM_REGION(0x10000,"main",0)
10441038   ROM_LOAD(           "d64_1.rom",    0x0000,  0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042))
10451039   ROM_LOAD(           "d64_2.rom",    0x8000,  0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e))
1046   ROM_LOAD_OPTIONAL(  "ddos10.rom",   0x4000,  0x2000, CRC(b44536f6) SHA1(a8918c71d319237c1e3155bb38620acb114a80bc))
1040
1041   ROM_REGION(0x2000,"cart",0)
1042   ROM_LOAD_OPTIONAL(  "ddos10.rom",   0x0000,  0x2000, CRC(b44536f6) SHA1(a8918c71d319237c1e3155bb38620acb114a80bc))
10471043ROM_END
10481044
10491045ROM_START(d64plus)
10501046   ROM_REGION(0x10000,"main",0)
10511047   ROM_LOAD(           "d64_1.rom",    0x0000,  0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042))
10521048   ROM_LOAD(           "d64_2.rom",    0x8000,  0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e))
1053   ROM_LOAD_OPTIONAL(  "ddos10.rom",   0x4000,  0x2000, CRC(b44536f6) SHA1(a8918c71d319237c1e3155bb38620acb114a80bc))
1049
1050   ROM_REGION(0x2000,"cart",0)
1051   ROM_LOAD_OPTIONAL(  "ddos10.rom",   0x0000,  0x2000, CRC(b44536f6) SHA1(a8918c71d319237c1e3155bb38620acb114a80bc))
10541052ROM_END
10551053
10561054ROM_START(tanodr64)
10571055   ROM_REGION(0x10000,"main",0)
10581056   ROM_LOAD(           "d64_1.rom",    0x0000,  0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042))
10591057   ROM_LOAD(           "d64_2.rom",    0x8000,  0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e))
1060   ROM_LOAD_OPTIONAL(  "sdtandy.rom",   0x4000,  0x2000, CRC(5d7779b7) SHA1(ca03942118f2deab2f6c8a89b8a4f41f2d0b94f1))
1058
1059   ROM_REGION(0x2000,"cart",0)
1060   ROM_LOAD_OPTIONAL(  "sdtandy.rom",   0x0000,  0x2000, CRC(5d7779b7) SHA1(ca03942118f2deab2f6c8a89b8a4f41f2d0b94f1))
10611061ROM_END
10621062
10631063ROM_START(dgnalpha)
r4043r4044
10691069ROM_START(coco)
10701070     ROM_REGION(0x8000,"main",0)
10711071     ROM_LOAD(         "bas10.rom",   0x2000, 0x2000, CRC(00b50aaa) SHA1(1f08455cd48ce6a06132aea15c4778f264e19539))
1072ROM_END
10731072
1073    ROM_REGION(0x2000,"cart",0)
1074    ROM_FILL( 0x0000, 0x2000, 0x00 )
1075 ROM_END
1076
10741077ROM_START(cocoe)
10751078     ROM_REGION(0x8000,"main",0)
10761079     ROM_LOAD(         "bas11.rom",   0x2000, 0x2000, CRC(6270955a) SHA1(cecb7c24ff1e0ab5836e4a7a8eb1b8e01f1fded3))
10771080     ROM_LOAD(           "extbas10.rom",   0x0000, 0x2000, CRC(6111a086) SHA1(8aa58f2eb3e8bcfd5470e3e35e2b359e9a72848e))
1078     ROM_LOAD_OPTIONAL(   "disk10.rom",   0x4000, 0x2000, CRC(b4f9968e) SHA1(04115be3f97952b9d9310b52f806d04f80b40d03))
1081
1082    ROM_REGION(0x2000,"cart",0)
1083    ROM_LOAD_OPTIONAL(   "disk10.rom",   0x0000, 0x2000, CRC(b4f9968e) SHA1(04115be3f97952b9d9310b52f806d04f80b40d03))
10791084ROM_END
10801085
10811086ROM_START(coco2)
10821087     ROM_REGION(0x8000,"main",0)
10831088     ROM_LOAD(         "bas12.rom",   0x2000, 0x2000, CRC(54368805) SHA1(0f14dc46c647510eb0b7bd3f53e33da07907d04f))
10841089     ROM_LOAD(         "extbas11.rom",   0x0000, 0x2000, CRC(a82a6254) SHA1(ad927fb4f30746d820cb8b860ebb585e7f095dea))
1085     ROM_LOAD_OPTIONAL(   "disk11.rom",   0x4000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1090
1091    ROM_REGION(0x2000,"cart",0)
1092     ROM_LOAD_OPTIONAL(   "disk11.rom",   0x0000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
10861093ROM_END
10871094
10881095ROM_START(coco2b)
10891096     ROM_REGION(0x8000,"main",0)
10901097     ROM_LOAD(         "bas13.rom",   0x2000, 0x2000, CRC(d8f4d15e) SHA1(28b92bebe35fa4f026a084416d6ea3b1552b63d3))
10911098     ROM_LOAD(         "extbas11.rom",   0x0000, 0x2000, CRC(a82a6254) SHA1(ad927fb4f30746d820cb8b860ebb585e7f095dea))
1092     ROM_LOAD_OPTIONAL(   "disk11.rom",   0x4000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1099
1100    ROM_REGION(0x2000,"cart",0)
1101    ROM_LOAD_OPTIONAL(   "disk11.rom",   0x0000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
10931102ROM_END
10941103
10951104ROM_START(coco3)
1096     ROM_REGION(0x10000,"main",0)
1105     ROM_REGION(0x8000,"main",0)
10971106    ROM_LOAD(         "coco3.rom",   0x0000, 0x8000, CRC(b4c88d6c) SHA1(e0d82953fb6fd03768604933df1ce8bc51fc427d))
1098     ROM_LOAD_OPTIONAL(   "disk11.rom",   0xC000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1099     ROM_LOAD_OPTIONAL(   "disk11.rom",   0xE000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1107
1108     ROM_REGION(0x8000,"cart",0)
1109    ROM_LOAD_OPTIONAL(   "disk11.rom",   0x0000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1110    ROM_RELOAD(0x2000, 0x2000)
1111    ROM_RELOAD(0x4000, 0x2000)
1112    ROM_RELOAD(0x6000, 0x2000)
11001113ROM_END
11011114
11021115ROM_START(coco3p)
1103     ROM_REGION(0x10000,"main",0)
1116     ROM_REGION(0x8000,"main",0)
11041117    ROM_LOAD(         "coco3p.rom",   0x0000, 0x8000, CRC(ff050d80) SHA1(631e383068b1f52a8f419f4114b69501b21cf379))
1105     ROM_LOAD_OPTIONAL(   "disk11.rom",   0xC000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1106     ROM_LOAD_OPTIONAL(   "disk11.rom",   0xE000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1118
1119    ROM_REGION(0x8000,"cart",0)
1120     ROM_LOAD_OPTIONAL(   "disk11.rom",   0x0000, 0x2000, CRC(0b9c5415) SHA1(10bdc5aa2d7d7f205f67b47b19003a4bd89defd1))
1121    ROM_RELOAD(0x2000, 0x2000)
1122    ROM_RELOAD(0x4000, 0x2000)
1123    ROM_RELOAD(0x6000, 0x2000)
11071124ROM_END
11081125
11091126ROM_START(cp400)
11101127     ROM_REGION(0x8000,"main",0)
11111128     ROM_LOAD("cp400bas.rom",  0x0000, 0x4000, CRC(878396a5) SHA1(292c545da3c77978e043b00a3dbc317201d18c3b))
1112     ROM_LOAD("cp400dsk.rom",  0x4000, 0x2000, CRC(e9ad60a0) SHA1(827697fa5b755f5dc1efb054cdbbeb04e405405b))
1129
1130    ROM_REGION(0x2000,"cart",0)
1131     ROM_LOAD("cp400dsk.rom",  0x0000, 0x2000, CRC(e9ad60a0) SHA1(827697fa5b755f5dc1efb054cdbbeb04e405405b))
11131132ROM_END
11141133
11151134#define rom_coco3h   rom_coco3
docs/messnew.txt
r4043r4044
3434- [BBC] Changed to use MAME's 6850 implemenation.  Deleted MESS's private 6850
3535  implementation.  [Nathan Woods]
3636
37- [COCO] Fixed Dragon Alpha, via mame update, the NMI enable/disable allowing
37- [COCO] Fixed Dragon Alpha, via MAME update, the NMI enable/disable allowing
3838  disks to boot again.  [Phill Harvey-Smith]
3939
40- [COCO] Minor cartridge loading code cleanups.  [Nathan Woods]
41
4042- [COMX35] Added support for the 80 column card. [Curt Coder, Marcel van Tongeren]
4143
4244- [GAMECOM] Fixed aspect ratio. [Justin Kerk]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team