src/mess/machine/super80.c
| r4965 | r4966 | |
| 1 | | /* Super80.c written by Robbbert, 2005-2009. See the MESS wiki for documentation. */
|
| 2 | | |
| 3 | | #include "driver.h"
|
| 4 | | //#include "cpu/z80/z80.h"
|
| 5 | | #include "sound/wave.h"
|
| 6 | | #include "devices/cassette.h"
|
| 7 | | #include "sound/speaker.h"
|
| 8 | | #include "machine/ctronics.h"
|
| 9 | | #include "super80.h"
|
| 10 | | |
| 11 | | /* Bits in shared variable:
|
| 12 | | d5 cassette LED
|
| 13 | | d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom)
|
| 14 | | d2 super80v video or colour bankswitch (1=video ram, 0=colour ram)
|
| 15 | | d2 super80 screen off (=2mhz) or on (bursts of 2mhz at 50hz = 1mhz) */
|
| 16 | | |
| 17 | | UINT8 super80_shared=0xff;
|
| 18 | | |
| 19 | | static const device_config *super80_z80pio;
|
| 20 | | static const device_config *super80_speaker;
|
| 21 | | static const device_config *super80_cassette;
|
| 22 | | static const device_config *super80_printer;
|
| 23 | | |
| 24 | | /**************************** PIO ******************************************************************************/
|
| 25 | | |
| 26 | | static UINT8 keylatch;
|
| 27 | | |
| 28 | | /* This activates when Control + C + 4 pressed */
|
| 29 | | static void super80_pio_interrupt(const device_config *device, int state)
|
| 30 | | {
|
| 31 | | cputag_set_input_line(device->machine, "maincpu", 0, state );
|
| 32 | | }
|
| 33 | | |
| 34 | | static WRITE8_DEVICE_HANDLER( pio_port_a_w )
|
| 35 | | {
|
| 36 | | keylatch = data;
|
| 37 | | };
|
| 38 | | |
| 39 | | static READ8_DEVICE_HANDLER( pio_port_b_r )
|
| 40 | | {
|
| 41 | | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" };
|
| 42 | | |
| 43 | | int bit;
|
| 44 | | UINT8 data = 0xff;
|
| 45 | | |
| 46 | | for (bit = 0; bit < 8; bit++)
|
| 47 | | {
|
| 48 | | if (!BIT(keylatch, bit)) data &= input_port_read(device->machine, keynames[bit]);
|
| 49 | | }
|
| 50 | | |
| 51 | | return data;
|
| 52 | | };
|
| 53 | | |
| 54 | | const z80pio_interface super80_pio_intf =
|
| 55 | | {
|
| 56 | | DEVCB_LINE(super80_pio_interrupt), /* callback when change interrupt status */
|
| 57 | | DEVCB_NULL,
|
| 58 | | DEVCB_HANDLER(pio_port_b_r),
|
| 59 | | DEVCB_HANDLER(pio_port_a_w),
|
| 60 | | DEVCB_NULL,
|
| 61 | | DEVCB_NULL, /* portA ready active callback (not used in super80) */
|
| 62 | | DEVCB_NULL /* portB ready active callback (not used in super80) */
|
| 63 | | };
|
| 64 | | |
| 65 | | |
| 66 | | /**************************** CASSETTE ROUTINES *****************************************************************/
|
| 67 | | |
| 68 | | static void super80_cassette_motor( running_machine *machine, UINT8 data )
|
| 69 | | {
|
| 70 | | if (data)
|
| 71 | | cassette_change_state(super80_cassette, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
|
| 72 | | else
|
| 73 | | cassette_change_state(super80_cassette, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
|
| 74 | | |
| 75 | | /* does user want to hear the sound? */
|
| 76 | | if (input_port_read(machine, "CONFIG") & 8)
|
| 77 | | cassette_change_state(super80_cassette, CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER);
|
| 78 | | else
|
| 79 | | cassette_change_state(super80_cassette, CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
|
| 80 | | }
|
| 81 | | |
| 82 | | /********************************************* TIMER ************************************************/
|
| 83 | | |
| 84 | | static UINT8 cass_data[]={ 0, 0, 0, 0 };
|
| 85 | | |
| 86 | | /* this timer runs at 200khz and does 2 jobs: |
| 87 | | 1. Scan the keyboard and present the results to the pio |
| 88 | | 2. Emulate the 2 chips in the cassette input circuit |
| 89 | | |
| 90 | | Reasons why it is necessary: |
| 91 | | 1. The real z80pio is driven by the cpu clock and is capable of independent actions. |
| 92 | | MAME does not support this at all. If the interrupt key sequence is entered, the |
| 93 | | computer can be reset out of a hung state by the operator. |
| 94 | | 2. This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, |
| 95 | | and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint.
|
| 96 | | |
| 97 | | The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop.
|
| 98 | | My "read-any-system" cassette circuit was a CA3140 op-amp, the smarts being done in software.
|
| 99 | | |
| 100 | | bit 0 = original system (U79 and U1)
|
| 101 | | bit 1 = MDS fast system
|
| 102 | | bit 2 = CA3140 */
|
| 103 | | |
| 104 | | static TIMER_CALLBACK( super80_timer )
|
| 105 | | {
|
| 106 | | UINT8 cass_ws=0;
|
| 107 | | |
| 108 | | cass_data[1]++;
|
| 109 | | cass_ws = (cassette_input(super80_cassette) > +0.03) ? 4 : 0;
|
| 110 | | |
| 111 | | if (cass_ws != cass_data[0])
|
| 112 | | {
|
| 113 | | if (cass_ws) cass_data[3] ^= 2; // the MDS flipflop
|
| 114 | | cass_data[0] = cass_ws;
|
| 115 | | cass_data[2] = ((cass_data[1] < 0x40) ? 1 : 0) | cass_ws | cass_data[3];
|
| 116 | | cass_data[1] = 0;
|
| 117 | | }
|
| 118 | | |
| 119 | | z80pio_p_w(super80_z80pio,1,pio_port_b_r(super80_z80pio,0));
|
| 120 | | }
|
| 121 | | |
| 122 | | /* after the first 4 bytes have been read from ROM, switch the ram back in */
|
| 123 | | static TIMER_CALLBACK( super80_reset )
|
| 124 | | {
|
| 125 | | memory_set_bank(machine, 1, 0);
|
| 126 | | }
|
| 127 | | |
| 128 | | static TIMER_CALLBACK( super80_halfspeed )
|
| 129 | | {
|
| 130 | | static UINT8 int_sw=0;
|
| 131 | | UINT8 go_fast = 0;
|
| 132 | | if (!(super80_shared & 4) || (!(input_port_read(machine, "CONFIG") & 2))) /* bit 2 of port F0 is low, OR user turned on config switch */
|
| 133 | | go_fast++;
|
| 134 | | |
| 135 | | /* code to slow down computer to 1 MHz by halting cpu on every second frame */
|
| 136 | | if (!go_fast)
|
| 137 | | {
|
| 138 | | if (!int_sw)
|
| 139 | | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it
|
| 140 | | |
| 141 | | int_sw++;
|
| 142 | | if (int_sw > 1)
|
| 143 | | {
|
| 144 | | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it
|
| 145 | | int_sw = 0;
|
| 146 | | }
|
| 147 | | }
|
| 148 | | else
|
| 149 | | {
|
| 150 | | if (int_sw < 8) // @2MHz, reset just once
|
| 151 | | {
|
| 152 | | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
|
| 153 | | int_sw = 8; // ...not every time
|
| 154 | | }
|
| 155 | | }
|
| 156 | | }
|
| 157 | | |
| 158 | | /*************************************** PRINTER ********************************************************/
|
| 159 | | |
| 160 | | /* The Super80 had an optional I/O card that plugged into the S-100 slot. The card had facility for running
|
| 161 | | an 8-bit Centronics printer, and a serial device at 300, 600, or 1200 baud. The I/O address range
|
| 162 | | was selectable via 4 dipswitches. The serial parameters (baud rate, parity, stop bits, etc) was
|
| 163 | | chosen with more dipswitches. Regretably, no parameters could be set by software. Currently, the
|
| 164 | | Centronics printer is emulated; the serial side of things may be done later, as will the dipswitches.
|
| 165 | | |
| 166 | | The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control
|
| 167 | | All the home-brew roms use this, except for super80e which uses BC-BE (which we don't support yet). */
|
| 168 | | |
| 169 | | /**************************** I/O PORTS *****************************************************************/
|
| 170 | | |
| 171 | | READ8_HANDLER( super80_dc_r )
|
| 172 | | {
|
| 173 | | UINT8 data=0x7f;
|
| 174 | | |
| 175 | | /* bit 7 = printer busy
|
| 176 | | 0 = printer is not busy */
|
| 177 | | |
| 178 | | data |= centronics_busy_r(super80_printer) << 7;
|
| 179 | | |
| 180 | | return data;
|
| 181 | | }
|
| 182 | | |
| 183 | | READ8_HANDLER( super80_f2_r )
|
| 184 | | {
|
| 185 | | UINT8 data = input_port_read(space->machine, "DSW") & 0xf0; // dip switches on pcb
|
| 186 | | data |= cass_data[2]; // bit 0 = output of U1, bit 1 = MDS cass state, bit 2 = current wave_state
|
| 187 | | data |= 0x08; // bit 3 - not used
|
| 188 | | return data;
|
| 189 | | }
|
| 190 | | |
| 191 | | WRITE8_HANDLER( super80_dc_w )
|
| 192 | | {
|
| 193 | | /* hardware strobe driven from port select, bit 7..0 = data */
|
| 194 | | centronics_strobe_w(super80_printer, 1);
|
| 195 | | centronics_data_w(super80_printer, 0, data);
|
| 196 | | centronics_strobe_w(super80_printer, 0);
|
| 197 | | }
|
| 198 | | |
| 199 | | static UINT8 last_data;
|
| 200 | | |
| 201 | | WRITE8_HANDLER( super80_f0_w )
|
| 202 | | {
|
| 203 | | UINT8 bits = data ^ last_data;
|
| 204 | | super80_shared = data;
|
| 205 | | speaker_level_w(super80_speaker, (data & 8) ? 0 : 1); /* bit 3 - speaker */
|
| 206 | | if (bits & 2) super80_cassette_motor(space->machine, data & 2 ? 1 : 0); /* bit 1 - cassette motor */
|
| 207 | | cassette_output(super80_cassette, (data & 1) ? -1.0 : +1.0); /* bit 0 - cass out */
|
| 208 | | |
| 209 | | last_data = data;
|
| 210 | | }
|
| 211 | | |
| 212 | | WRITE8_HANDLER( super80r_f0_w )
|
| 213 | | {
|
| 214 | | super80_f0_w(space, 0, data);
|
| 215 | | super80_shared |= 0x14;
|
| 216 | | }
|
| 217 | | |
| 218 | | READ8_DEVICE_HANDLER( super80_pio_r )
|
| 219 | | {
|
| 220 | | if (!offset)
|
| 221 | | return z80pio_d_r(device, 0);
|
| 222 | | else
|
| 223 | | if (offset == 1)
|
| 224 | | return z80pio_c_r(device, 0);
|
| 225 | | else
|
| 226 | | if (offset == 2)
|
| 227 | | return z80pio_d_r(device, 1);
|
| 228 | | else
|
| 229 | | return z80pio_c_r(device, 1);
|
| 230 | | }
|
| 231 | | |
| 232 | | WRITE8_DEVICE_HANDLER( super80_pio_w )
|
| 233 | | {
|
| 234 | | if (!offset)
|
| 235 | | z80pio_d_w(device, 0, data);
|
| 236 | | else
|
| 237 | | if (offset == 1)
|
| 238 | | z80pio_c_w(device, 0, data);
|
| 239 | | else
|
| 240 | | if (offset == 2)
|
| 241 | | z80pio_d_w(device, 1, data);
|
| 242 | | else
|
| 243 | | z80pio_c_w(device, 1, data);
|
| 244 | | }
|
| 245 | | |
| 246 | | /**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/
|
| 247 | | |
| 248 | | MACHINE_RESET( super80 )
|
| 249 | | {
|
| 250 | | super80_shared=0xff;
|
| 251 | | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, super80_reset);
|
| 252 | | memory_set_bank(machine, 1, 1);
|
| 253 | | super80_z80pio = devtag_get_device(machine, "z80pio");
|
| 254 | | super80_speaker = devtag_get_device(machine, "speaker");
|
| 255 | | super80_cassette = devtag_get_device(machine, "cassette");
|
| 256 | | super80_printer = devtag_get_device(machine, "centronics");
|
| 257 | | }
|
| 258 | | |
| 259 | | static void driver_init_common( running_machine *machine )
|
| 260 | | {
|
| 261 | | UINT8 *RAM = memory_region(machine, "maincpu");
|
| 262 | | memory_configure_bank(machine, 1, 0, 2, &RAM[0x0000], 0xc000);
|
| 263 | | timer_pulse(machine, ATTOTIME_IN_HZ(200000),NULL,0,super80_timer); /* timer for keyboard and cassette */
|
| 264 | | }
|
| 265 | | |
| 266 | | DRIVER_INIT( super80 )
|
| 267 | | {
|
| 268 | | timer_pulse(machine, ATTOTIME_IN_HZ(100),NULL,0,super80_halfspeed); /* timer for 1MHz slowdown */
|
| 269 | | driver_init_common(machine);
|
| 270 | | }
|
| 271 | | |
| 272 | | DRIVER_INIT( super80v )
|
| 273 | | {
|
| 274 | | pcgram = memory_region(machine, "maincpu")+0xf000;
|
| 275 | | videoram = memory_region(machine, "maincpu")+0x18000;
|
| 276 | | colorram = memory_region(machine, "maincpu")+0x1C000;
|
| 277 | | driver_init_common(machine);
|
| 278 | | }
|
| 279 | | |
| 1 | /* Super80.c written by Robbbert, 2005-2009. See the MESS wiki for documentation. */ |
| 2 | |
| 3 | #include "driver.h" |
| 4 | //#include "cpu/z80/z80.h" |
| 5 | #include "sound/wave.h" |
| 6 | #include "devices/cassette.h" |
| 7 | #include "sound/speaker.h" |
| 8 | #include "machine/ctronics.h" |
| 9 | #include "super80.h" |
| 10 | |
| 11 | /* Bits in shared variable: |
| 12 | d5 cassette LED |
| 13 | d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom) |
| 14 | d2 super80v video or colour bankswitch (1=video ram, 0=colour ram) |
| 15 | d2 super80 screen off (=2mhz) or on (bursts of 2mhz at 50hz = 1mhz) */ |
| 16 | |
| 17 | UINT8 super80_shared=0xff; |
| 18 | |
| 19 | static const device_config *super80_z80pio; |
| 20 | static const device_config *super80_speaker; |
| 21 | static const device_config *super80_cassette; |
| 22 | static const device_config *super80_printer; |
| 23 | |
| 24 | /**************************** PIO ******************************************************************************/ |
| 25 | |
| 26 | static UINT8 keylatch; |
| 27 | |
| 28 | /* This activates when Control + C + 4 pressed */ |
| 29 | static void super80_pio_interrupt(const device_config *device, int state) |
| 30 | { |
| 31 | cputag_set_input_line(device->machine, "maincpu", 0, state ); |
| 32 | } |
| 33 | |
| 34 | static WRITE8_DEVICE_HANDLER( pio_port_a_w ) |
| 35 | { |
| 36 | keylatch = data; |
| 37 | }; |
| 38 | |
| 39 | static READ8_DEVICE_HANDLER( pio_port_b_r ) |
| 40 | { |
| 41 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; |
| 42 | |
| 43 | int bit; |
| 44 | UINT8 data = 0xff; |
| 45 | |
| 46 | for (bit = 0; bit < 8; bit++) |
| 47 | { |
| 48 | if (!BIT(keylatch, bit)) data &= input_port_read(device->machine, keynames[bit]); |
| 49 | } |
| 50 | |
| 51 | return data; |
| 52 | }; |
| 53 | |
| 54 | const z80pio_interface super80_pio_intf = |
| 55 | { |
| 56 | DEVCB_LINE(super80_pio_interrupt), /* callback when change interrupt status */ |
| 57 | DEVCB_NULL, |
| 58 | DEVCB_HANDLER(pio_port_b_r), |
| 59 | DEVCB_HANDLER(pio_port_a_w), |
| 60 | DEVCB_NULL, |
| 61 | DEVCB_NULL, /* portA ready active callback (not used in super80) */ |
| 62 | DEVCB_NULL /* portB ready active callback (not used in super80) */ |
| 63 | }; |
| 64 | |
| 65 | |
| 66 | /**************************** CASSETTE ROUTINES *****************************************************************/ |
| 67 | |
| 68 | static void super80_cassette_motor( running_machine *machine, UINT8 data ) |
| 69 | { |
| 70 | if (data) |
| 71 | cassette_change_state(super80_cassette, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 72 | else |
| 73 | cassette_change_state(super80_cassette, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 74 | |
| 75 | /* does user want to hear the sound? */ |
| 76 | if (input_port_read(machine, "CONFIG") & 8) |
| 77 | cassette_change_state(super80_cassette, CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER); |
| 78 | else |
| 79 | cassette_change_state(super80_cassette, CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); |
| 80 | } |
| 81 | |
| 82 | /********************************************* TIMER ************************************************/ |
| 83 | |
| 84 | static UINT8 cass_data[]={ 0, 0, 0, 0 }; |
| 85 | |
| 86 | /* this timer runs at 200khz and does 2 jobs: |
| 87 | 1. Scan the keyboard and present the results to the pio |
| 88 | 2. Emulate the 2 chips in the cassette input circuit |
| 89 | |
| 90 | Reasons why it is necessary: |
| 91 | 1. The real z80pio is driven by the cpu clock and is capable of independent actions. |
| 92 | MAME does not support this at all. If the interrupt key sequence is entered, the |
| 93 | computer can be reset out of a hung state by the operator. |
| 94 | 2. This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, |
| 95 | and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint. |
| 96 | |
| 97 | The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop. |
| 98 | My "read-any-system" cassette circuit was a CA3140 op-amp, the smarts being done in software. |
| 99 | |
| 100 | bit 0 = original system (U79 and U1) |
| 101 | bit 1 = MDS fast system |
| 102 | bit 2 = CA3140 */ |
| 103 | |
| 104 | static TIMER_CALLBACK( super80_timer ) |
| 105 | { |
| 106 | UINT8 cass_ws=0; |
| 107 | |
| 108 | cass_data[1]++; |
| 109 | cass_ws = (cassette_input(super80_cassette) > +0.03) ? 4 : 0; |
| 110 | |
| 111 | if (cass_ws != cass_data[0]) |
| 112 | { |
| 113 | if (cass_ws) cass_data[3] ^= 2; // the MDS flipflop |
| 114 | cass_data[0] = cass_ws; |
| 115 | cass_data[2] = ((cass_data[1] < 0x40) ? 1 : 0) | cass_ws | cass_data[3]; |
| 116 | cass_data[1] = 0; |
| 117 | } |
| 118 | |
| 119 | z80pio_p_w(super80_z80pio,1,pio_port_b_r(super80_z80pio,0)); |
| 120 | } |
| 121 | |
| 122 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
| 123 | static TIMER_CALLBACK( super80_reset ) |
| 124 | { |
| 125 | memory_set_bank(machine, 1, 0); |
| 126 | } |
| 127 | |
| 128 | static TIMER_CALLBACK( super80_halfspeed ) |
| 129 | { |
| 130 | static UINT8 int_sw=0; |
| 131 | UINT8 go_fast = 0; |
| 132 | if (!(super80_shared & 4) || (!(input_port_read(machine, "CONFIG") & 2))) /* bit 2 of port F0 is low, OR user turned on config switch */ |
| 133 | go_fast++; |
| 134 | |
| 135 | /* code to slow down computer to 1 MHz by halting cpu on every second frame */ |
| 136 | if (!go_fast) |
| 137 | { |
| 138 | if (!int_sw) |
| 139 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it |
| 140 | |
| 141 | int_sw++; |
| 142 | if (int_sw > 1) |
| 143 | { |
| 144 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it |
| 145 | int_sw = 0; |
| 146 | } |
| 147 | } |
| 148 | else |
| 149 | { |
| 150 | if (int_sw < 8) // @2MHz, reset just once |
| 151 | { |
| 152 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); |
| 153 | int_sw = 8; // ...not every time |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /*************************************** PRINTER ********************************************************/ |
| 159 | |
| 160 | /* The Super80 had an optional I/O card that plugged into the S-100 slot. The card had facility for running |
| 161 | an 8-bit Centronics printer, and a serial device at 300, 600, or 1200 baud. The I/O address range |
| 162 | was selectable via 4 dipswitches. The serial parameters (baud rate, parity, stop bits, etc) was |
| 163 | chosen with more dipswitches. Regretably, no parameters could be set by software. Currently, the |
| 164 | Centronics printer is emulated; the serial side of things may be done later, as will the dipswitches. |
| 165 | |
| 166 | The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control |
| 167 | All the home-brew roms use this, except for super80e which uses BC-BE (which we don't support yet). */ |
| 168 | |
| 169 | /**************************** I/O PORTS *****************************************************************/ |
| 170 | |
| 171 | READ8_HANDLER( super80_dc_r ) |
| 172 | { |
| 173 | UINT8 data=0x7f; |
| 174 | |
| 175 | /* bit 7 = printer busy |
| 176 | 0 = printer is not busy */ |
| 177 | |
| 178 | data |= centronics_busy_r(super80_printer) << 7; |
| 179 | |
| 180 | return data; |
| 181 | } |
| 182 | |
| 183 | READ8_HANDLER( super80_f2_r ) |
| 184 | { |
| 185 | UINT8 data = input_port_read(space->machine, "DSW") & 0xf0; // dip switches on pcb |
| 186 | data |= cass_data[2]; // bit 0 = output of U1, bit 1 = MDS cass state, bit 2 = current wave_state |
| 187 | data |= 0x08; // bit 3 - not used |
| 188 | return data; |
| 189 | } |
| 190 | |
| 191 | WRITE8_HANDLER( super80_dc_w ) |
| 192 | { |
| 193 | /* hardware strobe driven from port select, bit 7..0 = data */ |
| 194 | centronics_strobe_w(super80_printer, 1); |
| 195 | centronics_data_w(super80_printer, 0, data); |
| 196 | centronics_strobe_w(super80_printer, 0); |
| 197 | } |
| 198 | |
| 199 | static UINT8 last_data; |
| 200 | |
| 201 | WRITE8_HANDLER( super80_f0_w ) |
| 202 | { |
| 203 | UINT8 bits = data ^ last_data; |
| 204 | super80_shared = data; |
| 205 | speaker_level_w(super80_speaker, (data & 8) ? 0 : 1); /* bit 3 - speaker */ |
| 206 | if (bits & 2) super80_cassette_motor(space->machine, data & 2 ? 1 : 0); /* bit 1 - cassette motor */ |
| 207 | cassette_output(super80_cassette, (data & 1) ? -1.0 : +1.0); /* bit 0 - cass out */ |
| 208 | |
| 209 | last_data = data; |
| 210 | } |
| 211 | |
| 212 | WRITE8_HANDLER( super80r_f0_w ) |
| 213 | { |
| 214 | super80_f0_w(space, 0, data); |
| 215 | super80_shared |= 0x14; |
| 216 | } |
| 217 | |
| 218 | READ8_DEVICE_HANDLER( super80_pio_r ) |
| 219 | { |
| 220 | if (!offset) |
| 221 | return z80pio_d_r(device, 0); |
| 222 | else |
| 223 | if (offset == 1) |
| 224 | return z80pio_c_r(device, 0); |
| 225 | else |
| 226 | if (offset == 2) |
| 227 | return z80pio_d_r(device, 1); |
| 228 | else |
| 229 | return z80pio_c_r(device, 1); |
| 230 | } |
| 231 | |
| 232 | WRITE8_DEVICE_HANDLER( super80_pio_w ) |
| 233 | { |
| 234 | if (!offset) |
| 235 | z80pio_d_w(device, 0, data); |
| 236 | else |
| 237 | if (offset == 1) |
| 238 | z80pio_c_w(device, 0, data); |
| 239 | else |
| 240 | if (offset == 2) |
| 241 | z80pio_d_w(device, 1, data); |
| 242 | else |
| 243 | z80pio_c_w(device, 1, data); |
| 244 | } |
| 245 | |
| 246 | /**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ |
| 247 | |
| 248 | MACHINE_RESET( super80 ) |
| 249 | { |
| 250 | super80_shared=0xff; |
| 251 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, super80_reset); |
| 252 | memory_set_bank(machine, 1, 1); |
| 253 | super80_z80pio = devtag_get_device(machine, "z80pio"); |
| 254 | super80_speaker = devtag_get_device(machine, "speaker"); |
| 255 | super80_cassette = devtag_get_device(machine, "cassette"); |
| 256 | super80_printer = devtag_get_device(machine, "centronics"); |
| 257 | } |
| 258 | |
| 259 | static void driver_init_common( running_machine *machine ) |
| 260 | { |
| 261 | UINT8 *RAM = memory_region(machine, "maincpu"); |
| 262 | memory_configure_bank(machine, 1, 0, 2, &RAM[0x0000], 0xc000); |
| 263 | timer_pulse(machine, ATTOTIME_IN_HZ(200000),NULL,0,super80_timer); /* timer for keyboard and cassette */ |
| 264 | } |
| 265 | |
| 266 | DRIVER_INIT( super80 ) |
| 267 | { |
| 268 | timer_pulse(machine, ATTOTIME_IN_HZ(100),NULL,0,super80_halfspeed); /* timer for 1MHz slowdown */ |
| 269 | driver_init_common(machine); |
| 270 | } |
| 271 | |
| 272 | DRIVER_INIT( super80v ) |
| 273 | { |
| 274 | pcgram = memory_region(machine, "maincpu")+0xf000; |
| 275 | videoram = memory_region(machine, "maincpu")+0x18000; |
| 276 | colorram = memory_region(machine, "maincpu")+0x1C000; |
| 277 | driver_init_common(machine); |
| 278 | } |
| 279 | |
src/mess/drivers/beehive.c
| r4965 | r4966 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | BEEHIVE DM3270
|
| 4 | | |
| 5 | | 25/05/2009 Skeleton driver [Robbbert]
|
| 6 | | |
| 7 | | This is a conventional computer terminal using a serial link.
|
| 8 | | |
| 9 | | ****************************************************************************/
|
| 10 | | |
| 11 | | #include "driver.h"
|
| 12 | | #include "cpu/i8085/i8085.h"
|
| 13 | | |
| 14 | | static ADDRESS_MAP_START(beehive_mem, ADDRESS_SPACE_PROGRAM, 8)
|
| 15 | | ADDRESS_MAP_UNMAP_HIGH
|
| 16 | | AM_RANGE( 0x0000, 0x17ff ) AM_ROM
|
| 17 | | AM_RANGE( 0x1800, 0xffff ) AM_RAM
|
| 18 | | ADDRESS_MAP_END
|
| 19 | | |
| 20 | | static ADDRESS_MAP_START( beehive_io , ADDRESS_SPACE_IO, 8)
|
| 21 | | ADDRESS_MAP_UNMAP_HIGH
|
| 22 | | ADDRESS_MAP_END
|
| 23 | | |
| 24 | | /* Input ports */
|
| 25 | | static INPUT_PORTS_START( beehive )
|
| 26 | | INPUT_PORTS_END
|
| 27 | | |
| 28 | | |
| 29 | | static MACHINE_RESET(beehive)
|
| 30 | | {
|
| 31 | | }
|
| 32 | | |
| 33 | | static VIDEO_START( beehive )
|
| 34 | | {
|
| 35 | | }
|
| 36 | | |
| 37 | | static VIDEO_UPDATE( beehive )
|
| 38 | | {
|
| 39 | | return 0;
|
| 40 | | }
|
| 41 | | |
| 42 | | static MACHINE_DRIVER_START( beehive )
|
| 43 | | /* basic machine hardware */
|
| 44 | | MDRV_CPU_ADD("maincpu",8085A, XTAL_4MHz)
|
| 45 | | MDRV_CPU_PROGRAM_MAP(beehive_mem)
|
| 46 | | MDRV_CPU_IO_MAP(beehive_io)
|
| 47 | | |
| 48 | | MDRV_MACHINE_RESET(beehive)
|
| 49 | | |
| 50 | | /* video hardware */
|
| 51 | | MDRV_SCREEN_ADD("screen", RASTER)
|
| 52 | | MDRV_SCREEN_REFRESH_RATE(50)
|
| 53 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 54 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 55 | | MDRV_SCREEN_SIZE(640, 480)
|
| 56 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
|
| 57 | | MDRV_PALETTE_LENGTH(2)
|
| 58 | | MDRV_PALETTE_INIT(black_and_white)
|
| 59 | | |
| 60 | | MDRV_VIDEO_START(beehive)
|
| 61 | | MDRV_VIDEO_UPDATE(beehive)
|
| 62 | | MACHINE_DRIVER_END
|
| 63 | | |
| 64 | | static SYSTEM_CONFIG_START(beehive)
|
| 65 | | SYSTEM_CONFIG_END
|
| 66 | | |
| 67 | | /* ROM definition */
|
| 68 | | ROM_START( beehive )
|
| 69 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
|
| 70 | | ROM_LOAD( "dm3270-1.rom", 0x0000, 0x0800, CRC(781bde32) SHA1(a3fe25baadd2bfc2b1791f509bb0f4960281ee32) )
|
| 71 | | ROM_LOAD( "dm3270-2.rom", 0x0800, 0x0800, CRC(4d3476b7) SHA1(627ad42029ca6c8574cda8134d047d20515baf53) )
|
| 72 | | ROM_LOAD( "dm3270-3.rom", 0x1000, 0x0800, CRC(dbf15833) SHA1(ae93117260a259236c50885c5cecead2aad9b3c4) )
|
| 73 | | |
| 74 | | /* character generator not dumped */
|
| 75 | | ROM_END
|
| 76 | | |
| 77 | | /* Driver */
|
| 78 | | |
| 79 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */
|
| 80 | | COMP( ????, beehive, 0, 0, beehive, beehive, 0, beehive, "BeeHive", "DM3270", GAME_NOT_WORKING)
|
| 81 | | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | BEEHIVE DM3270 |
| 4 | |
| 5 | 25/05/2009 Skeleton driver [Robbbert] |
| 6 | |
| 7 | This is a conventional computer terminal using a serial link. |
| 8 | |
| 9 | ****************************************************************************/ |
| 10 | |
| 11 | #include "driver.h" |
| 12 | #include "cpu/i8085/i8085.h" |
| 13 | |
| 14 | static ADDRESS_MAP_START(beehive_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 15 | ADDRESS_MAP_UNMAP_HIGH |
| 16 | AM_RANGE( 0x0000, 0x17ff ) AM_ROM |
| 17 | AM_RANGE( 0x1800, 0xffff ) AM_RAM |
| 18 | ADDRESS_MAP_END |
| 19 | |
| 20 | static ADDRESS_MAP_START( beehive_io , ADDRESS_SPACE_IO, 8) |
| 21 | ADDRESS_MAP_UNMAP_HIGH |
| 22 | ADDRESS_MAP_END |
| 23 | |
| 24 | /* Input ports */ |
| 25 | static INPUT_PORTS_START( beehive ) |
| 26 | INPUT_PORTS_END |
| 27 | |
| 28 | |
| 29 | static MACHINE_RESET(beehive) |
| 30 | { |
| 31 | } |
| 32 | |
| 33 | static VIDEO_START( beehive ) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | static VIDEO_UPDATE( beehive ) |
| 38 | { |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | static MACHINE_DRIVER_START( beehive ) |
| 43 | /* basic machine hardware */ |
| 44 | MDRV_CPU_ADD("maincpu",8085A, XTAL_4MHz) |
| 45 | MDRV_CPU_PROGRAM_MAP(beehive_mem) |
| 46 | MDRV_CPU_IO_MAP(beehive_io) |
| 47 | |
| 48 | MDRV_MACHINE_RESET(beehive) |
| 49 | |
| 50 | /* video hardware */ |
| 51 | MDRV_SCREEN_ADD("screen", RASTER) |
| 52 | MDRV_SCREEN_REFRESH_RATE(50) |
| 53 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 54 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 55 | MDRV_SCREEN_SIZE(640, 480) |
| 56 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 57 | MDRV_PALETTE_LENGTH(2) |
| 58 | MDRV_PALETTE_INIT(black_and_white) |
| 59 | |
| 60 | MDRV_VIDEO_START(beehive) |
| 61 | MDRV_VIDEO_UPDATE(beehive) |
| 62 | MACHINE_DRIVER_END |
| 63 | |
| 64 | static SYSTEM_CONFIG_START(beehive) |
| 65 | SYSTEM_CONFIG_END |
| 66 | |
| 67 | /* ROM definition */ |
| 68 | ROM_START( beehive ) |
| 69 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 70 | ROM_LOAD( "dm3270-1.rom", 0x0000, 0x0800, CRC(781bde32) SHA1(a3fe25baadd2bfc2b1791f509bb0f4960281ee32) ) |
| 71 | ROM_LOAD( "dm3270-2.rom", 0x0800, 0x0800, CRC(4d3476b7) SHA1(627ad42029ca6c8574cda8134d047d20515baf53) ) |
| 72 | ROM_LOAD( "dm3270-3.rom", 0x1000, 0x0800, CRC(dbf15833) SHA1(ae93117260a259236c50885c5cecead2aad9b3c4) ) |
| 73 | |
| 74 | /* character generator not dumped */ |
| 75 | ROM_END |
| 76 | |
| 77 | /* Driver */ |
| 78 | |
| 79 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 80 | COMP( ????, beehive, 0, 0, beehive, beehive, 0, beehive, "BeeHive", "DM3270", GAME_NOT_WORKING) |
| 81 | |
src/mess/drivers/univac.c
| r4965 | r4966 | |
| 1 | | /***************************************************************************
|
| 2 | | |
| 3 | | Univac Terminals
|
| 4 | | |
| 5 | | The terminals are models UTS20, UTS30, UTS40, UTS50 and SVT1120,
|
| 6 | | however only the UTS20 is dumped (program roms only).
|
| 7 | | |
| 8 | | 25/05/2009 Skeleton driver [Robbbert].
|
| 9 | | |
| 10 | | ****************************************************************************/
|
| 11 | | |
| 12 | | #include "driver.h"
|
| 13 | | #include "cpu/z80/z80.h"
|
| 14 | | |
| 15 | | static ADDRESS_MAP_START(uts20_mem, ADDRESS_SPACE_PROGRAM, 8)
|
| 16 | | ADDRESS_MAP_UNMAP_HIGH
|
| 17 | | AM_RANGE( 0x0000, 0x4fff ) AM_ROM
|
| 18 | | AM_RANGE( 0x5000, 0xffff ) AM_RAM
|
| 19 | | ADDRESS_MAP_END
|
| 20 | | |
| 21 | | static ADDRESS_MAP_START( uts20_io , ADDRESS_SPACE_IO, 8)
|
| 22 | | ADDRESS_MAP_UNMAP_HIGH
|
| 23 | | ADDRESS_MAP_END
|
| 24 | | |
| 25 | | /* Input ports */
|
| 26 | | static INPUT_PORTS_START( uts20 )
|
| 27 | | INPUT_PORTS_END
|
| 28 | | |
| 29 | | |
| 30 | | static MACHINE_RESET(uts20)
|
| 31 | | {
|
| 32 | | }
|
| 33 | | |
| 34 | | static VIDEO_START( uts20 )
|
| 35 | | {
|
| 36 | | }
|
| 37 | | |
| 38 | | static VIDEO_UPDATE( uts20 )
|
| 39 | | {
|
| 40 | | return 0;
|
| 41 | | }
|
| 42 | | |
| 43 | | static MACHINE_DRIVER_START( uts20 )
|
| 44 | | /* basic machine hardware */
|
| 45 | | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
|
| 46 | | MDRV_CPU_PROGRAM_MAP(uts20_mem)
|
| 47 | | MDRV_CPU_IO_MAP(uts20_io)
|
| 48 | | |
| 49 | | MDRV_MACHINE_RESET(uts20)
|
| 50 | | |
| 51 | | /* video hardware */
|
| 52 | | MDRV_SCREEN_ADD("screen", RASTER)
|
| 53 | | MDRV_SCREEN_REFRESH_RATE(50)
|
| 54 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
| 55 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 56 | | MDRV_SCREEN_SIZE(640, 480)
|
| 57 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
|
| 58 | | MDRV_PALETTE_LENGTH(2)
|
| 59 | | MDRV_PALETTE_INIT(black_and_white)
|
| 60 | | |
| 61 | | MDRV_VIDEO_START(uts20)
|
| 62 | | MDRV_VIDEO_UPDATE(uts20)
|
| 63 | | MACHINE_DRIVER_END
|
| 64 | | |
| 65 | | static SYSTEM_CONFIG_START(uts20)
|
| 66 | | SYSTEM_CONFIG_END
|
| 67 | | |
| 68 | | /* ROM definition */
|
| 69 | | ROM_START( uts20 )
|
| 70 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
|
| 71 | | ROM_LOAD( "uts20a.rom", 0x0000, 0x1000, CRC(1a7b4b4e) SHA1(c3732e25b4b7c7a80172e3fe55c77b923cf511eb) )
|
| 72 | | ROM_LOAD( "uts20b.rom", 0x1000, 0x1000, CRC(7f8de87b) SHA1(a85f404ad9d560df831cc3e651a4b45e4ed30130) )
|
| 73 | | ROM_LOAD( "uts20c.rom", 0x2000, 0x1000, CRC(4e334705) SHA1(ff1a730551b42f29d20af8ecc4495fd30567d35b) )
|
| 74 | | ROM_LOAD( "uts20d.rom", 0x3000, 0x1000, CRC(76757cf7) SHA1(b0509d9a35366b21955f83ec3685163844c4dbf1) )
|
| 75 | | ROM_LOAD( "uts20e.rom", 0x4000, 0x1000, CRC(0dfc8062) SHA1(cd681020bfb4829d4cebaf1b5bf618e67b55bda3) )
|
| 76 | | |
| 77 | | /* Character generator rom not dumped */
|
| 78 | | ROM_END
|
| 79 | | |
| 80 | | /* Driver */
|
| 81 | | |
| 82 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */
|
| 83 | | COMP( ????, uts20, 0, 0, uts20, uts20, 0, uts20, "Sperry Univac", "UTS-20", GAME_NOT_WORKING)
|
| 84 | | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Univac Terminals |
| 4 | |
| 5 | The terminals are models UTS20, UTS30, UTS40, UTS50 and SVT1120, |
| 6 | however only the UTS20 is dumped (program roms only). |
| 7 | |
| 8 | 25/05/2009 Skeleton driver [Robbbert]. |
| 9 | |
| 10 | ****************************************************************************/ |
| 11 | |
| 12 | #include "driver.h" |
| 13 | #include "cpu/z80/z80.h" |
| 14 | |
| 15 | static ADDRESS_MAP_START(uts20_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 16 | ADDRESS_MAP_UNMAP_HIGH |
| 17 | AM_RANGE( 0x0000, 0x4fff ) AM_ROM |
| 18 | AM_RANGE( 0x5000, 0xffff ) AM_RAM |
| 19 | ADDRESS_MAP_END |
| 20 | |
| 21 | static ADDRESS_MAP_START( uts20_io , ADDRESS_SPACE_IO, 8) |
| 22 | ADDRESS_MAP_UNMAP_HIGH |
| 23 | ADDRESS_MAP_END |
| 24 | |
| 25 | /* Input ports */ |
| 26 | static INPUT_PORTS_START( uts20 ) |
| 27 | INPUT_PORTS_END |
| 28 | |
| 29 | |
| 30 | static MACHINE_RESET(uts20) |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | static VIDEO_START( uts20 ) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | static VIDEO_UPDATE( uts20 ) |
| 39 | { |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | static MACHINE_DRIVER_START( uts20 ) |
| 44 | /* basic machine hardware */ |
| 45 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 46 | MDRV_CPU_PROGRAM_MAP(uts20_mem) |
| 47 | MDRV_CPU_IO_MAP(uts20_io) |
| 48 | |
| 49 | MDRV_MACHINE_RESET(uts20) |
| 50 | |
| 51 | /* video hardware */ |
| 52 | MDRV_SCREEN_ADD("screen", RASTER) |
| 53 | MDRV_SCREEN_REFRESH_RATE(50) |
| 54 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 55 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 56 | MDRV_SCREEN_SIZE(640, 480) |
| 57 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 58 | MDRV_PALETTE_LENGTH(2) |
| 59 | MDRV_PALETTE_INIT(black_and_white) |
| 60 | |
| 61 | MDRV_VIDEO_START(uts20) |
| 62 | MDRV_VIDEO_UPDATE(uts20) |
| 63 | MACHINE_DRIVER_END |
| 64 | |
| 65 | static SYSTEM_CONFIG_START(uts20) |
| 66 | SYSTEM_CONFIG_END |
| 67 | |
| 68 | /* ROM definition */ |
| 69 | ROM_START( uts20 ) |
| 70 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 71 | ROM_LOAD( "uts20a.rom", 0x0000, 0x1000, CRC(1a7b4b4e) SHA1(c3732e25b4b7c7a80172e3fe55c77b923cf511eb) ) |
| 72 | ROM_LOAD( "uts20b.rom", 0x1000, 0x1000, CRC(7f8de87b) SHA1(a85f404ad9d560df831cc3e651a4b45e4ed30130) ) |
| 73 | ROM_LOAD( "uts20c.rom", 0x2000, 0x1000, CRC(4e334705) SHA1(ff1a730551b42f29d20af8ecc4495fd30567d35b) ) |
| 74 | ROM_LOAD( "uts20d.rom", 0x3000, 0x1000, CRC(76757cf7) SHA1(b0509d9a35366b21955f83ec3685163844c4dbf1) ) |
| 75 | ROM_LOAD( "uts20e.rom", 0x4000, 0x1000, CRC(0dfc8062) SHA1(cd681020bfb4829d4cebaf1b5bf618e67b55bda3) ) |
| 76 | |
| 77 | /* Character generator rom not dumped */ |
| 78 | ROM_END |
| 79 | |
| 80 | /* Driver */ |
| 81 | |
| 82 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 83 | COMP( ????, uts20, 0, 0, uts20, uts20, 0, uts20, "Sperry Univac", "UTS-20", GAME_NOT_WORKING) |
| 84 | |