src/emu/emuopts.c
| r12138 | r12139 | |
| 251 | 251 | entry[0].name = slot->device().tag(); |
| 252 | 252 | entry[0].description = NULL; |
| 253 | 253 | entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE; |
| 254 | | entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card() : NULL; |
| 254 | entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card(*this) : NULL; |
| 255 | 255 | add_entries(entry, true); |
| 256 | 256 | |
| 257 | 257 | added = true; |
| r12138 | r12139 | |
| 345 | 345 | remove_device_options(); |
| 346 | 346 | add_device_options(true); |
| 347 | 347 | bool isfirst = true; |
| 348 | result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); |
| 348 | 349 | while (add_slot_options(isfirst)) { |
| 349 | 350 | result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); |
| 350 | 351 | add_device_options(false); |
src/mess/machine/cococart.h
| r12138 | r12139 | |
| 67 | 67 | |
| 68 | 68 | class cococart_slot_device : public device_t, |
| 69 | 69 | public cococart_interface, |
| 70 | | public device_slot_interface |
| 70 | public device_slot_interface, |
| 71 | public device_image_interface |
| 71 | 72 | { |
| 72 | 73 | public: |
| 73 | 74 | // construction/destruction |
| r12138 | r12139 | |
| 78 | 79 | virtual void device_start(); |
| 79 | 80 | virtual void device_config_complete(); |
| 80 | 81 | |
| 82 | // image-level overrides |
| 83 | virtual bool call_load(); |
| 84 | virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry); |
| 85 | |
| 86 | virtual iodevice_t image_type() const { return IO_CARTSLOT; } |
| 87 | |
| 88 | virtual bool is_readable() const { return 1; } |
| 89 | virtual bool is_writeable() const { return 0; } |
| 90 | virtual bool is_creatable() const { return 0; } |
| 91 | virtual bool must_be_loaded() const { return 0; } |
| 92 | virtual bool is_reset_on_load() const { return 1; } |
| 93 | virtual const char *image_interface() const { return "coco_cart"; } |
| 94 | virtual const char *file_extensions() const { return "ccc,rom"; } |
| 95 | virtual const option_guide *create_option_guide() const { return NULL; } |
| 96 | |
| 97 | // slot interface overrides |
| 98 | virtual const char * get_default_card(emu_options &options) const; |
| 99 | |
| 81 | 100 | /* reading and writing to $FF40-$FF7F */ |
| 82 | 101 | DECLARE_READ8_MEMBER(read); |
| 83 | 102 | DECLARE_WRITE8_MEMBER(write); |
src/mess/machine/cococart.c
| r12138 | r12139 | |
| 8 | 8 | |
| 9 | 9 | #include "emu.h" |
| 10 | 10 | #include "cococart.h" |
| 11 | #include "emuopts.h" |
| 11 | 12 | |
| 12 | 13 | /*************************************************************************** |
| 13 | 14 | PARAMETERS |
| r12138 | r12139 | |
| 30 | 31 | //------------------------------------------------- |
| 31 | 32 | cococart_slot_device::cococart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 32 | 33 | device_t(mconfig, COCOCART_SLOT, "CoCo Cartridge Slot", tag, owner, clock), |
| 33 | | device_slot_interface(mconfig, *this) |
| 34 | device_slot_interface(mconfig, *this), |
| 35 | device_image_interface(mconfig, *this) |
| 34 | 36 | { |
| 35 | 37 | } |
| 36 | 38 | |
| r12138 | r12139 | |
| 50 | 52 | { |
| 51 | 53 | for(int i=0; i<TIMER_POOL; i++ ) |
| 52 | 54 | { |
| 53 | | m_cart_line.timer[i] = device().machine().scheduler().timer_alloc(FUNC(cart_timer_callback), (void *) this); |
| 54 | | m_nmi_line.timer[i] = device().machine().scheduler().timer_alloc(FUNC(nmi_timer_callback), (void *) this); |
| 55 | | m_halt_line.timer[i] = device().machine().scheduler().timer_alloc(FUNC(halt_timer_callback), (void *) this); |
| 55 | m_cart_line.timer[i] = machine().scheduler().timer_alloc(FUNC(cart_timer_callback), (void *) this); |
| 56 | m_nmi_line.timer[i] = machine().scheduler().timer_alloc(FUNC(nmi_timer_callback), (void *) this); |
| 57 | m_halt_line.timer[i] = machine().scheduler().timer_alloc(FUNC(halt_timer_callback), (void *) this); |
| 56 | 58 | } |
| 57 | 59 | |
| 58 | 60 | m_cart_line.timer_index = 0; |
| r12138 | r12139 | |
| 100 | 102 | memset(&m_nmi_callback, 0, sizeof(m_nmi_callback)); |
| 101 | 103 | memset(&m_halt_callback, 0, sizeof(m_halt_callback)); |
| 102 | 104 | } |
| 105 | |
| 106 | // set brief and instance name |
| 107 | update_names(); |
| 103 | 108 | } |
| 104 | 109 | |
| 105 | 110 | /*------------------------------------------------- |
| r12138 | r12139 | |
| 163 | 168 | line->value = value; |
| 164 | 169 | |
| 165 | 170 | if (LOG_LINE) |
| 166 | | logerror("[%s]: set_line(): %s <= %s\n", device().machine().describe_context(), line_name, line_value_string(value)); |
| 171 | logerror("[%s]: set_line(): %s <= %s\n", machine().describe_context(), line_name, line_value_string(value)); |
| 167 | 172 | /* engage in a bit of gymnastics for this odious 'Q' value */ |
| 168 | 173 | switch(line->value) |
| 169 | 174 | { |
| r12138 | r12139 | |
| 230 | 235 | { |
| 231 | 236 | /* calculate delay; delay dependant on cycles per second */ |
| 232 | 237 | attotime delay = (line->delay != 0) |
| 233 | | ? device().machine().firstcpu->cycles_to_attotime(line->delay) |
| 238 | ? machine().firstcpu->cycles_to_attotime(line->delay) |
| 234 | 239 | : attotime::zero; |
| 235 | 240 | |
| 236 | 241 | line->timer[line->timer_index]->adjust(delay, (int) value); |
| r12138 | r12139 | |
| 301 | 306 | return NULL; |
| 302 | 307 | } |
| 303 | 308 | |
| 309 | |
| 310 | bool cococart_slot_device::call_load() |
| 311 | { |
| 312 | if (m_cart) { |
| 313 | offs_t read_length = 0; |
| 314 | if (software_entry() == NULL) |
| 315 | { |
| 316 | read_length = fread(m_cart->get_cart_base(), 0x8000); |
| 317 | } |
| 318 | else |
| 319 | { |
| 320 | read_length = get_software_region_length("rom"); |
| 321 | memcpy(m_cart->get_cart_base(), get_software_region("rom"), read_length); |
| 322 | } |
| 323 | while(read_length < 0x8000) |
| 324 | { |
| 325 | offs_t len = MIN(read_length, 0x8000 - read_length); |
| 326 | memcpy(m_cart->get_cart_base() + read_length, m_cart->get_cart_base(), len); |
| 327 | read_length += len; |
| 328 | } |
| 329 | } |
| 330 | return IMAGE_INIT_PASS; |
| 331 | } |
| 332 | |
| 333 | bool cococart_slot_device::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry) |
| 334 | { |
| 335 | load_software_part_region(this, swlist, swname, start_entry ); return TRUE; |
| 336 | return TRUE; |
| 337 | } |
| 338 | |
| 339 | const char * cococart_slot_device::get_default_card(emu_options &options) const |
| 340 | { |
| 341 | if (strlen(options.value(m_instance_name))>0) { |
| 342 | return "pak"; |
| 343 | } |
| 344 | return m_default_card; |
| 345 | } |
| 346 | |
| 304 | 347 | //************************************************************************** |
| 305 | 348 | // DEVICE COCO CART INTERFACE |
| 306 | 349 | //************************************************************************** |
src/mess/drivers/coco.c
| r12138 | r12139 | |
| 831 | 831 | MCFG_RAM_ADD(RAM_TAG) |
| 832 | 832 | MCFG_RAM_DEFAULT_SIZE("32K") |
| 833 | 833 | MCFG_RAM_EXTRA_OPTIONS("64K") |
| 834 | |
| 835 | /* Software lists */ |
| 836 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 834 | 837 | MACHINE_CONFIG_END |
| 835 | 838 | |
| 836 | 839 | static MACHINE_CONFIG_START( dragon64, coco_state ) |
| r12138 | r12139 | |
| 874 | 877 | /* internal ram */ |
| 875 | 878 | MCFG_RAM_ADD(RAM_TAG) |
| 876 | 879 | MCFG_RAM_DEFAULT_SIZE("64K") |
| 880 | |
| 881 | /* Software lists */ |
| 882 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 877 | 883 | MACHINE_CONFIG_END |
| 878 | 884 | |
| 879 | 885 | static MACHINE_CONFIG_START( d64plus, coco_state ) |
| r12138 | r12139 | |
| 918 | 924 | /* internal ram */ |
| 919 | 925 | MCFG_RAM_ADD(RAM_TAG) |
| 920 | 926 | MCFG_RAM_DEFAULT_SIZE("128K") |
| 927 | |
| 928 | /* Software lists */ |
| 929 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 921 | 930 | MACHINE_CONFIG_END |
| 922 | 931 | |
| 923 | 932 | static MACHINE_CONFIG_START( dgnalpha, coco_state ) |
| r12138 | r12139 | |
| 972 | 981 | /* internal ram */ |
| 973 | 982 | MCFG_RAM_ADD(RAM_TAG) |
| 974 | 983 | MCFG_RAM_DEFAULT_SIZE("64K") |
| 984 | |
| 985 | /* Software lists */ |
| 986 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 975 | 987 | MACHINE_CONFIG_END |
| 976 | 988 | |
| 977 | 989 | static MACHINE_CONFIG_START( tanodr64, coco_state ) |
| r12138 | r12139 | |
| 1016 | 1028 | /* internal ram */ |
| 1017 | 1029 | MCFG_RAM_ADD(RAM_TAG) |
| 1018 | 1030 | MCFG_RAM_DEFAULT_SIZE("64K") |
| 1031 | |
| 1032 | /* Software lists */ |
| 1033 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 1019 | 1034 | MACHINE_CONFIG_END |
| 1020 | 1035 | |
| 1021 | 1036 | static MACHINE_CONFIG_START( coco, coco_state ) |
| r12138 | r12139 | |
| 1059 | 1074 | MCFG_RAM_ADD(RAM_TAG) |
| 1060 | 1075 | MCFG_RAM_DEFAULT_SIZE("16K") |
| 1061 | 1076 | MCFG_RAM_EXTRA_OPTIONS("4K,32K,64K") |
| 1077 | |
| 1078 | /* Software lists */ |
| 1079 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 1062 | 1080 | MACHINE_CONFIG_END |
| 1063 | 1081 | |
| 1064 | 1082 | static MACHINE_CONFIG_START( coco2, coco_state ) |
| r12138 | r12139 | |
| 1102 | 1120 | MCFG_RAM_ADD(RAM_TAG) |
| 1103 | 1121 | MCFG_RAM_DEFAULT_SIZE("64K") |
| 1104 | 1122 | MCFG_RAM_EXTRA_OPTIONS("16K") |
| 1123 | |
| 1124 | /* Software lists */ |
| 1125 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 1105 | 1126 | MACHINE_CONFIG_END |
| 1106 | 1127 | |
| 1107 | 1128 | static MACHINE_CONFIG_START( coco2b, coco_state ) |
| r12138 | r12139 | |
| 1145 | 1166 | MCFG_RAM_ADD(RAM_TAG) |
| 1146 | 1167 | MCFG_RAM_DEFAULT_SIZE("64K") |
| 1147 | 1168 | MCFG_RAM_EXTRA_OPTIONS("16K") |
| 1169 | |
| 1170 | /* Software lists */ |
| 1171 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 1148 | 1172 | MACHINE_CONFIG_END |
| 1149 | 1173 | |
| 1150 | 1174 | static MACHINE_CONFIG_START( coco3, coco3_state ) |
| r12138 | r12139 | |
| 1194 | 1218 | |
| 1195 | 1219 | MCFG_SAM6883_GIME_ADD("sam", coco3_sam_intf) |
| 1196 | 1220 | |
| 1197 | | MCFG_COCO_CARTRIDGE_ADD("ext", coco3_cococart_interface, coco_cart, "multi", NULL) |
| 1221 | MCFG_COCO_CARTRIDGE_ADD("ext", coco3_cococart_interface, coco_cart, "fdcv11", NULL) |
| 1198 | 1222 | |
| 1199 | 1223 | /* internal ram */ |
| 1200 | 1224 | MCFG_RAM_ADD(RAM_TAG) |
| 1201 | 1225 | MCFG_RAM_DEFAULT_SIZE("512K") |
| 1202 | 1226 | MCFG_RAM_EXTRA_OPTIONS("128K,2M,8M") |
| 1227 | |
| 1228 | /* Software lists */ |
| 1229 | MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") |
| 1203 | 1230 | MACHINE_CONFIG_END |
| 1204 | 1231 | |
| 1205 | 1232 | static MACHINE_CONFIG_DERIVED( coco3p, coco3 ) |