trunk/src/emu/machine/intelfsh.c
| r20990 | r20991 | |
| 89 | 89 | const device_type PANASONIC_MN63F805MNP = &device_creator<panasonic_mn63f805mnp_device>; |
| 90 | 90 | const device_type SANYO_LE26FV10N1TS = &device_creator<sanyo_le26fv10n1ts_device>; |
| 91 | 91 | const device_type SST_28SF040 = &device_creator<sst_28sf040_device>; |
| 92 | const device_type SST_39VF020 = &device_creator<sst_39vf020_device>; |
| 92 | 93 | |
| 93 | 94 | const device_type SHARP_LH28F400 = &device_creator<sharp_lh28f400_device>; |
| 94 | 95 | const device_type INTEL_E28F008SA = &device_creator<intel_e28f008sa_device>; |
| 95 | 96 | const device_type INTEL_TE28F160 = &device_creator<intel_te28f160_device>; |
| 96 | 97 | const device_type SHARP_UNK128MBIT = &device_creator<sharp_unk128mbit_device>; |
| 97 | 98 | const device_type INTEL_28F320J3D = &device_creator<intel_28f320j3d_device>; |
| 99 | const device_type SST_39VF400A = &device_creator<sst_39vf400a_device>; |
| 98 | 100 | |
| 99 | 101 | static ADDRESS_MAP_START( memory_map8_512Kb, AS_PROGRAM, 8, intelfsh_device ) |
| 100 | 102 | AM_RANGE(0x00000, 0x00ffff) AM_RAM |
| r20990 | r20991 | |
| 104 | 106 | AM_RANGE(0x00000, 0x01ffff) AM_RAM |
| 105 | 107 | ADDRESS_MAP_END |
| 106 | 108 | |
| 109 | static ADDRESS_MAP_START( memory_map8_2Mb, AS_PROGRAM, 8, intelfsh_device ) |
| 110 | AM_RANGE(0x00000, 0x03ffff) AM_RAM |
| 111 | ADDRESS_MAP_END |
| 112 | |
| 107 | 113 | static ADDRESS_MAP_START( memory_map8_4Mb, AS_PROGRAM, 8, intelfsh_device ) |
| 108 | 114 | AM_RANGE(0x00000, 0x07ffff) AM_RAM |
| 109 | 115 | ADDRESS_MAP_END |
| r20990 | r20991 | |
| 209 | 215 | m_sector_is_4k = true; |
| 210 | 216 | map = ADDRESS_MAP_NAME( memory_map16_32Mb ); |
| 211 | 217 | break; |
| 218 | case FLASH_SST_39VF020: |
| 219 | m_bits = 8; |
| 220 | m_size = 0x40000; |
| 221 | m_maker_id = MFG_SST; |
| 222 | m_device_id = 0xd6; |
| 223 | m_sector_is_4k = true; |
| 224 | map = ADDRESS_MAP_NAME( memory_map8_2Mb ); |
| 225 | break; |
| 226 | case FLASH_SST_39VF400A: |
| 227 | m_bits = 16; |
| 228 | m_size = 0x80000; |
| 229 | m_maker_id = MFG_SST; |
| 230 | m_device_id = 0xd6; |
| 231 | m_sector_is_4k = true; |
| 232 | map = ADDRESS_MAP_NAME( memory_map16_4Mb ); |
| 233 | break; |
| 212 | 234 | case FLASH_SHARP_LH28F400: |
| 213 | 235 | case FLASH_INTEL_E28F400: |
| 214 | 236 | m_bits = 16; |
| r20990 | r20991 | |
| 338 | 360 | sst_28sf040_device::sst_28sf040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 339 | 361 | : intelfsh8_device(mconfig, SST_28SF040, "SST 28SF040 Flash", tag, owner, clock, FLASH_SST_28SF040) { } |
| 340 | 362 | |
| 363 | sst_39vf020_device::sst_39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 364 | : intelfsh8_device(mconfig, SST_39VF020, "SST 39VF020 Flash", tag, owner, clock, FLASH_SST_39VF020) { } |
| 365 | |
| 341 | 366 | sharp_lh28f400_device::sharp_lh28f400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 342 | 367 | : intelfsh16_device(mconfig, SHARP_LH28F400, "Sharp LH28F400 Flash", tag, owner, clock, FLASH_SHARP_LH28F400) { } |
| 343 | 368 | |
| r20990 | r20991 | |
| 353 | 378 | intel_28f320j3d_device::intel_28f320j3d_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 354 | 379 | : intelfsh16_device(mconfig, INTEL_28F320J3D, "Intel 28F320J3D Flash", tag, owner, clock, FLASH_INTEL_28F320J3D) { } |
| 355 | 380 | |
| 381 | sst_39vf400a_device::sst_39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 382 | : intelfsh16_device(mconfig, SST_39VF400A, "SST 39VF400A Flash", tag, owner, clock, FLASH_SST_39VF400A) { } |
| 383 | |
| 356 | 384 | //------------------------------------------------- |
| 357 | 385 | // device_start - device-specific startup |
| 358 | 386 | //------------------------------------------------- |
trunk/src/emu/machine/intelfsh.h
| r20990 | r20991 | |
| 49 | 49 | #define MCFG_SST_28SF040_ADD(_tag) \ |
| 50 | 50 | MCFG_DEVICE_ADD(_tag, SST_28SF040, 0) |
| 51 | 51 | |
| 52 | #define MCFG_SST_39VF020_ADD(_tag) \ |
| 53 | MCFG_DEVICE_ADD(_tag, SST_39VF020, 0) |
| 54 | |
| 52 | 55 | #define MCFG_SHARP_LH28F400_ADD(_tag) \ |
| 53 | 56 | MCFG_DEVICE_ADD(_tag, SHARP_LH28F400, 0) |
| 54 | 57 | |
| r20990 | r20991 | |
| 64 | 67 | #define MCFG_INTEL_28F320J3D_ADD(_tag) \ |
| 65 | 68 | MCFG_DEVICE_ADD(_tag, INTEL_28F320J3D, 0) |
| 66 | 69 | |
| 70 | #define MCFG_SST_39VF400A_ADD(_tag) \ |
| 71 | MCFG_DEVICE_ADD(_tag, SST_39VF400A, 0) |
| 72 | |
| 67 | 73 | //************************************************************************** |
| 68 | 74 | // TYPE DEFINITIONS |
| 69 | 75 | //************************************************************************** |
| r20990 | r20991 | |
| 94 | 100 | FLASH_PANASONIC_MN63F805MNP, |
| 95 | 101 | FLASH_SANYO_LE26FV10N1TS, |
| 96 | 102 | FLASH_SST_28SF040, |
| 103 | FLASH_SST_39VF020, |
| 97 | 104 | |
| 98 | 105 | // 16-bit variants |
| 99 | 106 | FLASH_SHARP_LH28F400 = 0x1000, |
| 100 | 107 | FLASH_INTEL_E28F400, |
| 101 | 108 | FLASH_INTEL_TE28F160, |
| 102 | 109 | FLASH_SHARP_UNK128MBIT, |
| 103 | | FLASH_INTEL_28F320J3D |
| 110 | FLASH_INTEL_28F320J3D, |
| 111 | FLASH_SST_39VF400A |
| 104 | 112 | }; |
| 105 | 113 | |
| 106 | 114 | protected: |
| r20990 | r20991 | |
| 262 | 270 | sst_28sf040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 263 | 271 | }; |
| 264 | 272 | |
| 273 | class sst_39vf020_device : public intelfsh8_device |
| 274 | { |
| 275 | public: |
| 276 | sst_39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 277 | }; |
| 278 | |
| 265 | 279 | // 16-bit variants |
| 266 | 280 | class sharp_lh28f400_device : public intelfsh16_device |
| 267 | 281 | { |
| r20990 | r20991 | |
| 293 | 307 | intel_28f320j3d_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 294 | 308 | }; |
| 295 | 309 | |
| 310 | class sst_39vf400a_device : public intelfsh16_device |
| 311 | { |
| 312 | public: |
| 313 | sst_39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 314 | }; |
| 296 | 315 | |
| 316 | |
| 297 | 317 | // device type definition |
| 298 | 318 | extern const device_type INTEL_28F016S5; |
| 299 | 319 | extern const device_type SHARP_LH28F016S; |
| r20990 | r20991 | |
| 308 | 328 | extern const device_type PANASONIC_MN63F805MNP; |
| 309 | 329 | extern const device_type SANYO_LE26FV10N1TS; |
| 310 | 330 | extern const device_type SST_28SF040; |
| 331 | extern const device_type SST_39VF020; |
| 311 | 332 | |
| 312 | 333 | extern const device_type SHARP_LH28F400; |
| 313 | 334 | extern const device_type INTEL_E28F008SA; |
| 314 | 335 | extern const device_type INTEL_TE28F160; |
| 315 | 336 | extern const device_type SHARP_UNK128MBIT; |
| 316 | 337 | extern const device_type INTEL_28F320J3D; |
| 338 | extern const device_type SST_39VF400A; |
| 317 | 339 | |
| 318 | 340 | #endif |
trunk/src/mess/drivers/cybiko.c
| r20990 | r20991 | |
| 80 | 80 | // 256 kbyte ram + 256 kbyte memory mapped flash |
| 81 | 81 | static ADDRESS_MAP_START( cybikov2_mem, AS_PROGRAM, 16, cybiko_state ) |
| 82 | 82 | AM_RANGE( 0x000000, 0x007fff ) AM_ROM |
| 83 | | AM_RANGE( 0x100000, 0x13ffff ) AM_READ_BANK("bank2") AM_MIRROR( 0x0c0000 ) |
| 83 | AM_RANGE( 0x100000, 0x13ffff ) AM_READ8(cybikov2_flash_r, 0xffff) AM_MIRROR( 0x0c0000 ) |
| 84 | 84 | AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) AM_MIRROR( 0x1ffffe ) |
| 85 | 85 | AM_RANGE( 0xe00000, 0xffdbff ) AM_READ( cybikov2_key_r ) |
| 86 | 86 | ADDRESS_MAP_END |
| r20990 | r20991 | |
| 90 | 90 | AM_RANGE( 0x000000, 0x007fff ) AM_ROM AM_MIRROR( 0x038000 ) |
| 91 | 91 | AM_RANGE( 0x100000, 0x100001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) |
| 92 | 92 | AM_RANGE( 0x200000, 0x200003 ) AM_WRITE( cybiko_usb_w ) |
| 93 | | AM_RANGE( 0x600000, 0x67ffff ) AM_READ_BANK("bank2") AM_MIRROR( 0x180000 ) |
| 93 | AM_RANGE( 0x600000, 0x67ffff ) AM_READ(cybikoxt_flash_r) AM_MIRROR( 0x180000 ) |
| 94 | 94 | AM_RANGE( 0xe00000, 0xefffff ) AM_READ( cybikoxt_key_r ) |
| 95 | 95 | ADDRESS_MAP_END |
| 96 | 96 | |
| r20990 | r20991 | |
| 342 | 342 | MCFG_RAM_EXTRA_OPTIONS("1M") |
| 343 | 343 | MACHINE_CONFIG_END |
| 344 | 344 | |
| 345 | | const sst39vfx_config cybyko_sst39vfx_intf = |
| 346 | | { |
| 347 | | 16, ENDIANNESS_BIG |
| 348 | | }; |
| 349 | | |
| 350 | 345 | static MACHINE_CONFIG_DERIVED( cybikov2, cybikov1) |
| 351 | 346 | // cpu |
| 352 | 347 | MCFG_CPU_REPLACE("maincpu", H8S2246, 11059200) |
| r20990 | r20991 | |
| 355 | 350 | // machine |
| 356 | 351 | MCFG_MACHINE_START_OVERRIDE(cybiko_state,cybikov2) |
| 357 | 352 | MCFG_MACHINE_RESET_OVERRIDE(cybiko_state,cybikov2) |
| 358 | | MCFG_SST39VF020_ADD("flash2", cybyko_sst39vfx_intf) |
| 353 | MCFG_SST_39VF020_ADD("flash2") |
| 359 | 354 | |
| 360 | 355 | /* internal ram */ |
| 361 | 356 | MCFG_RAM_MODIFY(RAM_TAG) |
| r20990 | r20991 | |
| 372 | 367 | MCFG_MACHINE_START_OVERRIDE(cybiko_state,cybikoxt) |
| 373 | 368 | MCFG_MACHINE_RESET_OVERRIDE(cybiko_state,cybikoxt) |
| 374 | 369 | MCFG_DEVICE_REMOVE("flash1") |
| 375 | | MCFG_SST39VF400A_ADD("flash2", cybyko_sst39vfx_intf) |
| 370 | MCFG_SST_39VF400A_ADD("flashxt") |
| 376 | 371 | |
| 377 | 372 | /* internal ram */ |
| 378 | 373 | MCFG_RAM_MODIFY(RAM_TAG) |
trunk/src/mess/machine/sst39vfx.c
| r20990 | r20991 | |
| 1 | | /* |
| 2 | | |
| 3 | | SST Multi-Purpose Flash (MPF) |
| 4 | | |
| 5 | | (c) 2001-2007 Tim Schuerewegen |
| 6 | | |
| 7 | | SST39VF020 - 256 KByte |
| 8 | | SST39VF400A - 512 Kbyte |
| 9 | | |
| 10 | | */ |
| 11 | | |
| 12 | | #include "sst39vfx.h" |
| 13 | | |
| 14 | | #define LOG_LEVEL 1 |
| 15 | | #define _logerror(level,x) do { if (LOG_LEVEL > level) logerror x; } while (0) |
| 16 | | |
| 17 | | /*************************************************************************** |
| 18 | | TYPE DEFINITIONS |
| 19 | | ***************************************************************************/ |
| 20 | | |
| 21 | | struct sst39vfx_t |
| 22 | | { |
| 23 | | UINT8 *data; |
| 24 | | UINT32 size; |
| 25 | | UINT8 swap; |
| 26 | | }; |
| 27 | | |
| 28 | | enum |
| 29 | | { |
| 30 | | TYPE_SST39VF020, |
| 31 | | TYPE_SST39VF400A |
| 32 | | }; |
| 33 | | |
| 34 | | /*************************************************************************** |
| 35 | | INLINE FUNCTIONS |
| 36 | | ***************************************************************************/ |
| 37 | | |
| 38 | | INLINE sst39vfx_t *get_token(device_t *device) |
| 39 | | { |
| 40 | | assert(device != NULL); |
| 41 | | assert(device->type() == SST39VF020 || device->type() == SST39VF400A); |
| 42 | | |
| 43 | | return (sst39vfx_t *) downcast<sst39vf020_device *>(device)->token(); |
| 44 | | } |
| 45 | | |
| 46 | | INLINE const sst39vfx_config *get_config(device_t *device) |
| 47 | | { |
| 48 | | assert(device != NULL); |
| 49 | | assert(device->type() == SST39VF020 || device->type() == SST39VF400A); |
| 50 | | |
| 51 | | return (const sst39vfx_config *)device->static_config(); |
| 52 | | } |
| 53 | | |
| 54 | | |
| 55 | | /*************************************************************************** |
| 56 | | IMPLEMENTATION |
| 57 | | ***************************************************************************/ |
| 58 | | |
| 59 | | static void common_start(device_t *device, int device_type) |
| 60 | | { |
| 61 | | sst39vfx_t *flash = get_token(device); |
| 62 | | const sst39vfx_config *config = get_config(device); |
| 63 | | |
| 64 | | _logerror( 0, ("sst39vfx_init (%d)\n", device_type)); |
| 65 | | memset(flash, 0, sizeof(sst39vfx_t)); |
| 66 | | switch (device_type) |
| 67 | | { |
| 68 | | case TYPE_SST39VF020 : flash->size = 256 * 1024; break; |
| 69 | | case TYPE_SST39VF400A : flash->size = 512 * 1024; break; |
| 70 | | } |
| 71 | | flash->data = auto_alloc_array(device->machine(), UINT8, flash->size); |
| 72 | | #ifdef LSB_FIRST |
| 73 | | if (config->cpu_endianess != ENDIANNESS_LITTLE) flash->swap = config->cpu_datawidth / 8; else flash->swap = 0; |
| 74 | | #else |
| 75 | | if (config->cpu_endianess != ENDIANNESS_BIG) flash->swap = config->cpu_datawidth / 8; else flash->swap = 0; |
| 76 | | #endif |
| 77 | | |
| 78 | | state_save_register_item_pointer(device->machine(), "sst39vfx", device->tag(), 0, flash->data, flash->size); |
| 79 | | state_save_register_item(device->machine(), "sst39vfx", device->tag(), 0, flash->swap); |
| 80 | | } |
| 81 | | |
| 82 | | |
| 83 | | static DEVICE_START( sst39vf020 ) |
| 84 | | { |
| 85 | | common_start(device, TYPE_SST39VF020); |
| 86 | | } |
| 87 | | |
| 88 | | static DEVICE_START( sst39vf400a ) |
| 89 | | { |
| 90 | | common_start(device, TYPE_SST39VF400A); |
| 91 | | } |
| 92 | | |
| 93 | | UINT8* sst39vfx_get_base( device_t *device) |
| 94 | | { |
| 95 | | sst39vfx_t *flash = get_token(device); |
| 96 | | return flash->data; |
| 97 | | } |
| 98 | | |
| 99 | | UINT32 sst39vfx_get_size( device_t *device) |
| 100 | | { |
| 101 | | sst39vfx_t *flash = get_token(device); |
| 102 | | return flash->size; |
| 103 | | } |
| 104 | | |
| 105 | | /* |
| 106 | | #define OFFSET_SWAP(offset,width) (offset & (~(width - 1))) | (width - 1 - (offset & (width - 1))) |
| 107 | | */ |
| 108 | | |
| 109 | | #ifdef UNUSED_FUNCTION |
| 110 | | READ8_HANDLER( sst39vfx_r ) |
| 111 | | { |
| 112 | | _logerror( 1, ("sst39vfx_r (%08X)\n", offset)); |
| 113 | | if (flash->swap) offset = OFFSET_SWAP( offset, flash->swap); |
| 114 | | return flash->data[offset]; |
| 115 | | } |
| 116 | | |
| 117 | | WRITE8_HANDLER( sst39vfx_w ) |
| 118 | | { |
| 119 | | _logerror( 1, ("sst39vfx_w (%08X/%02X)\n", offset, data)); |
| 120 | | if (flash->swap) offset = OFFSET_SWAP( offset, flash->swap); |
| 121 | | flash->data[offset] = data; |
| 122 | | } |
| 123 | | #endif |
| 124 | | |
| 125 | | static void sst39vfx_swap( device_t *device) |
| 126 | | { |
| 127 | | int i, j; |
| 128 | | UINT8 *base, temp[8]; |
| 129 | | sst39vfx_t *flash = get_token(device); |
| 130 | | |
| 131 | | base = flash->data; |
| 132 | | for (i=0;i<flash->size;i+=flash->swap) |
| 133 | | { |
| 134 | | memcpy( temp, base, flash->swap); |
| 135 | | for (j=flash->swap-1;j>=0;j--) *base++ = temp[j]; |
| 136 | | } |
| 137 | | } |
| 138 | | |
| 139 | | void sst39vfx_load(device_t *device, emu_file *file) |
| 140 | | { |
| 141 | | sst39vfx_t *flash = get_token(device); |
| 142 | | |
| 143 | | _logerror( 0, ("sst39vfx_load (%p)\n", file)); |
| 144 | | file->read(flash->data, flash->size); |
| 145 | | if (flash->swap) sst39vfx_swap(device); |
| 146 | | } |
| 147 | | |
| 148 | | void sst39vfx_save(device_t *device, emu_file *file) |
| 149 | | { |
| 150 | | sst39vfx_t *flash = get_token(device); |
| 151 | | |
| 152 | | _logerror( 0, ("sst39vfx_save (%p)\n", file)); |
| 153 | | if (flash->swap) sst39vfx_swap(device); |
| 154 | | file->write(flash->data, flash->size); |
| 155 | | if (flash->swap) sst39vfx_swap(device); |
| 156 | | } |
| 157 | | |
| 158 | | #if 0 |
| 159 | | NVRAM_HANDLER( sst39vfx ) |
| 160 | | { |
| 161 | | _logerror( 0, ("nvram_handler_sst39vfx (%p/%d)\n", file, read_or_write)); |
| 162 | | if (read_or_write) |
| 163 | | { |
| 164 | | sst39vfx_save( file); |
| 165 | | } |
| 166 | | else |
| 167 | | { |
| 168 | | if (file) |
| 169 | | { |
| 170 | | sst39vfx_load( file); |
| 171 | | } |
| 172 | | else |
| 173 | | { |
| 174 | | memset( flash->data, 0xFF, flash->size); |
| 175 | | } |
| 176 | | } |
| 177 | | } |
| 178 | | #endif |
| 179 | | |
| 180 | | const device_type SST39VF020 = &device_creator<sst39vf020_device>; |
| 181 | | |
| 182 | | sst39vf020_device::sst39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 183 | | : device_t(mconfig, SST39VF020, "SST39VF020", tag, owner, clock) |
| 184 | | { |
| 185 | | m_token = global_alloc_clear(sst39vfx_t); |
| 186 | | } |
| 187 | | sst39vf020_device::sst39vf020_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) |
| 188 | | : device_t(mconfig, type, name, tag, owner, clock) |
| 189 | | { |
| 190 | | m_token = global_alloc_clear(sst39vfx_t); |
| 191 | | } |
| 192 | | |
| 193 | | //------------------------------------------------- |
| 194 | | // device_config_complete - perform any |
| 195 | | // operations now that the configuration is |
| 196 | | // complete |
| 197 | | //------------------------------------------------- |
| 198 | | |
| 199 | | void sst39vf020_device::device_config_complete() |
| 200 | | { |
| 201 | | } |
| 202 | | |
| 203 | | //------------------------------------------------- |
| 204 | | // device_start - device-specific startup |
| 205 | | //------------------------------------------------- |
| 206 | | |
| 207 | | void sst39vf020_device::device_start() |
| 208 | | { |
| 209 | | DEVICE_START_NAME( sst39vf020 )(this); |
| 210 | | } |
| 211 | | |
| 212 | | |
| 213 | | const device_type SST39VF400A = &device_creator<sst39vf400a_device>; |
| 214 | | |
| 215 | | sst39vf400a_device::sst39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 216 | | : sst39vf020_device(mconfig, SST39VF400A, "SST39VF400A", tag, owner, clock) |
| 217 | | { |
| 218 | | } |
| 219 | | |
| 220 | | //------------------------------------------------- |
| 221 | | // device_start - device-specific startup |
| 222 | | //------------------------------------------------- |
| 223 | | |
| 224 | | void sst39vf400a_device::device_start() |
| 225 | | { |
| 226 | | DEVICE_START_NAME( sst39vf400a )(this); |
| 227 | | } |
trunk/src/mess/machine/sst39vfx.h
| r20990 | r20991 | |
| 1 | | /* |
| 2 | | |
| 3 | | SST Multi-Purpose Flash (MPF) |
| 4 | | |
| 5 | | (c) 2001-2007 Tim Schuerewegen |
| 6 | | |
| 7 | | SST39VF020 - 256 KByte |
| 8 | | SST39VF400A - 512 Kbyte |
| 9 | | |
| 10 | | */ |
| 11 | | |
| 12 | | #ifndef _SST39VFX_H_ |
| 13 | | #define _SST39VFX_H_ |
| 14 | | |
| 15 | | #include "emu.h" |
| 16 | | |
| 17 | | /*************************************************************************** |
| 18 | | TYPE DEFINITIONS |
| 19 | | ***************************************************************************/ |
| 20 | | |
| 21 | | struct sst39vfx_config |
| 22 | | { |
| 23 | | int cpu_datawidth; |
| 24 | | int cpu_endianess; |
| 25 | | }; |
| 26 | | |
| 27 | | /*************************************************************************** |
| 28 | | MACROS |
| 29 | | ***************************************************************************/ |
| 30 | | |
| 31 | | class sst39vf020_device : public device_t |
| 32 | | { |
| 33 | | public: |
| 34 | | sst39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 35 | | sst39vf020_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 36 | | ~sst39vf020_device() { global_free(m_token); } |
| 37 | | |
| 38 | | // access to legacy token |
| 39 | | void *token() const { assert(m_token != NULL); return m_token; } |
| 40 | | protected: |
| 41 | | // device-level overrides |
| 42 | | virtual void device_config_complete(); |
| 43 | | virtual void device_start(); |
| 44 | | private: |
| 45 | | // internal state |
| 46 | | void *m_token; |
| 47 | | }; |
| 48 | | |
| 49 | | extern const device_type SST39VF020; |
| 50 | | |
| 51 | | |
| 52 | | #define MCFG_SST39VF020_ADD(_tag, _config) \ |
| 53 | | MCFG_DEVICE_ADD(_tag, SST39VF020, 0) \ |
| 54 | | MCFG_DEVICE_CONFIG(_config) |
| 55 | | |
| 56 | | #define MCFG_SST39VF020_REMOVE(_tag) \ |
| 57 | | MCFG_DEVICE_REMOVE(_tag) |
| 58 | | |
| 59 | | class sst39vf400a_device : public sst39vf020_device |
| 60 | | { |
| 61 | | public: |
| 62 | | sst39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 63 | | protected: |
| 64 | | // device-level overrides |
| 65 | | virtual void device_start(); |
| 66 | | }; |
| 67 | | |
| 68 | | extern const device_type SST39VF400A; |
| 69 | | |
| 70 | | |
| 71 | | #define MCFG_SST39VF400A_ADD(_tag,_config) \ |
| 72 | | MCFG_DEVICE_ADD(_tag, SST39VF400A, 0) \ |
| 73 | | MCFG_DEVICE_CONFIG(_config) |
| 74 | | |
| 75 | | #define MCFG_SST39VF400A_REMOVE(_tag) \ |
| 76 | | MCFG_DEVICE_REMOVE(_tag) |
| 77 | | |
| 78 | | /*************************************************************************** |
| 79 | | FUNCTION PROTOTYPES |
| 80 | | ***************************************************************************/ |
| 81 | | // get base/size |
| 82 | | UINT8* sst39vfx_get_base( device_t *device ); |
| 83 | | UINT32 sst39vfx_get_size( device_t *device ); |
| 84 | | |
| 85 | | // read/write handler |
| 86 | | #if 0 |
| 87 | | DECLARE_READ8_HANDLER( sst39vfx_r ); |
| 88 | | DECLARE_WRITE8_HANDLER( sst39vfx_w ); |
| 89 | | #endif |
| 90 | | |
| 91 | | // load/save |
| 92 | | void sst39vfx_load(device_t *device, emu_file *file); |
| 93 | | void sst39vfx_save(device_t *device, emu_file *file); |
| 94 | | |
| 95 | | // non-volatile ram handler |
| 96 | | //NVRAM_HANDLER( sst39vfx ); |
| 97 | | |
| 98 | | #endif |
trunk/src/mess/machine/cybiko.c
| r20990 | r20991 | |
| 104 | 104 | return TRUE; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | | static void cybiko_sst39vfx_load(running_machine &machine, emu_file *file) |
| 108 | | { |
| 109 | | device_t *device = machine.device("flash2"); |
| 110 | | sst39vfx_load(device, file); |
| 111 | | } |
| 112 | | |
| 113 | | static void cybiko_sst39vfx_save(running_machine &machine, emu_file *file) |
| 114 | | { |
| 115 | | device_t *device = machine.device("flash2"); |
| 116 | | sst39vfx_save(device, file); |
| 117 | | } |
| 118 | | |
| 119 | 107 | static void cybiko_ramdisk_load(running_machine &machine, emu_file *file) |
| 120 | 108 | { |
| 121 | 109 | UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); |
| r20990 | r20991 | |
| 161 | 149 | |
| 162 | 150 | MACHINE_START_MEMBER(cybiko_state,cybikov2) |
| 163 | 151 | { |
| 164 | | device_t *flash2 = machine().device("flash2"); |
| 165 | | |
| 166 | 152 | _logerror( 0, ("machine_start_cybikov2\n")); |
| 167 | | // multi-purpose flash |
| 168 | | nvram_system_load( machine(), "flash2", cybiko_sst39vfx_load, 1); |
| 169 | | machine().root_device().membank( "bank2" )->set_base( sst39vfx_get_base(flash2)); |
| 170 | 153 | // serial port |
| 171 | 154 | cybiko_rs232_init(machine()); |
| 172 | 155 | // other |
| r20990 | r20991 | |
| 175 | 158 | |
| 176 | 159 | MACHINE_START_MEMBER(cybiko_state,cybikoxt) |
| 177 | 160 | { |
| 178 | | device_t *flash2 = machine().device("flash2"); |
| 179 | 161 | _logerror( 0, ("machine_start_cybikoxt\n")); |
| 180 | | // multi-purpose flash |
| 181 | | nvram_system_load( machine(), "flash2", cybiko_sst39vfx_load, 1); |
| 182 | | machine().root_device().membank( "bank2" )->set_base( sst39vfx_get_base(flash2)); |
| 183 | 162 | // ramdisk |
| 184 | 163 | nvram_system_load( machine(), "ramdisk", cybiko_ramdisk_load, 0); |
| 185 | 164 | // serial port |
| r20990 | r20991 | |
| 224 | 203 | void cybiko_state::machine_stop_cybikov2() |
| 225 | 204 | { |
| 226 | 205 | _logerror( 0, ("machine_stop_cybikov2\n")); |
| 227 | | // multi-purpose flash |
| 228 | | nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save); |
| 229 | 206 | // serial port |
| 230 | 207 | cybiko_rs232_exit(); |
| 231 | 208 | } |
| r20990 | r20991 | |
| 233 | 210 | void cybiko_state::machine_stop_cybikoxt() |
| 234 | 211 | { |
| 235 | 212 | _logerror( 0, ("machine_stop_cybikoxt\n")); |
| 236 | | // multi-purpose flash |
| 237 | | nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save); |
| 238 | 213 | // ramdisk |
| 239 | 214 | nvram_system_save( machine(), "ramdisk", cybiko_ramdisk_save); |
| 240 | 215 | // serial port |
| r20990 | r20991 | |
| 318 | 293 | // READ/WRITE HANDLERS // |
| 319 | 294 | ///////////////////////// |
| 320 | 295 | |
| 296 | READ8_MEMBER( cybiko_state::cybikov2_flash_r ) |
| 297 | { |
| 298 | return m_flash2->read(offset); |
| 299 | } |
| 300 | |
| 301 | READ16_MEMBER( cybiko_state::cybikoxt_flash_r ) |
| 302 | { |
| 303 | return m_flashxt->read(offset); |
| 304 | } |
| 305 | |
| 321 | 306 | READ16_MEMBER( cybiko_state::cybiko_lcd_r ) |
| 322 | 307 | { |
| 323 | 308 | UINT16 data = 0; |
trunk/src/mess/includes/cybiko.h
| r20990 | r20991 | |
| 25 | 25 | #include "video/hd66421.h" |
| 26 | 26 | #include "machine/pcf8593.h" |
| 27 | 27 | #include "machine/at45dbxx.h" |
| 28 | | #include "machine/sst39vfx.h" |
| 28 | #include "machine/intelfsh.h" |
| 29 | 29 | #include "machine/ram.h" |
| 30 | 30 | |
| 31 | 31 | struct CYBIKO_RS232_PINS |
| r20990 | r20991 | |
| 49 | 49 | m_crtc(*this, "hd66421"), |
| 50 | 50 | m_speaker(*this, SPEAKER_TAG), |
| 51 | 51 | m_rtc(*this, "rtc"), |
| 52 | | m_flash1(*this, "flash1") |
| 52 | m_flash1(*this, "flash1"), |
| 53 | m_flash2(*this, "flash2"), |
| 54 | m_flashxt(*this, "flashxt") |
| 53 | 55 | { } |
| 54 | 56 | |
| 55 | 57 | CYBIKO_RS232 m_rs232; |
| r20990 | r20991 | |
| 65 | 67 | DECLARE_WRITE8_MEMBER(cybikov1_io_reg_w); |
| 66 | 68 | DECLARE_WRITE8_MEMBER(cybikov2_io_reg_w); |
| 67 | 69 | DECLARE_WRITE8_MEMBER(cybikoxt_io_reg_w); |
| 70 | DECLARE_READ8_MEMBER(cybikov2_flash_r); |
| 71 | DECLARE_READ16_MEMBER(cybikoxt_flash_r); |
| 68 | 72 | int cybiko_key_r( offs_t offset, int mem_mask); |
| 69 | 73 | void cybiko_rs232_write_byte(int data); |
| 70 | 74 | void cybiko_rs232_pin_sck(int data); |
| r20990 | r20991 | |
| 76 | 80 | required_device<speaker_sound_device> m_speaker; |
| 77 | 81 | required_device<pcf8593_device> m_rtc; |
| 78 | 82 | optional_device<at45db041_device> m_flash1; |
| 83 | optional_device<intelfsh8_device> m_flash2; |
| 84 | optional_device<intelfsh16_device> m_flashxt; |
| 79 | 85 | DECLARE_DRIVER_INIT(cybikoxt); |
| 80 | 86 | DECLARE_DRIVER_INIT(cybikov1); |
| 81 | 87 | DECLARE_DRIVER_INIT(cybikov2); |