trunk/src/mess/machine/adam_ide.c
| r0 | r18943 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Micro Innovations Powermate IDE Hard Disk emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | /* |
| 11 | |
| 12 | TODO: |
| 13 | |
| 14 | - parallel status port |
| 15 | - memory bank switching port |
| 16 | - boot ROM |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | #include "adam_ide.h" |
| 21 | |
| 22 | |
| 23 | |
| 24 | //************************************************************************** |
| 25 | // MACROS/CONSTANTS |
| 26 | //************************************************************************** |
| 27 | |
| 28 | #define IDE_TAG "ide" |
| 29 | #define CENTRONICS_TAG "centronics" |
| 30 | |
| 31 | |
| 32 | |
| 33 | //************************************************************************** |
| 34 | // DEVICE DEFINITIONS |
| 35 | //************************************************************************** |
| 36 | |
| 37 | const device_type ADAM_IDE = &device_creator<powermate_ide_device>; |
| 38 | |
| 39 | |
| 40 | //------------------------------------------------- |
| 41 | // ROM( adam_ide ) |
| 42 | //------------------------------------------------- |
| 43 | |
| 44 | ROM_START( adam_ide ) |
| 45 | ROM_REGION( 0x1000, "rom", 0 ) |
| 46 | ROM_LOAD( "exp.rom", 0x0000, 0x1000, NO_DUMP ) |
| 47 | ROM_END |
| 48 | |
| 49 | |
| 50 | //------------------------------------------------- |
| 51 | // rom_region - device-specific ROM region |
| 52 | //------------------------------------------------- |
| 53 | |
| 54 | const rom_entry *powermate_ide_device::device_rom_region() const |
| 55 | { |
| 56 | return ROM_NAME( adam_ide ); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | //------------------------------------------------- |
| 61 | // MACHINE_CONFIG_FRAGMENT( adam_ide ) |
| 62 | //------------------------------------------------- |
| 63 | static MACHINE_CONFIG_FRAGMENT( adam_ide ) |
| 64 | MCFG_IDE_CONTROLLER_ADD(IDE_TAG, ide_image_devices, "hdd", NULL, false) |
| 65 | MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, standard_centronics) |
| 66 | MACHINE_CONFIG_END |
| 67 | |
| 68 | |
| 69 | //------------------------------------------------- |
| 70 | // machine_config_additions - device-specific |
| 71 | // machine configurations |
| 72 | //------------------------------------------------- |
| 73 | |
| 74 | machine_config_constructor powermate_ide_device::device_mconfig_additions() const |
| 75 | { |
| 76 | return MACHINE_CONFIG_NAME( adam_ide ); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | |
| 81 | //************************************************************************** |
| 82 | // LIVE DEVICE |
| 83 | //************************************************************************** |
| 84 | |
| 85 | //------------------------------------------------- |
| 86 | // powermate_ide_device - constructor |
| 87 | //------------------------------------------------- |
| 88 | |
| 89 | powermate_ide_device::powermate_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 90 | : device_t(mconfig, ADAM_IDE, "Powermate HP IDE", tag, owner, clock), |
| 91 | device_adam_expansion_slot_card_interface(mconfig, *this), |
| 92 | m_ide(*this, IDE_TAG), |
| 93 | m_centronics(*this, CENTRONICS_TAG) |
| 94 | { |
| 95 | } |
| 96 | |
| 97 | |
| 98 | //------------------------------------------------- |
| 99 | // device_start - device-specific startup |
| 100 | //------------------------------------------------- |
| 101 | |
| 102 | void powermate_ide_device::device_start() |
| 103 | { |
| 104 | } |
| 105 | |
| 106 | |
| 107 | //------------------------------------------------- |
| 108 | // adam_bd_r - buffered data read |
| 109 | //------------------------------------------------- |
| 110 | |
| 111 | UINT8 powermate_ide_device::adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) |
| 112 | { |
| 113 | if (!biorq) |
| 114 | { |
| 115 | switch (offset & 0xff) |
| 116 | { |
| 117 | case 0x01: |
| 118 | case 0x02: |
| 119 | case 0x03: |
| 120 | case 0x04: |
| 121 | case 0x05: |
| 122 | case 0x06: |
| 123 | case 0x07: |
| 124 | data = ide_bus_r(m_ide, 0, offset & 0x07) & 0xff; |
| 125 | break; |
| 126 | |
| 127 | case 0x40: // Printer status |
| 128 | /* |
| 129 | |
| 130 | bit description |
| 131 | |
| 132 | 0 |
| 133 | 1 |
| 134 | 2 |
| 135 | 3 |
| 136 | 4 |
| 137 | 5 |
| 138 | 6 |
| 139 | 7 |
| 140 | |
| 141 | */ |
| 142 | break; |
| 143 | |
| 144 | case 0x58: |
| 145 | m_ide_data = ide_bus_r(m_ide, 0, 0); |
| 146 | |
| 147 | data = m_ide_data & 0xff; |
| 148 | break; |
| 149 | |
| 150 | case 0x59: |
| 151 | data = m_ide_data >> 8; |
| 152 | break; |
| 153 | |
| 154 | case 0x5a: |
| 155 | data = ide_bus_r(m_ide, 1, 6) & 0xff; |
| 156 | break; |
| 157 | |
| 158 | case 0x5b: // Digital Input Register |
| 159 | data = 0xff; |
| 160 | break; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | return data; |
| 165 | } |
| 166 | |
| 167 | |
| 168 | //------------------------------------------------- |
| 169 | // adam_bd_w - buffered data write |
| 170 | //------------------------------------------------- |
| 171 | |
| 172 | void powermate_ide_device::adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) |
| 173 | { |
| 174 | if (!biorq) |
| 175 | { |
| 176 | switch (offset & 0xff) |
| 177 | { |
| 178 | case 0x02: |
| 179 | case 0x03: |
| 180 | case 0x04: |
| 181 | case 0x05: |
| 182 | case 0x06: |
| 183 | case 0x07: |
| 184 | ide_bus_w(m_ide, 0, offset & 0x07, data); |
| 185 | break; |
| 186 | |
| 187 | case 0x40: |
| 188 | m_centronics->write(space, 0, data); |
| 189 | break; |
| 190 | |
| 191 | case 0x42: // Bank Number |
| 192 | break; |
| 193 | |
| 194 | case 0x58: |
| 195 | m_ide_data |= data; |
| 196 | ide_bus_w(m_ide, 0, 0, m_ide_data); |
| 197 | break; |
| 198 | |
| 199 | case 0x59: |
| 200 | m_ide_data = data << 8; |
| 201 | break; |
| 202 | |
| 203 | case 0x5a: // Fixed Disk Control Register |
| 204 | break; |
| 205 | } |
| 206 | } |
| 207 | } |
trunk/src/mess/machine/adam_ide.h
| r0 | r18943 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Micro Innovations Powermate IDE Hard Disk emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #ifndef __ADAM_IDE__ |
| 13 | #define __ADAM_IDE__ |
| 14 | |
| 15 | #include "emu.h" |
| 16 | #include "machine/adamexp.h" |
| 17 | #include "machine/ctronics.h" |
| 18 | #include "machine/idectrl.h" |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // TYPE DEFINITIONS |
| 24 | //************************************************************************** |
| 25 | |
| 26 | // ======================> powermate_ide_device |
| 27 | |
| 28 | class powermate_ide_device : public device_t, |
| 29 | public device_adam_expansion_slot_card_interface |
| 30 | { |
| 31 | public: |
| 32 | // construction/destruction |
| 33 | powermate_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 34 | |
| 35 | // optional information overrides |
| 36 | virtual const rom_entry *device_rom_region() const; |
| 37 | virtual machine_config_constructor device_mconfig_additions() const; |
| 38 | |
| 39 | protected: |
| 40 | // device-level overrides |
| 41 | virtual void device_config_complete() { m_shortname = "adam_ide"; } |
| 42 | virtual void device_start(); |
| 43 | |
| 44 | // device_adam_expansion_slot_card_interface overrides |
| 45 | virtual UINT8 adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2); |
| 46 | virtual void adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2); |
| 47 | |
| 48 | private: |
| 49 | required_device<ide_controller_device> m_ide; |
| 50 | required_device<centronics_device> m_centronics; |
| 51 | |
| 52 | UINT16 m_ide_data; |
| 53 | }; |
| 54 | |
| 55 | |
| 56 | // device type definition |
| 57 | extern const device_type ADAM_IDE; |
| 58 | |
| 59 | |
| 60 | |
| 61 | #endif |