src/mess/drivers/e01.c
| r8157 | r8158 | |
| 33 | 33 | |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | /* |
| 37 | |
| 38 | TODO: |
| 39 | |
| 40 | - front flap status |
| 41 | - artwork |
| 42 | - RTC interrupts (rewrite mc146818) |
| 43 | - ECONET |
| 44 | - hard disk |
| 45 | |
| 46 | */ |
| 47 | |
| 36 | 48 | #include "emu.h" |
| 37 | 49 | #include "includes/e01.h" |
| 38 | 50 | #include "cpu/m6502/m6502.h" |
| r8157 | r8158 | |
| 41 | 53 | #include "machine/ctronics.h" |
| 42 | 54 | #include "machine/6522via.h" |
| 43 | 55 | #include "machine/mc146818.h" |
| 56 | #include "machine/mc6854.h" |
| 44 | 57 | #include "machine/wd17xx.h" |
| 58 | #include "e01.lh" |
| 45 | 59 | |
| 46 | 60 | /*************************************************************************** |
| 47 | 61 | READ/WRITE HANDLERS |
| 48 | 62 | ***************************************************************************/ |
| 49 | 63 | |
| 64 | static READ8_HANDLER( rtc_address_r ) |
| 65 | { |
| 66 | return mc146818_port_r(space, 0); |
| 67 | } |
| 68 | |
| 69 | static WRITE8_HANDLER( rtc_address_w ) |
| 70 | { |
| 71 | mc146818_port_w(space, 0, data); |
| 72 | } |
| 73 | |
| 74 | static READ8_HANDLER( rtc_data_r ) |
| 75 | { |
| 76 | return mc146818_port_r(space, 1); |
| 77 | } |
| 78 | |
| 79 | static WRITE8_HANDLER( rtc_data_w ) |
| 80 | { |
| 81 | mc146818_port_w(space, 1, data); |
| 82 | } |
| 83 | |
| 50 | 84 | /*------------------------------------------------- |
| 51 | 85 | eprom_r - ROM/RAM select read |
| 52 | 86 | -------------------------------------------------*/ |
| r8157 | r8158 | |
| 96 | 130 | wd17xx_set_side(device, BIT(data, 2)); |
| 97 | 131 | |
| 98 | 132 | /* TODO NVRAM select */ |
| 133 | //mc146818_stby_w(state->rtc, BIT(data, 3)); |
| 99 | 134 | |
| 100 | 135 | /* floppy density */ |
| 101 | 136 | wd17xx_dden_w(device, BIT(data, 4)); |
| r8157 | r8158 | |
| 106 | 141 | /* TODO floppy test */ |
| 107 | 142 | //wd17xx_test_w(device, BIT(data, 6)); |
| 108 | 143 | |
| 109 | | /* TODO mode LED */ |
| 144 | /* mode LED */ |
| 145 | output_set_value("led_0", BIT(data, 7)); |
| 110 | 146 | } |
| 111 | 147 | |
| 148 | static READ8_HANDLER( network_irq_disable_r ) |
| 149 | { |
| 150 | e01_state *state = (e01_state *)space->machine->driver_data; |
| 151 | |
| 152 | state->network_irq_enabled = false; |
| 153 | |
| 154 | return 0; |
| 155 | } |
| 156 | |
| 157 | static WRITE8_HANDLER( network_irq_disable_w ) |
| 158 | { |
| 159 | e01_state *state = (e01_state *)space->machine->driver_data; |
| 160 | |
| 161 | state->network_irq_enabled = false; |
| 162 | } |
| 163 | |
| 164 | static READ8_HANDLER( network_irq_enable_r ) |
| 165 | { |
| 166 | e01_state *state = (e01_state *)space->machine->driver_data; |
| 167 | |
| 168 | state->network_irq_enabled = true; |
| 169 | |
| 170 | return 0; |
| 171 | } |
| 172 | |
| 173 | static WRITE8_HANDLER( network_irq_enable_w ) |
| 174 | { |
| 175 | e01_state *state = (e01_state *)space->machine->driver_data; |
| 176 | |
| 177 | state->network_irq_enabled = true; |
| 178 | |
| 179 | mc146818_port_w(space, 1, data); |
| 180 | } |
| 181 | |
| 112 | 182 | /*************************************************************************** |
| 113 | 183 | MEMORY MAPS |
| 114 | 184 | ***************************************************************************/ |
| r8157 | r8158 | |
| 119 | 189 | |
| 120 | 190 | static ADDRESS_MAP_START( e01_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 121 | 191 | AM_RANGE(0x0000, 0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") |
| 122 | | // AM_RANGE(0xfc00, 0xfc00) AM_MIRROR(0x00c3) RTC address |
| 123 | | // AM_RANGE(0xfc04, 0xfc04) AM_MIRROR(0x00c3) RTC data |
| 192 | AM_RANGE(0xfc00, 0xfc00) AM_MIRROR(0x00c3) AM_READWRITE(rtc_address_r, rtc_address_w) |
| 193 | AM_RANGE(0xfc04, 0xfc04) AM_MIRROR(0x00c3) AM_READWRITE(rtc_data_r, rtc_data_w) |
| 124 | 194 | AM_RANGE(0xfc08, 0xfc08) AM_MIRROR(0x00c0) AM_READ(ram_select_r) AM_DEVWRITE(WD2793_TAG, floppy_w) |
| 125 | 195 | AM_RANGE(0xfc0c, 0xfc0f) AM_MIRROR(0x00c0) AM_DEVREADWRITE(WD2793_TAG, wd17xx_r, wd17xx_w) |
| 126 | 196 | AM_RANGE(0xfc10, 0xfc1f) AM_MIRROR(0x00c0) AM_DEVREADWRITE(R6522_TAG, via_r, via_w) |
| 127 | | // AM_RANGE(0xfc20, 0xfc23) AM_MIRROR(0x00c0) AM_DEVREADWRITE(MC6854_TAG, mc6854_r, mc6854_w) |
| 128 | | // AM_RANGE(0xfc24, 0xfc24) AM_MIRROR(0x00c3) network interrupt disable |
| 129 | | // AM_RANGE(0xfc28, 0xfc24) AM_MIRROR(0x00c3) network interrupt enable |
| 197 | AM_RANGE(0xfc20, 0xfc23) AM_MIRROR(0x00c0) AM_DEVREADWRITE(MC6854_TAG, mc6854_r, mc6854_w) |
| 198 | AM_RANGE(0xfc24, 0xfc24) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_disable_r, network_irq_disable_w) |
| 199 | AM_RANGE(0xfc28, 0xfc28) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_enable_r, network_irq_enable_w) |
| 130 | 200 | // AM_RANGE(0xfc2c, 0xfc2c) AM_MIRROR(0x00c3) front flap status, SW3 |
| 131 | 201 | // AM_RANGE(0xfc30, 0xfc30) AM_MIRROR(0x00c0) HD data |
| 132 | 202 | // AM_RANGE(0xfc31, 0xfc31) AM_MIRROR(0x00c0) HD status |
| r8157 | r8158 | |
| 150 | 220 | DEVICE CONFIGURATION |
| 151 | 221 | ***************************************************************************/ |
| 152 | 222 | |
| 223 | static const mc6854_interface adlc_intf = |
| 224 | { |
| 225 | NULL, |
| 226 | NULL, |
| 227 | NULL, |
| 228 | NULL |
| 229 | }; |
| 230 | |
| 153 | 231 | /*------------------------------------------------- |
| 154 | 232 | via6522_interface via_intf |
| 155 | 233 | -------------------------------------------------*/ |
| r8157 | r8158 | |
| 209 | 287 | |
| 210 | 288 | static MACHINE_START( e01 ) |
| 211 | 289 | { |
| 290 | e01_state *state = (e01_state *)machine->driver_data; |
| 291 | |
| 212 | 292 | UINT8 *ram = messram_get_ptr(devtag_get_device(machine, "messram")); |
| 213 | 293 | UINT8 *rom = memory_region(machine, R65C102_TAG); |
| 214 | 294 | |
| r8157 | r8158 | |
| 226 | 306 | |
| 227 | 307 | memory_configure_bank(machine, "bank4", 0, 1, ram + 0xfd00, 0); |
| 228 | 308 | memory_set_bank(machine, "bank4", 0); |
| 309 | |
| 310 | /* initialize RTC */ |
| 311 | mc146818_init(machine, MC146818_STANDARD); |
| 312 | |
| 313 | /* register for state saving */ |
| 314 | state_save_register_global(machine, state->network_irq_enabled); |
| 229 | 315 | } |
| 230 | 316 | |
| 231 | 317 | /*------------------------------------------------- |
| r8157 | r8158 | |
| 247 | 333 | -------------------------------------------------*/ |
| 248 | 334 | |
| 249 | 335 | static MACHINE_DRIVER_START( e01 ) |
| 336 | MDRV_DRIVER_DATA(e01_state) |
| 337 | |
| 250 | 338 | /* basic machine hardware */ |
| 251 | 339 | MDRV_CPU_ADD(R65C102_TAG, M65C02, 1000000) // Rockwell R65C102P3 |
| 252 | 340 | MDRV_CPU_PROGRAM_MAP(e01_mem) |
| r8157 | r8158 | |
| 254 | 342 | MDRV_MACHINE_START(e01) |
| 255 | 343 | MDRV_MACHINE_RESET(e01) |
| 256 | 344 | |
| 345 | MDRV_NVRAM_HANDLER(mc146818) |
| 346 | |
| 257 | 347 | /* video hardware */ |
| 258 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 259 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 260 | | MDRV_SCREEN_REFRESH_RATE(60) |
| 261 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 262 | | MDRV_SCREEN_SIZE(640, 400) |
| 263 | | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 264 | | MDRV_PALETTE_LENGTH(2) |
| 265 | | MDRV_PALETTE_INIT(black_and_white) |
| 266 | | MDRV_VIDEO_START(generic_bitmapped) |
| 267 | | MDRV_VIDEO_UPDATE(generic_bitmapped) |
| 348 | MDRV_DEFAULT_LAYOUT( layout_e01 ) |
| 268 | 349 | |
| 269 | 350 | /* devices */ |
| 270 | 351 | MDRV_VIA6522_ADD(R6522_TAG, 100000, via_intf) |
| 352 | MDRV_MC6854_ADD(MC6854_TAG, adlc_intf) |
| 271 | 353 | MDRV_WD2793_ADD(WD2793_TAG, fdc_intf) |
| 272 | 354 | MDRV_FLOPPY_2_DRIVES_ADD(e01_floppy_config) |
| 273 | 355 | // MDRV_CENTRONICS_ADD(CENTRONICS_TAG, e01_centronics_config) |