trunk/src/mess/machine/cbm2_graphic.c
| r0 | r18143 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | CBM 500/600/700 High Resolution Graphics cartridge 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 | - version A (EF9365, 512x512 interlaced, 1 page) |
| 15 | - version B (EF9366, 512x256 non-interlaced, 2 pages) |
| 16 | |
| 17 | */ |
| 18 | |
| 19 | #include "cbm2_graphic.h" |
| 20 | |
| 21 | |
| 22 | |
| 23 | //************************************************************************** |
| 24 | // MACROS/CONSTANTS |
| 25 | //************************************************************************** |
| 26 | |
| 27 | #define EF9365_TAG "ef9365" |
| 28 | #define EF9366_TAG "ef9366" |
| 29 | #define SCREEN_TAG "screen" |
| 30 | |
| 31 | |
| 32 | |
| 33 | //************************************************************************** |
| 34 | // DEVICE DEFINITIONS |
| 35 | //************************************************************************** |
| 36 | |
| 37 | const device_type CBM2_GRAPHIC = &device_creator<cbm2_graphic_cartridge_device>; |
| 38 | |
| 39 | |
| 40 | //------------------------------------------------- |
| 41 | // ef9345_interface gdp_intf |
| 42 | //------------------------------------------------- |
| 43 | |
| 44 | static const ef9345_interface gdp_intf = |
| 45 | { |
| 46 | SCREEN_TAG |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | //------------------------------------------------- |
| 51 | // MACHINE_CONFIG_FRAGMENT( cbm2_graphic_a ) |
| 52 | //------------------------------------------------- |
| 53 | |
| 54 | static MACHINE_CONFIG_FRAGMENT( cbm2_graphic_a ) |
| 55 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 56 | MCFG_SCREEN_UPDATE_DEVICE(EF9365_TAG, ef9345_device, screen_update) |
| 57 | MCFG_SCREEN_SIZE(512, 512) |
| 58 | MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 512-1) |
| 59 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 60 | MCFG_SCREEN_REFRESH_RATE(50) |
| 61 | |
| 62 | MCFG_EF9345_ADD(EF9365_TAG, gdp_intf) |
| 63 | MACHINE_CONFIG_END |
| 64 | |
| 65 | |
| 66 | //------------------------------------------------- |
| 67 | // MACHINE_CONFIG_FRAGMENT( cbm2_graphic_b ) |
| 68 | //------------------------------------------------- |
| 69 | |
| 70 | static MACHINE_CONFIG_FRAGMENT( cbm2_graphic_b ) |
| 71 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 72 | MCFG_SCREEN_UPDATE_DEVICE(EF9366_TAG, ef9345_device, screen_update) |
| 73 | MCFG_SCREEN_SIZE(512, 256) |
| 74 | MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) |
| 75 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 76 | MCFG_SCREEN_REFRESH_RATE(50) |
| 77 | |
| 78 | MCFG_EF9345_ADD(EF9366_TAG, gdp_intf) |
| 79 | MACHINE_CONFIG_END |
| 80 | |
| 81 | |
| 82 | //------------------------------------------------- |
| 83 | // machine_config_additions - device-specific |
| 84 | // machine configurations |
| 85 | //------------------------------------------------- |
| 86 | |
| 87 | machine_config_constructor cbm2_graphic_cartridge_device::device_mconfig_additions() const |
| 88 | { |
| 89 | switch (m_variant) |
| 90 | { |
| 91 | default: return MACHINE_CONFIG_NAME( cbm2_graphic_a ); |
| 92 | case TYPE_B: return MACHINE_CONFIG_NAME( cbm2_graphic_b ); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | |
| 97 | |
| 98 | //************************************************************************** |
| 99 | // LIVE DEVICE |
| 100 | //************************************************************************** |
| 101 | |
| 102 | //------------------------------------------------- |
| 103 | // cbm2_graphic_cartridge_device - constructor |
| 104 | //------------------------------------------------- |
| 105 | |
| 106 | cbm2_graphic_cartridge_device::cbm2_graphic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 107 | device_t(mconfig, CBM2_GRAPHIC, "CBM 500/600/700 High Resolution Graphics", tag, owner, clock), |
| 108 | device_cbm2_expansion_card_interface(mconfig, *this), |
| 109 | m_gdc(*this, EF9365_TAG), |
| 110 | m_variant(TYPE_A) |
| 111 | { |
| 112 | } |
| 113 | |
| 114 | |
| 115 | //------------------------------------------------- |
| 116 | // device_start - device-specific startup |
| 117 | //------------------------------------------------- |
| 118 | |
| 119 | void cbm2_graphic_cartridge_device::device_start() |
| 120 | { |
| 121 | } |
| 122 | |
| 123 | |
| 124 | //------------------------------------------------- |
| 125 | // device_reset - device-specific reset |
| 126 | //------------------------------------------------- |
| 127 | |
| 128 | void cbm2_graphic_cartridge_device::device_reset() |
| 129 | { |
| 130 | } |
| 131 | |
| 132 | |
| 133 | //------------------------------------------------- |
| 134 | // cbm2_bd_r - cartridge data read |
| 135 | //------------------------------------------------- |
| 136 | |
| 137 | UINT8 cbm2_graphic_cartridge_device::cbm2_bd_r(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3) |
| 138 | { |
| 139 | if (!csbank3) |
| 140 | { |
| 141 | if (offset < 0x7f80) |
| 142 | { |
| 143 | data = m_bank3[offset & m_bank1_mask]; |
| 144 | } |
| 145 | else if (offset == 0x7f90) |
| 146 | { |
| 147 | /* |
| 148 | |
| 149 | bit description |
| 150 | |
| 151 | 0 light pen |
| 152 | 1 |
| 153 | 2 |
| 154 | 3 |
| 155 | 4 |
| 156 | 5 |
| 157 | 6 |
| 158 | 7 |
| 159 | |
| 160 | */ |
| 161 | } |
| 162 | else if (offset == 0x7fb0) |
| 163 | { |
| 164 | // hard copy |
| 165 | } |
| 166 | else if (offset >= 0x7ff0) |
| 167 | { |
| 168 | data = m_gdc->data_r(space, offset & 0x07); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | return data; |
| 173 | } |
| 174 | |
| 175 | |
| 176 | //------------------------------------------------- |
| 177 | // cbm2_bd_w - cartridge data write |
| 178 | //------------------------------------------------- |
| 179 | |
| 180 | void cbm2_graphic_cartridge_device::cbm2_bd_w(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3) |
| 181 | { |
| 182 | if (!csbank3) |
| 183 | { |
| 184 | if (offset == 0x7f80) |
| 185 | { |
| 186 | /* |
| 187 | |
| 188 | bit description |
| 189 | |
| 190 | 0 hard copy (0=active) |
| 191 | 1 operating page select (version B) |
| 192 | 2 |
| 193 | 3 read-modify-write (1=active) |
| 194 | 4 display switch (1=graphic) |
| 195 | 5 display page select (version B) |
| 196 | 6 |
| 197 | 7 |
| 198 | |
| 199 | */ |
| 200 | } |
| 201 | else if (offset >= 0x7ff0) |
| 202 | { |
| 203 | m_gdc->data_w(space, offset & 0x07, data); |
| 204 | } |
| 205 | } |
| 206 | } |
trunk/src/mess/machine/cbm2_graphic.h
| r0 | r18143 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | CBM 500/600/700 High Resolution Graphics cartridge 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 __CBM2_GRAPHIC__ |
| 13 | #define __CBM2_GRAPHIC__ |
| 14 | |
| 15 | |
| 16 | #include "emu.h" |
| 17 | #include "machine/cbm2exp.h" |
| 18 | #include "video/ef9345.h" |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // TYPE DEFINITIONS |
| 24 | //************************************************************************** |
| 25 | |
| 26 | // ======================> cbm2_graphic_cartridge_device |
| 27 | |
| 28 | class cbm2_graphic_cartridge_device : public device_t, |
| 29 | public device_cbm2_expansion_card_interface |
| 30 | { |
| 31 | public: |
| 32 | // construction/destruction |
| 33 | cbm2_graphic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 34 | |
| 35 | // optional information overrides |
| 36 | virtual machine_config_constructor device_mconfig_additions() const; |
| 37 | |
| 38 | protected: |
| 39 | enum |
| 40 | { |
| 41 | TYPE_A, |
| 42 | TYPE_B |
| 43 | }; |
| 44 | |
| 45 | // device-level overrides |
| 46 | virtual void device_config_complete() { m_shortname = "cbm2_graphic"; } |
| 47 | virtual void device_start(); |
| 48 | virtual void device_reset(); |
| 49 | |
| 50 | // device_cbm2_expansion_card_interface overrides |
| 51 | virtual UINT8 cbm2_bd_r(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3); |
| 52 | virtual void cbm2_bd_w(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3); |
| 53 | |
| 54 | private: |
| 55 | required_device<ef9345_device> m_gdc; |
| 56 | |
| 57 | int m_variant; |
| 58 | }; |
| 59 | |
| 60 | |
| 61 | // device type definition |
| 62 | extern const device_type CBM2_GRAPHIC; |
| 63 | |
| 64 | |
| 65 | #endif |