src/mess/machine/special.c
| r2102 | r2103 | |
| 12 | 12 | #include "cpu/i8085/i8085.h" |
| 13 | 13 | #include "sound/dac.h" |
| 14 | 14 | #include "devices/cassette.h" |
| 15 | #include "devices/basicdsk.h" |
| 15 | 16 | #include "machine/8255ppi.h" |
| 17 | #include "machine/pit8253.h" |
| 18 | #include "machine/wd17xx.h" |
| 16 | 19 | |
| 17 | | |
| 18 | 20 | UINT8 specimx_color; |
| 19 | 21 | UINT8 *specimx_colorram; |
| 20 | 22 | |
| r2102 | r2103 | |
| 32 | 34 | memory_configure_bank(1, 0, 2, RAM, 0xc000); |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | | DRIVER_INIT(specimx) |
| 36 | | { |
| 37 | | memset(mess_ram,0,256*1024); |
| 38 | | } |
| 39 | | |
| 40 | 37 | READ8_HANDLER (specialist_8255_porta_r ) |
| 41 | 38 | { |
| 42 | 39 | if (readinputport(0)!=0xff) return 0xfe; |
| r2102 | r2103 | |
| 200 | 197 | specimx_set_bank(offset); |
| 201 | 198 | } |
| 202 | 199 | |
| 200 | void specimx_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param) |
| 201 | { |
| 202 | switch (event) |
| 203 | { |
| 204 | case WD17XX_IRQ_CLR: |
| 205 | case WD17XX_IRQ_SET: |
| 206 | case WD17XX_DRQ_CLR: |
| 207 | case WD17XX_DRQ_SET: |
| 208 | /* do nothing */ |
| 209 | break; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | DRIVER_INIT(specimx) |
| 214 | { |
| 215 | memset(mess_ram,0,256*1024); |
| 216 | } |
| 217 | |
| 218 | static const struct pit8253_config specimx_pit8253_intf = |
| 219 | { |
| 220 | TYPE8253, |
| 221 | { |
| 222 | { |
| 223 | 2000000, |
| 224 | NULL, |
| 225 | NULL |
| 226 | }, |
| 227 | { |
| 228 | 2000000, |
| 229 | NULL, |
| 230 | NULL |
| 231 | }, |
| 232 | { |
| 233 | 2000000, |
| 234 | NULL, |
| 235 | NULL |
| 236 | } |
| 237 | } |
| 238 | }; |
| 239 | |
| 240 | MACHINE_START( specimx ) |
| 241 | { |
| 242 | wd17xx_init(machine, WD_TYPE_1793, specimx_fdc_callback, NULL); |
| 243 | wd17xx_set_density (DEN_FM_HI); |
| 244 | pit8253_init(1, &specimx_pit8253_intf); |
| 245 | } |
| 246 | |
| 203 | 247 | MACHINE_RESET( specimx ) |
| 204 | 248 | { |
| 205 | 249 | ppi8255_init(&specialist_ppi8255_interface); |
| 206 | 250 | specimx_set_bank(2); // Initiali load ROM disk |
| 207 | 251 | specimx_color = 0x70; |
| 252 | wd17xx_reset(); |
| 253 | wd17xx_set_side(0); |
| 208 | 254 | } |
| 209 | 255 | |
| 256 | READ8_HANDLER ( specimx_disk_data_r ) |
| 257 | { |
| 258 | switch(offset) { |
| 259 | case 0 : |
| 260 | return wd17xx_status_r(machine, offset); |
| 261 | case 1 : |
| 262 | return wd17xx_track_r(machine, offset); |
| 263 | case 2 : |
| 264 | return wd17xx_sector_r(machine, offset); |
| 265 | case 3 : |
| 266 | return wd17xx_data_r(machine, offset); |
| 267 | } |
| 268 | return 0; |
| 269 | } |
| 270 | WRITE8_HANDLER( specimx_disk_data_w ) |
| 271 | { |
| 272 | switch(offset) { |
| 273 | case 0 : |
| 274 | wd17xx_command_w(machine, offset, data);break; |
| 275 | case 1 : |
| 276 | wd17xx_track_w (machine, offset, data);break; |
| 277 | case 2 : |
| 278 | wd17xx_sector_w (machine, offset, data);break; |
| 279 | case 3 : |
| 280 | wd17xx_data_w (machine, offset, data);break; |
| 281 | } |
| 282 | } |
| 210 | 283 | |
| 284 | READ8_HANDLER ( specimx_disk_ctrl_r ) |
| 285 | { |
| 286 | return 0xff; |
| 287 | } |
| 288 | |
| 289 | WRITE8_HANDLER( specimx_disk_ctrl_w ) |
| 290 | { |
| 291 | |
| 292 | switch(offset) { |
| 293 | case 2 : |
| 294 | wd17xx_set_side(data & 1); |
| 295 | break; |
| 296 | case 3 : |
| 297 | wd17xx_set_drive(data & 1); |
| 298 | break; |
| 299 | |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | static unsigned long specimx_calcoffset(UINT8 t, UINT8 h, UINT8 s, |
| 304 | UINT8 tracks, UINT8 heads, UINT8 sec_per_track, UINT16 sector_length, UINT8 first_sector_id, UINT16 offset_track_zero) |
| 305 | { |
| 306 | unsigned long o; |
| 307 | o = (t * 1024 * 5 * 2) + (h * 1024 * 5) + 1024 * (s-1); |
| 308 | return o; |
| 309 | } |
| 310 | |
| 311 | DEVICE_LOAD( specimx_floppy ) |
| 312 | { |
| 313 | int size; |
| 314 | |
| 315 | if (! image_has_been_created(image)) |
| 316 | { |
| 317 | size = image_length(image); |
| 318 | |
| 319 | switch (size) |
| 320 | { |
| 321 | case 800*1024: |
| 322 | break; |
| 323 | default: |
| 324 | return INIT_FAIL; |
| 325 | } |
| 326 | } |
| 327 | else |
| 328 | return INIT_FAIL; |
| 329 | |
| 330 | if (device_load_basicdsk_floppy (image) != INIT_PASS) |
| 331 | return INIT_FAIL; |
| 332 | |
| 333 | basicdsk_set_geometry (image, 80, 2, 6, 1024, 1, 0, FALSE); |
| 334 | basicdsk_set_calcoffset(image, specimx_calcoffset); |
| 335 | return INIT_PASS; |
| 336 | } |
src/mess/drivers/special.c
| r2102 | r2103 | |
| 12 | 12 | #include "cpu/i8085/i8085.h" |
| 13 | 13 | #include "includes/special.h" |
| 14 | 14 | #include "machine/8255ppi.h" |
| 15 | #include "machine/pit8253.h" |
| 15 | 16 | #include "sound/dac.h" |
| 16 | 17 | #include "devices/cassette.h" |
| 18 | #include "devices/basicdsk.h" |
| 17 | 19 | #include "formats/rk_cas.h" |
| 20 | #include "machine/wd17xx.h" |
| 18 | 21 | |
| 19 | 22 | /* Address maps */ |
| 20 | 23 | static ADDRESS_MAP_START(specialist_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 21 | | AM_RANGE( 0x0000, 0x2fff ) AM_RAMBANK(1) // First bank |
| 24 | AM_RANGE( 0x0000, 0x2fff ) AM_RAMBANK(1) // First bank |
| 22 | 25 | AM_RANGE( 0x3000, 0x8fff ) AM_RAM // RAM |
| 23 | 26 | AM_RANGE( 0x9000, 0xbfff ) AM_RAM AM_BASE(&specialist_video_ram) // Video RAM |
| 24 | 27 | AM_RANGE( 0xc000, 0xf000 ) AM_ROM // System ROM |
| r2102 | r2103 | |
| 28 | 31 | |
| 29 | 32 | |
| 30 | 33 | static ADDRESS_MAP_START(specimx_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 31 | | AM_RANGE( 0x0000, 0x8fff ) AM_READWRITE(SMH_BANK1, SMH_BANK1) |
| 32 | | AM_RANGE( 0x9000, 0xbfff ) AM_READWRITE(SMH_BANK2, SMH_BANK2) |
| 33 | | AM_RANGE( 0xc000, 0xffbf ) AM_READWRITE(SMH_BANK3, SMH_BANK3) |
| 34 | AM_RANGE( 0x0000, 0x8fff ) AM_READWRITE(SMH_BANK1, SMH_BANK1) |
| 35 | AM_RANGE( 0x9000, 0xbfff ) AM_READWRITE(SMH_BANK2, SMH_BANK2) |
| 36 | AM_RANGE( 0xc000, 0xffbf ) AM_READWRITE(SMH_BANK3, SMH_BANK3) |
| 34 | 37 | AM_RANGE( 0xffc0, 0xffdf ) AM_READWRITE(SMH_BANK4, SMH_BANK4) |
| 35 | 38 | AM_RANGE( 0xffe0, 0xffe3 ) AM_READWRITE(specialist_keyboard_r,specialist_keyboard_w) // 8255 for keyboard |
| 36 | 39 | AM_RANGE( 0xffe4, 0xffe7 ) AM_RAM //external 8255 |
| 40 | AM_RANGE( 0xffe8, 0xffeb ) AM_READWRITE(specimx_disk_data_r,specimx_disk_data_w) |
| 41 | AM_RANGE( 0xffec, 0xffef ) AM_READWRITE(pit8253_0_r, pit8253_0_w) |
| 42 | AM_RANGE( 0xfff0, 0xfff3 ) AM_READWRITE(specimx_disk_ctrl_r, specimx_disk_ctrl_w) |
| 37 | 43 | AM_RANGE( 0xfff8, 0xfff8 ) AM_READWRITE(specimx_video_color_r,specimx_video_color_w) |
| 38 | 44 | AM_RANGE( 0xfffc, 0xfffe ) AM_WRITE(specimx_select_bank) |
| 39 | 45 | ADDRESS_MAP_END |
| r2102 | r2103 | |
| 305 | 311 | static MACHINE_DRIVER_START( specimx ) |
| 306 | 312 | MDRV_CPU_ADD(8080, 2000000) |
| 307 | 313 | MDRV_CPU_PROGRAM_MAP(specimx_mem, 0) |
| 308 | | MDRV_MACHINE_RESET( specimx ) |
| 314 | |
| 315 | MDRV_MACHINE_START ( specimx ) |
| 316 | MDRV_MACHINE_RESET ( specimx ) |
| 317 | |
| 309 | 318 | |
| 310 | 319 | /* video hardware */ |
| 311 | 320 | MDRV_SCREEN_ADD("main", RASTER) |
| r2102 | r2103 | |
| 368 | 377 | } |
| 369 | 378 | } |
| 370 | 379 | |
| 380 | static void specimx_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 381 | { |
| 382 | /* floppy */ |
| 383 | switch(state) |
| 384 | { |
| 385 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 386 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break; |
| 387 | |
| 388 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 389 | case MESS_DEVINFO_PTR_LOAD: info->load = device_load_specimx_floppy; break; |
| 390 | |
| 391 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 392 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "odi,img"); break; |
| 393 | |
| 394 | default: legacybasicdsk_device_getinfo(devclass, state, info); break; |
| 395 | } |
| 396 | } |
| 371 | 397 | SYSTEM_CONFIG_START(special) |
| 372 | 398 | CONFIG_DEVICE(special_cassette_getinfo) |
| 373 | 399 | SYSTEM_CONFIG_END |
| r2102 | r2103 | |
| 375 | 401 | SYSTEM_CONFIG_START(specimx) |
| 376 | 402 | CONFIG_RAM_DEFAULT(256 * 1024) |
| 377 | 403 | CONFIG_DEVICE(special_cassette_getinfo) |
| 404 | CONFIG_DEVICE(specimx_floppy_getinfo); |
| 378 | 405 | SYSTEM_CONFIG_END |
| 379 | 406 | |
| 380 | 407 | /* Driver */ |