src/mess/machine/atom.c
| r7880 | r7881 | |
| 1 | | /*********************************************************************** |
| 2 | | |
| 3 | | atom.c |
| 4 | | |
| 5 | | Functions to emulate general aspects of the machine (RAM, ROM, |
| 6 | | interrupts, I/O ports) |
| 7 | | |
| 8 | | Many thanks to Kees van Oss for: |
| 9 | | 1. Tape input/output circuit diagram. It describes in great detail how the 2.4 kHz |
| 10 | | tone, 2.4 kHz tone enable, tape output and tape input are connected. |
| 11 | | 2. The DOS rom for the Atom so I could complete the floppy disc emulation. |
| 12 | | 3. Details of the eprom expansion board for the Atom. |
| 13 | | 4. His demo programs which I used to test the driver. |
| 14 | | |
| 15 | | ***********************************************************************/ |
| 16 | | |
| 17 | | |
| 18 | | #include "emu.h" |
| 19 | | #include "machine/i8255a.h" |
| 20 | | #include "video/m6847.h" |
| 21 | | #include "machine/ctronics.h" |
| 22 | | #include "machine/i8271.h" |
| 23 | | #include "machine/6522via.h" |
| 24 | | #include "devices/flopdrv.h" |
| 25 | | #include "devices/cassette.h" |
| 26 | | #include "includes/atom.h" |
| 27 | | #include "sound/speaker.h" |
| 28 | | |
| 29 | | |
| 30 | | UINT8 atom_8255_porta; |
| 31 | | static UINT8 atom_8255_portb; |
| 32 | | UINT8 atom_8255_portc; |
| 33 | | |
| 34 | | |
| 35 | | /* I am not sure if this is correct, the atom appears to have a 2.4 kHz timer used for reading tapes?? */ |
| 36 | | static int timer_state = 0; |
| 37 | | |
| 38 | | static running_device *cassette_device_image(running_machine *machine) |
| 39 | | { |
| 40 | | return devtag_get_device(machine, "cassette"); |
| 41 | | } |
| 42 | | |
| 43 | | |
| 44 | | |
| 45 | | /*************************************************************************** |
| 46 | | PRINTER INTERFACE |
| 47 | | ***************************************************************************/ |
| 48 | | |
| 49 | | /* BUSY from the centronics interface is connected to PA7 of the via */ |
| 50 | | static READ8_DEVICE_HANDLER( atom_printer_busy ) |
| 51 | | { |
| 52 | | return centronics_busy_r(device) << 7; |
| 53 | | } |
| 54 | | |
| 55 | | /* DATA lines 0 to 6 are connected to PA0 to PA6 of the via */ |
| 56 | | static WRITE8_DEVICE_HANDLER( atom_printer_data ) |
| 57 | | { |
| 58 | | centronics_data_w(device, 0, data & 0x7f); |
| 59 | | } |
| 60 | | |
| 61 | | const via6522_interface atom_6522_interface = |
| 62 | | { |
| 63 | | DEVCB_DEVICE_HANDLER("centronics", atom_printer_busy), |
| 64 | | DEVCB_NULL, |
| 65 | | DEVCB_NULL, |
| 66 | | DEVCB_NULL, |
| 67 | | DEVCB_NULL, |
| 68 | | DEVCB_NULL, |
| 69 | | DEVCB_DEVICE_HANDLER("centronics", atom_printer_data), |
| 70 | | DEVCB_NULL, |
| 71 | | DEVCB_NULL, |
| 72 | | DEVCB_NULL, |
| 73 | | /* the CA2 output is connected to the STROBE signal on the centronics */ |
| 74 | | DEVCB_DEVICE_LINE("centronics", centronics_strobe_w), |
| 75 | | DEVCB_NULL, |
| 76 | | DEVCB_CPU_INPUT_LINE("maincpu", 0) |
| 77 | | }; |
| 78 | | |
| 79 | | |
| 80 | | |
| 81 | | I8255A_INTERFACE( atom_8255_int ) |
| 82 | | { |
| 83 | | DEVCB_HANDLER(atom_8255_porta_r), |
| 84 | | DEVCB_HANDLER(atom_8255_portb_r), |
| 85 | | DEVCB_HANDLER(atom_8255_portc_r), |
| 86 | | DEVCB_HANDLER(atom_8255_porta_w), |
| 87 | | DEVCB_HANDLER(atom_8255_portb_w), |
| 88 | | DEVCB_DEVICE_HANDLER("speaker", atom_8255_portc_w), |
| 89 | | }; |
| 90 | | |
| 91 | | static int previous_i8271_int_state = 0; |
| 92 | | |
| 93 | | static void atom_8271_interrupt_callback(running_device *device, int state) |
| 94 | | { |
| 95 | | /* I'm assuming that the nmi is edge triggered */ |
| 96 | | /* a interrupt from the fdc will cause a change in line state, and |
| 97 | | the nmi will be triggered, but when the state changes because the int |
| 98 | | is cleared this will not cause another nmi */ |
| 99 | | /* I'll emulate it like this to be sure */ |
| 100 | | |
| 101 | | if (state!=previous_i8271_int_state) |
| 102 | | { |
| 103 | | if (state) |
| 104 | | { |
| 105 | | /* I'll pulse it because if I used hold-line I'm not sure |
| 106 | | it would clear - to be checked */ |
| 107 | | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 108 | | } |
| 109 | | } |
| 110 | | |
| 111 | | previous_i8271_int_state = state; |
| 112 | | } |
| 113 | | |
| 114 | | const i8271_interface atom_8271_interface= |
| 115 | | { |
| 116 | | atom_8271_interrupt_callback, |
| 117 | | NULL, |
| 118 | | {FLOPPY_0, FLOPPY_1} |
| 119 | | }; |
| 120 | | |
| 121 | | /* |
| 122 | | +--------+ |
| 123 | | PC0, Tape Output ------------------------------------------------| |
| 124 | | | |
| 125 | | +---------| | NAND |------CAS OUT |
| 126 | | PC1, Enable 2400 Hz ------------------------------| | | | |
| 127 | | +------+ | NAND |--B--| | |
| 128 | | PC4, 2400 Hz ---------------+-----| INV | ---A---| | +--------+ |
| 129 | | | +------+ +---------+ |
| 130 | | | |
| 131 | | 2400 Hz |
| 132 | | |
| 133 | | |
| 134 | | PC4 PC1 PC0 : A B CAS OUT |
| 135 | | 0 0 0 : 1 1 1 |
| 136 | | 0 0 1 : 1 1 0 |
| 137 | | 0 1 0 : 1 0 1 |
| 138 | | 0 1 1 : 1 0 1 |
| 139 | | 1 0 0 : 0 1 1 |
| 140 | | 1 0 1 : 0 1 0 |
| 141 | | 1 1 0 : 0 1 1 |
| 142 | | 1 1 1 : 0 1 0 |
| 143 | | |
| 144 | | |
| 145 | | Here is a detail from the Atom circuit diagram about Tape Input: |
| 146 | | |
| 147 | | PC5, Cassette |
| 148 | | Input ----------------------------------------------------------------CAS IN |
| 149 | | */ |
| 150 | | static TIMER_CALLBACK(atom_timer_callback) |
| 151 | | { |
| 152 | | /* change timer state */ |
| 153 | | timer_state^=1; |
| 154 | | |
| 155 | | /* the 2.4 kHz signal is notted (A), and nand'ed with the 2.4kz enable, resulting |
| 156 | | in B. The final cassette output is the result of tape output nand'ed with B */ |
| 157 | | |
| 158 | | |
| 159 | | { |
| 160 | | unsigned char A; |
| 161 | | unsigned char B; |
| 162 | | unsigned char result; |
| 163 | | |
| 164 | | /* 2.4 kHz signal - notted */ |
| 165 | | A = (~timer_state); |
| 166 | | /* 2.4 kHz signal notted, and anded with 2.4 kHz enable */ |
| 167 | | B = (~(A & (atom_8255_portc>>1))) & 0x01; |
| 168 | | |
| 169 | | result = (~(B & atom_8255_portc)) & 0x01; |
| 170 | | |
| 171 | | /* tape output */ |
| 172 | | cassette_output(cassette_device_image(machine), (result & 0x01) ? -1.0 : +1.0); |
| 173 | | } |
| 174 | | } |
| 175 | | |
| 176 | | MACHINE_START( atom ) |
| 177 | | { |
| 178 | | atom_8255_porta = 0xff; |
| 179 | | atom_8255_portb = 0xff; |
| 180 | | atom_8255_portc = 0xff; |
| 181 | | |
| 182 | | timer_state = 0; |
| 183 | | timer_pulse(machine, ATTOTIME_IN_HZ(2400*2), NULL, 0, atom_timer_callback); |
| 184 | | |
| 185 | | /* this is temporary */ |
| 186 | | /* Kees van Oss mentions that address 8-b are used for the random number |
| 187 | | generator. I don't know if this is hardware, or random data because the |
| 188 | | ram chips are not cleared at start-up. So at this time, these numbers |
| 189 | | are poked into the memory to simulate it. When I have more details I will fix it */ |
| 190 | | memory_region(machine, "maincpu")[0x08] = mame_rand(machine) & 0x0ff; |
| 191 | | memory_region(machine, "maincpu")[0x09] = mame_rand(machine) & 0x0ff; |
| 192 | | memory_region(machine, "maincpu")[0x0a] = mame_rand(machine) & 0x0ff; |
| 193 | | memory_region(machine, "maincpu")[0x0b] = mame_rand(machine) & 0x0ff; |
| 194 | | } |
| 195 | | |
| 196 | | READ8_DEVICE_HANDLER (atom_8255_porta_r ) |
| 197 | | { |
| 198 | | /* logerror("8255: Read port a\n"); */ |
| 199 | | return (atom_8255_porta); |
| 200 | | } |
| 201 | | |
| 202 | | READ8_DEVICE_HANDLER ( atom_8255_portb_r ) |
| 203 | | { |
| 204 | | int row; |
| 205 | | static const char *const keynames[] = { |
| 206 | | "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", |
| 207 | | "KEY6", "KEY7", "KEY8", "KEY9", "KEY10", "KEY11" |
| 208 | | }; |
| 209 | | |
| 210 | | row = atom_8255_porta & 0x0f; |
| 211 | | /* logerror("8255: Read port b: %02X %02X\n", input_port_read(machine, port), |
| 212 | | input_port_read(machine, "KEY10") & 0xc0); */ |
| 213 | | return ((input_port_read(device->machine, keynames[row]) & 0x3f) | (input_port_read(device->machine, "KEY10") & 0xc0)); |
| 214 | | } |
| 215 | | |
| 216 | | READ8_DEVICE_HANDLER ( atom_8255_portc_r ) |
| 217 | | { |
| 218 | | running_device *mc6847 = devtag_get_device(device->machine, "mc6847"); |
| 219 | | |
| 220 | | atom_8255_portc &= 0x0f; |
| 221 | | |
| 222 | | /* cassette input */ |
| 223 | | if (cassette_input(cassette_device_image(device->machine)) > 0.0) |
| 224 | | { |
| 225 | | atom_8255_portc |= (1<<5); |
| 226 | | } |
| 227 | | |
| 228 | | /* 2.4 kHz input */ |
| 229 | | if (timer_state) |
| 230 | | { |
| 231 | | atom_8255_portc |= (1<<4); |
| 232 | | } |
| 233 | | |
| 234 | | atom_8255_portc |= (input_port_read(device->machine, "KEY11") & 0x40); |
| 235 | | atom_8255_portc |= mc6847_fs_r(mc6847) << 7; |
| 236 | | /* logerror("8255: Read port c (%02X)\n",atom_8255.atom_8255_portc); */ |
| 237 | | return (atom_8255_portc); |
| 238 | | } |
| 239 | | |
| 240 | | /* Atom 6847 modes: |
| 241 | | |
| 242 | | 0000xxxx Text |
| 243 | | 0001xxxx 64x64 4 |
| 244 | | 0011xxxx 128x64 2 |
| 245 | | 0101xxxx 128x64 4 |
| 246 | | 0111xxxx 128x96 2 |
| 247 | | 1001xxxx 128x96 4 |
| 248 | | 1011xxxx 128x192 2 |
| 249 | | 1101xxxx 128x192 4 |
| 250 | | 1111xxxx 256x192 2 |
| 251 | | |
| 252 | | */ |
| 253 | | |
| 254 | | WRITE8_DEVICE_HANDLER( atom_8255_porta_w ) |
| 255 | | { |
| 256 | | running_device *mc6847 = devtag_get_device(device->machine, "mc6847"); |
| 257 | | |
| 258 | | mc6847_ag_w(mc6847, BIT(data, 4)); |
| 259 | | mc6847_gm0_w(mc6847, BIT(data, 5)); |
| 260 | | mc6847_gm1_w(mc6847, BIT(data, 6)); |
| 261 | | mc6847_gm2_w(mc6847, BIT(data, 7)); |
| 262 | | |
| 263 | | atom_8255_porta = data; |
| 264 | | } |
| 265 | | |
| 266 | | WRITE8_DEVICE_HANDLER ( atom_8255_portb_w ) |
| 267 | | { |
| 268 | | atom_8255_portb = data; |
| 269 | | } |
| 270 | | |
| 271 | | WRITE8_DEVICE_HANDLER(atom_8255_portc_w) |
| 272 | | { |
| 273 | | running_device *mc6847 = devtag_get_device(device->machine, "mc6847"); |
| 274 | | |
| 275 | | speaker_level_w(device, BIT(data, 2)); |
| 276 | | mc6847_css_w(mc6847, BIT(data, 3)); |
| 277 | | |
| 278 | | atom_8255_portc = data; |
| 279 | | } |
| 280 | | |
| 281 | | |
| 282 | | /*********************************************/ |
| 283 | | /* emulates a 16-slot eprom box for the Atom */ |
| 284 | | static unsigned char selected_eprom = 0; |
| 285 | | |
| 286 | | static void atom_eprom_box_refresh(running_machine *machine) |
| 287 | | { |
| 288 | | unsigned char *eprom_data; |
| 289 | | |
| 290 | | /* get address of eprom data */ |
| 291 | | eprom_data = memory_region(machine, "maincpu") + 0x010000 + (selected_eprom<<12); |
| 292 | | /* set bank address */ |
| 293 | | memory_set_bankptr(machine, "bank1", eprom_data); |
| 294 | | } |
| 295 | | |
| 296 | | void atom_eprom_box_init(running_machine *machine) |
| 297 | | { |
| 298 | | /* set initial eprom */ |
| 299 | | selected_eprom = 0; |
| 300 | | /* set memory handler */ |
| 301 | | /* init */ |
| 302 | | atom_eprom_box_refresh(machine); |
| 303 | | } |
| 304 | | |
| 305 | | /* write to eprom box, changes eprom selected */ |
| 306 | | WRITE8_HANDLER(atom_eprom_box_w) |
| 307 | | { |
| 308 | | selected_eprom = data & 0x0f; |
| 309 | | |
| 310 | | atom_eprom_box_refresh(space->machine); |
| 311 | | } |
| 312 | | |
| 313 | | /* read from eprom box register, can this be done in the real hardware */ |
| 314 | | READ8_HANDLER(atom_eprom_box_r) |
| 315 | | { |
| 316 | | return selected_eprom; |
| 317 | | } |
| 318 | | |
| 319 | | MACHINE_START( atomeb ) |
| 320 | | { |
| 321 | | MACHINE_START_CALL(atom); |
| 322 | | atom_eprom_box_init(machine); |
| 323 | | } |
| 324 | | |
| 325 | | |
| 326 | | /*************************************************************************** |
| 327 | | MC6847 VDP |
| 328 | | ***************************************************************************/ |
| 329 | | |
| 330 | | READ8_DEVICE_HANDLER( atom_mc6847_videoram_r ) |
| 331 | | { |
| 332 | | mc6847_as_w(device, BIT(device->machine->generic.videoram.u8[offset], 6)); |
| 333 | | mc6847_intext_w(device, BIT(device->machine->generic.videoram.u8[offset], 6)); |
| 334 | | mc6847_inv_w(device, BIT(device->machine->generic.videoram.u8[offset], 7)); |
| 335 | | |
| 336 | | return device->machine->generic.videoram.u8[offset]; |
| 337 | | } |
| 338 | | |
| 339 | | VIDEO_UPDATE( atom ) |
| 340 | | { |
| 341 | | running_device *mc6847 = devtag_get_device(screen->machine, "mc6847"); |
| 342 | | return mc6847_update(mc6847, bitmap, cliprect); |
| 343 | | } |
src/mess/drivers/atom.c
| r7880 | r7881 | |
| 54 | 54 | The atom driver in MESS uses the original memory area. |
| 55 | 55 | |
| 56 | 56 | |
| 57 | http://www.xs4all.nl/~fjkraan/comp/atom/index.html |
| 57 | 58 | |
| 58 | 59 | ***************************************************************************/ |
| 59 | 60 | |
| 60 | | /* Core includes */ |
| 61 | /* |
| 62 | |
| 63 | TODO: |
| 64 | |
| 65 | - ERROR repeats ad infinitum |
| 66 | - break key |
| 67 | - ram expansion |
| 68 | - tap files |
| 69 | - mouse |
| 70 | - move eprom box roms to software list |
| 71 | - add 16 cartslots for eprom box |
| 72 | |
| 73 | */ |
| 74 | |
| 61 | 75 | #include "emu.h" |
| 76 | #include "includes/atom.h" |
| 62 | 77 | #include "cpu/m6502/m6502.h" |
| 63 | | |
| 64 | | /* Components */ |
| 65 | | #include "machine/ctronics.h" |
| 66 | | #include "machine/i8271.h" |
| 67 | | #include "machine/i8255a.h" |
| 68 | | #include "machine/6522via.h" |
| 69 | | #include "video/m6847.h" |
| 70 | | |
| 71 | | /* Devices */ |
| 78 | #include "devices/cassette.h" |
| 72 | 79 | #include "devices/flopdrv.h" |
| 80 | #include "devices/messram.h" |
| 81 | #include "devices/snapquik.h" |
| 73 | 82 | #include "formats/atom_atm.h" |
| 74 | 83 | #include "formats/atom_tap.h" |
| 75 | 84 | #include "formats/basicdsk.h" |
| 76 | | #include "devices/cassette.h" |
| 77 | | #include "devices/snapquik.h" |
| 85 | #include "formats/uef_cas.h" |
| 86 | #include "machine/ctronics.h" |
| 87 | #include "machine/6522via.h" |
| 88 | #include "machine/i8255a.h" |
| 89 | #include "machine/i8271.h" |
| 78 | 90 | #include "sound/speaker.h" |
| 91 | #include "video/m6847.h" |
| 79 | 92 | |
| 80 | | #include "includes/atom.h" |
| 93 | /*************************************************************************** |
| 94 | READ/WRITE HANDLERS |
| 95 | ***************************************************************************/ |
| 81 | 96 | |
| 97 | /*------------------------------------------------- |
| 98 | bankswitch - EPROM bankswitch |
| 99 | -------------------------------------------------*/ |
| 82 | 100 | |
| 83 | | /* functions */ |
| 101 | static void bankswitch(running_machine *machine) |
| 102 | { |
| 103 | atom_state *state = (atom_state *)machine->driver_data; |
| 104 | const address_space *program = cputag_get_address_space(machine, SY6502_TAG, ADDRESS_SPACE_PROGRAM); |
| 84 | 105 | |
| 85 | | /* port i/o functions */ |
| 106 | UINT8 *eprom = memory_region(machine, "eprom") + (state->eprom << 12); |
| 86 | 107 | |
| 87 | | /* memory w/r functions */ |
| 108 | memory_install_rom(program, 0xa000, 0xafff, 0, 0, eprom); |
| 109 | } |
| 88 | 110 | |
| 111 | /*------------------------------------------------- |
| 112 | eprom_r - EPROM slot select read |
| 113 | -------------------------------------------------*/ |
| 114 | |
| 115 | static READ8_HANDLER( eprom_r ) |
| 116 | { |
| 117 | atom_state *state = (atom_state *)space->machine->driver_data; |
| 118 | |
| 119 | return state->eprom; |
| 120 | } |
| 121 | |
| 122 | /*------------------------------------------------- |
| 123 | eprom_w - EPROM slot select write |
| 124 | -------------------------------------------------*/ |
| 125 | |
| 126 | static WRITE8_HANDLER( eprom_w ) |
| 127 | { |
| 128 | atom_state *state = (atom_state *)space->machine->driver_data; |
| 129 | |
| 130 | state->eprom = data & 0x0f; |
| 131 | |
| 132 | bankswitch(space->machine); |
| 133 | } |
| 134 | |
| 135 | /*************************************************************************** |
| 136 | MEMORY MAPS |
| 137 | ***************************************************************************/ |
| 138 | |
| 139 | /*------------------------------------------------- |
| 140 | ADDRESS_MAP( atom_mem ) |
| 141 | -------------------------------------------------*/ |
| 142 | |
| 89 | 143 | static ADDRESS_MAP_START( atom_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 90 | 144 | AM_RANGE(0x0000, 0x09ff) AM_RAM |
| 91 | | AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("i8271", i8271_r, i8271_w) |
| 92 | | AM_RANGE(0x0a04, 0x0a04) AM_DEVREADWRITE("i8271", i8271_data_r, i8271_data_w) |
| 145 | AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE(I8271_TAG, i8271_r, i8271_w) |
| 146 | AM_RANGE(0x0a04, 0x0a04) AM_DEVREADWRITE(I8271_TAG, i8271_data_r, i8271_data_w) |
| 93 | 147 | AM_RANGE(0x0a05, 0x7fff) AM_RAM |
| 94 | | AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE_GENERIC(videoram) /* VDG 6847 */ |
| 148 | AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE_MEMBER(atom_state, video_ram) |
| 95 | 149 | AM_RANGE(0x9800, 0x9fff) AM_RAM |
| 96 | | AM_RANGE(0xb000, 0xb003) AM_DEVREADWRITE("ppi8255", i8255a_r, i8255a_w) |
| 97 | | AM_RANGE(0xb800, 0xbbff) AM_DEVREADWRITE("via6522_0", via_r, via_w) |
| 98 | | AM_RANGE(0xc000, 0xcfff) AM_ROM |
| 99 | | AM_RANGE(0xd000, 0xdfff) AM_ROM |
| 100 | | AM_RANGE(0xe000, 0xefff) AM_ROM |
| 101 | | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 150 | AM_RANGE(0xb000, 0xb003) AM_DEVREADWRITE(INS8255_TAG, i8255a_r, i8255a_w) |
| 151 | AM_RANGE(0xb800, 0xbbff) AM_DEVREADWRITE(R6522_TAG, via_r, via_w) |
| 152 | AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0) |
| 102 | 153 | ADDRESS_MAP_END |
| 103 | 154 | |
| 155 | /*------------------------------------------------- |
| 156 | ADDRESS_MAP( atomeb_mem ) |
| 157 | -------------------------------------------------*/ |
| 104 | 158 | |
| 105 | 159 | static ADDRESS_MAP_START( atomeb_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 106 | | AM_RANGE(0x0000, 0x09ff) AM_RAM |
| 107 | | AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("i8271", i8271_r, i8271_w) |
| 108 | | AM_RANGE(0x0a04, 0x0a04) AM_DEVREADWRITE("i8271", i8271_data_r, i8271_data_w) |
| 109 | | AM_RANGE(0x0a05, 0x7fff) AM_RAM |
| 110 | | AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE_SIZE_GENERIC(videoram) /* VDG 6847 */ |
| 111 | | AM_RANGE(0x9800, 0x9fff) AM_RAM |
| 112 | | AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bank1") /* eprom data from eprom box */ |
| 113 | | AM_RANGE(0xb000, 0xb003) AM_DEVREADWRITE("ppi8255", i8255a_r, i8255a_w) |
| 114 | | AM_RANGE(0xb800, 0xbbff) AM_DEVREADWRITE("via6522_0", via_r, via_w) |
| 115 | | AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(atom_eprom_box_r, atom_eprom_box_w) |
| 116 | | AM_RANGE(0xc000, 0xcfff) AM_ROM |
| 117 | | AM_RANGE(0xd000, 0xdfff) AM_ROM |
| 118 | | AM_RANGE(0xe000, 0xefff) AM_ROM |
| 119 | | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 160 | AM_IMPORT_FROM(atom_mem) |
| 161 | AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(eprom_r, eprom_w) |
| 120 | 162 | ADDRESS_MAP_END |
| 121 | 163 | |
| 164 | /*************************************************************************** |
| 165 | INPUT PORTS |
| 166 | ***************************************************************************/ |
| 122 | 167 | |
| 123 | | /* graphics output */ |
| 168 | /*------------------------------------------------- |
| 169 | INPUT_CHANGED( trigger_nmi ) |
| 170 | -------------------------------------------------*/ |
| 124 | 171 | |
| 125 | | /* keyboard input */ |
| 172 | static INPUT_CHANGED( trigger_nmi ) |
| 173 | { |
| 174 | cputag_set_input_line(field->port->machine, SY6502_TAG, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); |
| 175 | } |
| 126 | 176 | |
| 127 | | /* Not implemented: BREAK */ |
| 177 | /*------------------------------------------------- |
| 178 | INPUT_PORTS( atom ) |
| 179 | -------------------------------------------------*/ |
| 128 | 180 | |
| 129 | 181 | static INPUT_PORTS_START( atom ) |
| 130 | 182 | PORT_START("KEY0") |
| 131 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 132 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 133 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') |
| 134 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 135 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 136 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) |
| 137 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 138 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 183 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 184 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 185 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') |
| 186 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 187 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 188 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) |
| 189 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 190 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 139 | 191 | |
| 140 | 192 | PORT_START("KEY1") |
| 141 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 142 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') |
| 143 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 144 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 145 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 146 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 147 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 148 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 193 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 194 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') |
| 195 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 196 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 197 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 198 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 199 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 200 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 149 | 201 | |
| 150 | 202 | PORT_START("KEY2") |
| 151 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x87\x95") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 152 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 153 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 154 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 155 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 156 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 157 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 158 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 203 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x95") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 204 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 205 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 206 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 207 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 208 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 209 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 210 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 159 | 211 | |
| 160 | 212 | PORT_START("KEY3") |
| 161 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x87\x94") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 162 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 163 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') |
| 164 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 165 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 166 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 167 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 168 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 213 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x94") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 214 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 215 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') |
| 216 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 217 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 218 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 219 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 220 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 169 | 221 | |
| 170 | 222 | PORT_START("KEY4") |
| 171 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE |
| 172 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) |
| 173 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 174 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 175 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 176 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 177 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 178 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 223 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE |
| 224 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) |
| 225 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 226 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 227 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 228 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 229 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 230 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 179 | 231 | |
| 180 | 232 | PORT_START("KEY5") |
| 181 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('^') |
| 182 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 183 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 184 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 185 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 186 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 187 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 188 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 233 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('^') |
| 234 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 235 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 236 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 237 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 238 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 239 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 240 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 189 | 241 | |
| 190 | 242 | PORT_START("KEY6") |
| 191 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 192 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 193 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 194 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 195 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 196 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 197 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 198 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 243 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 244 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RTN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 245 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 246 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 247 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 248 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 249 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 250 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 199 | 251 | |
| 200 | 252 | PORT_START("KEY7") |
| 201 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') |
| 202 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 203 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 204 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 205 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 206 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 207 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 208 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 253 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') |
| 254 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 255 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 256 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 257 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 258 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 259 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 260 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 209 | 261 | |
| 210 | 262 | PORT_START("KEY8") |
| 211 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') |
| 212 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 213 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 214 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 215 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 216 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 217 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 218 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 263 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') |
| 264 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 265 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 266 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 267 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 268 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 269 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 270 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 219 | 271 | |
| 220 | 272 | PORT_START("KEY9") |
| 221 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) |
| 222 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 223 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 224 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 225 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 226 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 227 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 228 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 273 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) |
| 274 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 275 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 276 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 277 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 278 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 279 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 280 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 229 | 281 | |
| 230 | | PORT_START("KEY10") /* CTRL & SHIFT */ |
| 231 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 232 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 233 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| 234 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) |
| 235 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) |
| 236 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) |
| 237 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 238 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 282 | PORT_START("KEY10") |
| 283 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 284 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 285 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 286 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 287 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 288 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 289 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 290 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 239 | 291 | |
| 240 | | PORT_START("KEY11") /* REPT key */ |
| 241 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 242 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 243 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| 244 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) |
| 245 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) |
| 246 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) |
| 247 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rept") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) |
| 248 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 292 | PORT_START("RPT") |
| 293 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPT") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) |
| 294 | |
| 295 | PORT_START("BRK") |
| 296 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BRK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED(trigger_nmi, 0) |
| 249 | 297 | INPUT_PORTS_END |
| 250 | 298 | |
| 299 | /*************************************************************************** |
| 300 | VIDEO |
| 301 | ***************************************************************************/ |
| 251 | 302 | |
| 252 | | /* centronics interface */ |
| 303 | /*------------------------------------------------- |
| 304 | VIDEO_UPDATE( atom ) |
| 305 | -------------------------------------------------*/ |
| 306 | |
| 307 | static VIDEO_UPDATE( atom ) |
| 308 | { |
| 309 | atom_state *state = (atom_state *)screen->machine->driver_data; |
| 310 | |
| 311 | return mc6847_update(state->mc6847, bitmap, cliprect); |
| 312 | } |
| 313 | |
| 314 | /*************************************************************************** |
| 315 | DEVICE CONFIGURATION |
| 316 | ***************************************************************************/ |
| 317 | |
| 318 | /*------------------------------------------------- |
| 319 | I8255A_INTERFACE( ppi_intf ) |
| 320 | -------------------------------------------------*/ |
| 321 | |
| 322 | static WRITE8_DEVICE_HANDLER( ppi_pa_w ) |
| 323 | { |
| 324 | /* |
| 325 | |
| 326 | bit description |
| 327 | |
| 328 | 0 keyboard column 0 |
| 329 | 1 keyboard column 1 |
| 330 | 2 keyboard column 2 |
| 331 | 3 keyboard column 3 |
| 332 | 4 MC6847 A/G |
| 333 | 5 MC6847 GM0 |
| 334 | 6 MC6847 GM1 |
| 335 | 7 MC6847 GM2 |
| 336 | |
| 337 | */ |
| 338 | |
| 339 | atom_state *state = (atom_state *)device->machine->driver_data; |
| 340 | |
| 341 | /* keyboard column */ |
| 342 | state->keylatch = data & 0x0f; |
| 343 | |
| 344 | /* MC6847 */ |
| 345 | mc6847_ag_w(state->mc6847, BIT(data, 4)); |
| 346 | mc6847_gm0_w(state->mc6847, BIT(data, 5)); |
| 347 | mc6847_gm1_w(state->mc6847, BIT(data, 6)); |
| 348 | mc6847_gm2_w(state->mc6847, BIT(data, 7)); |
| 349 | } |
| 350 | |
| 351 | static READ8_DEVICE_HANDLER( ppi_pb_r ) |
| 352 | { |
| 353 | /* |
| 354 | |
| 355 | bit description |
| 356 | |
| 357 | 0 keyboard row 0 |
| 358 | 1 keyboard row 1 |
| 359 | 2 keyboard row 2 |
| 360 | 3 keyboard row 3 |
| 361 | 4 keyboard row 4 |
| 362 | 5 keyboard row 5 |
| 363 | 6 keyboard CTRL |
| 364 | 7 keyboard SFT |
| 365 | |
| 366 | */ |
| 367 | |
| 368 | atom_state *state = (atom_state *)device->machine->driver_data; |
| 369 | UINT8 data = 0xff; |
| 370 | |
| 371 | switch (state->keylatch) |
| 372 | { |
| 373 | case 0: data &= input_port_read(device->machine, "KEY0"); break; |
| 374 | case 1: data &= input_port_read(device->machine, "KEY1"); break; |
| 375 | case 2: data &= input_port_read(device->machine, "KEY2"); break; |
| 376 | case 3: data &= input_port_read(device->machine, "KEY3"); break; |
| 377 | case 4: data &= input_port_read(device->machine, "KEY4"); break; |
| 378 | case 5: data &= input_port_read(device->machine, "KEY5"); break; |
| 379 | case 6: data &= input_port_read(device->machine, "KEY6"); break; |
| 380 | case 7: data &= input_port_read(device->machine, "KEY7"); break; |
| 381 | case 8: data &= input_port_read(device->machine, "KEY8"); break; |
| 382 | case 9: data &= input_port_read(device->machine, "KEY9"); break; |
| 383 | } |
| 384 | |
| 385 | data &= input_port_read(device->machine, "KEY10"); |
| 386 | |
| 387 | return data; |
| 388 | } |
| 389 | |
| 390 | static READ8_DEVICE_HANDLER( ppi_pc_r ) |
| 391 | { |
| 392 | /* |
| 393 | |
| 394 | bit description |
| 395 | |
| 396 | 0 O/P 1, cassette output 0 |
| 397 | 1 O/P 2, cassette output 1 |
| 398 | 2 O/P 3, speaker output |
| 399 | 3 O/P 4, MC6847 CSS |
| 400 | 4 2400 Hz input |
| 401 | 5 cassette input |
| 402 | 6 keyboard RPT |
| 403 | 7 MC6847 FS |
| 404 | |
| 405 | */ |
| 406 | |
| 407 | atom_state *state = (atom_state *)device->machine->driver_data; |
| 408 | |
| 409 | UINT8 data = 0; |
| 410 | |
| 411 | /* 2400 Hz input */ |
| 412 | data |= state->hz2400 << 4; |
| 413 | |
| 414 | /* cassette input */ |
| 415 | logerror("cassin %f\n", cassette_input(state->cassette)); |
| 416 | data |= (cassette_input(state->cassette) > 0.0) << 5; |
| 417 | |
| 418 | /* keyboard RPT */ |
| 419 | data |= BIT(input_port_read(device->machine, "RPT"), 0) << 6; |
| 420 | |
| 421 | /* MC6847 FS */ |
| 422 | data |= mc6847_fs_r(state->mc6847) << 7; |
| 423 | |
| 424 | return data; |
| 425 | } |
| 426 | |
| 427 | static WRITE8_DEVICE_HANDLER( ppi_pc_w ) |
| 428 | { |
| 429 | /* |
| 430 | |
| 431 | bit description |
| 432 | |
| 433 | 0 O/P 1, cassette output 0 |
| 434 | 1 O/P 2, cassette output 1 |
| 435 | 2 O/P 3, speaker output |
| 436 | 3 O/P 4, MC6847 CSS |
| 437 | 4 2400 Hz input |
| 438 | 5 cassette input |
| 439 | 6 keyboard RPT |
| 440 | 7 MC6847 FS |
| 441 | |
| 442 | */ |
| 443 | |
| 444 | atom_state *state = (atom_state *)device->machine->driver_data; |
| 445 | |
| 446 | /* cassette output */ |
| 447 | state->pc0 = BIT(data, 0); |
| 448 | state->pc1 = BIT(data, 1); |
| 449 | |
| 450 | /* speaker output */ |
| 451 | speaker_level_w(device, BIT(data, 2)); |
| 452 | |
| 453 | /* MC6847 CSS */ |
| 454 | mc6847_css_w(state->mc6847, BIT(data, 3)); |
| 455 | } |
| 456 | |
| 457 | static I8255A_INTERFACE( ppi_intf ) |
| 458 | { |
| 459 | DEVCB_NULL, |
| 460 | DEVCB_HANDLER(ppi_pb_r), |
| 461 | DEVCB_HANDLER(ppi_pc_r), |
| 462 | DEVCB_HANDLER(ppi_pa_w), |
| 463 | DEVCB_NULL, |
| 464 | DEVCB_DEVICE_HANDLER(SPEAKER_TAG, ppi_pc_w) |
| 465 | }; |
| 466 | |
| 467 | /*------------------------------------------------- |
| 468 | via6522_interface via_intf |
| 469 | -------------------------------------------------*/ |
| 470 | |
| 471 | static READ8_DEVICE_HANDLER( atom_printer_busy ) |
| 472 | { |
| 473 | return centronics_busy_r(device) << 7; |
| 474 | } |
| 475 | |
| 476 | static WRITE8_DEVICE_HANDLER( atom_printer_data ) |
| 477 | { |
| 478 | centronics_data_w(device, 0, data & 0x7f); |
| 479 | } |
| 480 | |
| 481 | static const via6522_interface via_intf = |
| 482 | { |
| 483 | DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, atom_printer_busy), |
| 484 | DEVCB_NULL, |
| 485 | DEVCB_NULL, |
| 486 | DEVCB_NULL, |
| 487 | DEVCB_NULL, |
| 488 | DEVCB_NULL, |
| 489 | DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, atom_printer_data), |
| 490 | DEVCB_NULL, |
| 491 | DEVCB_NULL, |
| 492 | DEVCB_NULL, |
| 493 | DEVCB_DEVICE_LINE(CENTRONICS_TAG, centronics_strobe_w), |
| 494 | DEVCB_NULL, |
| 495 | DEVCB_CPU_INPUT_LINE(SY6502_TAG, INPUT_LINE_IRQ0) |
| 496 | }; |
| 497 | |
| 498 | /*------------------------------------------------- |
| 499 | i8271_interface fdc_intf |
| 500 | -------------------------------------------------*/ |
| 501 | |
| 502 | static int previous_i8271_int_state = 0; |
| 503 | |
| 504 | static void atom_8271_interrupt_callback(running_device *device, int state) |
| 505 | { |
| 506 | /* I'm assuming that the nmi is edge triggered */ |
| 507 | /* a interrupt from the fdc will cause a change in line state, and |
| 508 | the nmi will be triggered, but when the state changes because the int |
| 509 | is cleared this will not cause another nmi */ |
| 510 | /* I'll emulate it like this to be sure */ |
| 511 | |
| 512 | if (state!=previous_i8271_int_state) |
| 513 | { |
| 514 | if (state) |
| 515 | { |
| 516 | /* I'll pulse it because if I used hold-line I'm not sure |
| 517 | it would clear - to be checked */ |
| 518 | cputag_set_input_line(device->machine, SY6502_TAG, INPUT_LINE_NMI, PULSE_LINE); |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | previous_i8271_int_state = state; |
| 523 | } |
| 524 | |
| 525 | static const i8271_interface fdc_intf = |
| 526 | { |
| 527 | atom_8271_interrupt_callback, |
| 528 | NULL, |
| 529 | {FLOPPY_0, FLOPPY_1} |
| 530 | }; |
| 531 | |
| 532 | /*------------------------------------------------- |
| 533 | centronics_interface atom_centronics_config |
| 534 | -------------------------------------------------*/ |
| 535 | |
| 253 | 536 | static const centronics_interface atom_centronics_config = |
| 254 | 537 | { |
| 255 | 538 | FALSE, |
| 256 | | DEVCB_DEVICE_LINE("via6522_0", via_ca1_w), |
| 539 | DEVCB_DEVICE_LINE(R6522_TAG, via_ca1_w), |
| 257 | 540 | DEVCB_NULL, |
| 258 | 541 | DEVCB_NULL |
| 259 | 542 | }; |
| 260 | 543 | |
| 261 | | static FLOPPY_OPTIONS_START(atom) |
| 544 | /*------------------------------------------------- |
| 545 | FLOPPY_OPTIONS( atom ) |
| 546 | -------------------------------------------------*/ |
| 547 | |
| 548 | static FLOPPY_OPTIONS_START( atom ) |
| 262 | 549 | FLOPPY_OPTION(atom, "dsk,40t", "Atom disk image", basicdsk_identify_default, basicdsk_construct_default, |
| 263 | 550 | HEADS([1]) |
| 264 | 551 | TRACKS([40]) |
| r7880 | r7881 | |
| 267 | 554 | FIRST_SECTOR_ID([0])) |
| 268 | 555 | FLOPPY_OPTIONS_END |
| 269 | 556 | |
| 557 | /*------------------------------------------------- |
| 558 | floppy_config atom_floppy_config |
| 559 | -------------------------------------------------*/ |
| 560 | |
| 270 | 561 | static const floppy_config atom_floppy_config = |
| 271 | 562 | { |
| 272 | 563 | DEVCB_NULL, |
| r7880 | r7881 | |
| 279 | 570 | DO_NOT_KEEP_GEOMETRY |
| 280 | 571 | }; |
| 281 | 572 | |
| 573 | /*------------------------------------------------- |
| 574 | cassette_config atom_cassette_config |
| 575 | -------------------------------------------------*/ |
| 576 | |
| 577 | static TIMER_DEVICE_CALLBACK( cassette_output_tick ) |
| 578 | { |
| 579 | atom_state *state = (atom_state *)timer->machine->driver_data; |
| 580 | |
| 581 | int level = !(!(!state->hz2400 & state->pc1) & state->pc0); |
| 582 | |
| 583 | cassette_output(state->cassette, level ? -1.0 : +1.0); |
| 584 | |
| 585 | state->hz2400 = !state->hz2400; |
| 586 | } |
| 587 | |
| 588 | static CASSETTE_FORMATLIST_START( atom_cassette_formats ) |
| 589 | CASSETTE_FORMAT(atom_tap_format) |
| 590 | CASSETTE_FORMAT(uef_cassette_format) |
| 591 | CASSETTE_FORMATLIST_END |
| 592 | |
| 282 | 593 | static const cassette_config atom_cassette_config = |
| 283 | 594 | { |
| 284 | 595 | atom_cassette_formats, |
| 285 | 596 | NULL, |
| 286 | | (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) |
| 597 | (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) |
| 287 | 598 | }; |
| 288 | 599 | |
| 600 | /*------------------------------------------------- |
| 601 | mc6847_interface atom_mc6847_intf |
| 602 | -------------------------------------------------*/ |
| 603 | |
| 604 | static READ8_DEVICE_HANDLER( atom_mc6847_videoram_r ) |
| 605 | { |
| 606 | atom_state *state = (atom_state *)device->machine->driver_data; |
| 607 | |
| 608 | mc6847_as_w(device, BIT(state->video_ram[offset], 6)); |
| 609 | mc6847_intext_w(device, BIT(state->video_ram[offset], 6)); |
| 610 | mc6847_inv_w(device, BIT(state->video_ram[offset], 7)); |
| 611 | |
| 612 | return state->video_ram[offset]; |
| 613 | } |
| 614 | |
| 289 | 615 | static const mc6847_interface atom_mc6847_intf = |
| 290 | 616 | { |
| 291 | 617 | DEVCB_HANDLER(atom_mc6847_videoram_r), |
| r7880 | r7881 | |
| 302 | 628 | DEVCB_NULL |
| 303 | 629 | }; |
| 304 | 630 | |
| 305 | | /* machine definition */ |
| 631 | /*************************************************************************** |
| 632 | MACHINE INITIALIZATION |
| 633 | ***************************************************************************/ |
| 634 | |
| 635 | /*------------------------------------------------- |
| 636 | MACHINE_START( atom ) |
| 637 | -------------------------------------------------*/ |
| 638 | |
| 639 | static MACHINE_START( atom ) |
| 640 | { |
| 641 | atom_state *state = (atom_state *)machine->driver_data; |
| 642 | |
| 643 | /* this is temporary */ |
| 644 | /* Kees van Oss mentions that address 8-b are used for the random number |
| 645 | generator. I don't know if this is hardware, or random data because the |
| 646 | ram chips are not cleared at start-up. So at this time, these numbers |
| 647 | are poked into the memory to simulate it. When I have more details I will fix it */ |
| 648 | memory_region(machine, SY6502_TAG)[0x08] = mame_rand(machine) & 0x0ff; |
| 649 | memory_region(machine, SY6502_TAG)[0x09] = mame_rand(machine) & 0x0ff; |
| 650 | memory_region(machine, SY6502_TAG)[0x0a] = mame_rand(machine) & 0x0ff; |
| 651 | memory_region(machine, SY6502_TAG)[0x0b] = mame_rand(machine) & 0x0ff; |
| 652 | |
| 653 | /* find devices */ |
| 654 | state->mc6847 = devtag_get_device(machine, MC6847_TAG); |
| 655 | state->cassette = devtag_get_device(machine, CASSETTE_TAG); |
| 656 | } |
| 657 | |
| 658 | /*------------------------------------------------- |
| 659 | MACHINE_START( atomeb ) |
| 660 | -------------------------------------------------*/ |
| 661 | |
| 662 | static MACHINE_START( atomeb ) |
| 663 | { |
| 664 | MACHINE_START_CALL(atom); |
| 665 | |
| 666 | bankswitch(machine); |
| 667 | } |
| 668 | |
| 669 | /*************************************************************************** |
| 670 | MACHINE DRIVERS |
| 671 | ***************************************************************************/ |
| 672 | |
| 673 | /*------------------------------------------------- |
| 674 | MACHINE_DRIVER( atom ) |
| 675 | -------------------------------------------------*/ |
| 676 | |
| 306 | 677 | static MACHINE_DRIVER_START( atom ) |
| 678 | MDRV_DRIVER_DATA(atom_state) |
| 679 | |
| 307 | 680 | /* basic machine hardware */ |
| 308 | | MDRV_CPU_ADD("maincpu", M65C02, X2 / 4) |
| 681 | MDRV_CPU_ADD(SY6502_TAG, M65C02, X2/4) |
| 309 | 682 | MDRV_CPU_PROGRAM_MAP(atom_mem) |
| 310 | 683 | |
| 311 | 684 | MDRV_MACHINE_START( atom ) |
| 312 | 685 | |
| 313 | | MDRV_I8255A_ADD( "ppi8255", atom_8255_int ) |
| 314 | | |
| 315 | 686 | /* video hardware */ |
| 316 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 687 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 317 | 688 | MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND) |
| 318 | | |
| 319 | | MDRV_VIDEO_UPDATE(atom) |
| 320 | 689 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 321 | 690 | MDRV_SCREEN_SIZE(320, 25+192+26) |
| 322 | 691 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239) |
| 323 | 692 | |
| 324 | | MDRV_MC6847_ADD("mc6847", atom_mc6847_intf) |
| 693 | MDRV_MC6847_ADD(MC6847_TAG, atom_mc6847_intf) |
| 325 | 694 | MDRV_MC6847_TYPE(M6847_VERSION_ORIGINAL_PAL) |
| 326 | 695 | |
| 696 | MDRV_VIDEO_UPDATE(atom) |
| 697 | |
| 327 | 698 | /* sound hardware */ |
| 328 | 699 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 329 | | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| 700 | MDRV_SOUND_ADD(SPEAKER_TAG, SPEAKER, 0) |
| 330 | 701 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 331 | 702 | |
| 332 | | /* printer */ |
| 333 | | MDRV_CENTRONICS_ADD("centronics", atom_centronics_config) |
| 334 | | |
| 335 | | /* quickload */ |
| 703 | /* devices */ |
| 704 | MDRV_TIMER_ADD_PERIODIC("hz2400", cassette_output_tick, HZ(X2/4/416)) |
| 705 | MDRV_VIA6522_ADD(R6522_TAG, X2/4, via_intf) |
| 706 | MDRV_I8255A_ADD(INS8255_TAG, ppi_intf) |
| 707 | MDRV_I8271_ADD(I8271_TAG, fdc_intf) |
| 708 | MDRV_FLOPPY_2_DRIVES_ADD(atom_floppy_config) |
| 709 | MDRV_CENTRONICS_ADD(CENTRONICS_TAG, atom_centronics_config) |
| 710 | MDRV_CASSETTE_ADD(CASSETTE_TAG, atom_cassette_config) |
| 336 | 711 | MDRV_QUICKLOAD_ADD("quickload", atom_atm, "atm", 0) |
| 337 | | |
| 338 | | /* cassette */ |
| 339 | | MDRV_CASSETTE_ADD( "cassette", atom_cassette_config ) |
| 340 | | |
| 341 | | /* via */ |
| 342 | | MDRV_VIA6522_ADD("via6522_0", X2 / 4, atom_6522_interface) |
| 343 | | |
| 344 | | /* i8271 */ |
| 345 | | MDRV_I8271_ADD("i8271", atom_8271_interface) |
| 346 | | |
| 347 | | MDRV_FLOPPY_2_DRIVES_ADD(atom_floppy_config) |
| 348 | 712 | MACHINE_DRIVER_END |
| 349 | 713 | |
| 714 | /*------------------------------------------------- |
| 715 | MACHINE_DRIVER( atomeb ) |
| 716 | -------------------------------------------------*/ |
| 350 | 717 | |
| 351 | 718 | static MACHINE_DRIVER_START( atomeb ) |
| 352 | | MDRV_IMPORT_FROM( atom ) |
| 353 | | MDRV_CPU_MODIFY( "maincpu" ) |
| 719 | MDRV_IMPORT_FROM(atom) |
| 720 | MDRV_CPU_MODIFY(SY6502_TAG) |
| 354 | 721 | MDRV_CPU_PROGRAM_MAP(atomeb_mem) |
| 355 | 722 | |
| 356 | | MDRV_MACHINE_START( atomeb ) |
| 723 | MDRV_MACHINE_START(atomeb) |
| 357 | 724 | MACHINE_DRIVER_END |
| 358 | 725 | |
| 726 | /*************************************************************************** |
| 727 | ROMS |
| 728 | ***************************************************************************/ |
| 359 | 729 | |
| 360 | | ROM_START (atom) |
| 361 | | ROM_REGION (0x10000, "maincpu",0) |
| 362 | | ROM_LOAD ("akernel.rom", 0xf000, 0x1000, CRC(c604db3d) SHA1(2621f27d652d4673e0a79aa669e729b8c3051ab6)) |
| 363 | | ROM_LOAD ("dosrom.rom", 0xe000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c)) |
| 364 | | ROM_LOAD ("afloat.rom", 0xd000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802)) |
| 365 | | ROM_LOAD ("abasic.rom", 0xc000, 0x1000, CRC(43798b9b) SHA1(a8ea19f10d4c98fbc1b666e5968f06d46af9a84c)) |
| 730 | /*------------------------------------------------- |
| 731 | ROM( atom ) |
| 732 | -------------------------------------------------*/ |
| 733 | |
| 734 | ROM_START( atom ) |
| 735 | ROM_REGION( 0x4000, SY6502_TAG, 0 ) |
| 736 | ROM_LOAD( "abasic.ic20", 0x0000, 0x1000, CRC(289b7791) SHA1(0072c83458a9690a3ea1f6094f0f38cf8e96a445) ) |
| 737 | ROM_CONTINUE( 0x3000, 0x1000 ) |
| 738 | ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) ) |
| 739 | ROM_LOAD( "dosrom.u15", 0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) ) |
| 366 | 740 | ROM_END |
| 367 | 741 | |
| 368 | | ROM_START (atomeb) |
| 369 | | ROM_REGION (0x10000+0x09000, "maincpu",0) |
| 370 | | ROM_LOAD ("akernel.rom", 0xf000, 0x1000, CRC(c604db3d) SHA1(2621f27d652d4673e0a79aa669e729b8c3051ab6)) |
| 371 | | ROM_LOAD ("dosrom.rom", 0xe000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c)) |
| 372 | | ROM_LOAD ("afloat.rom", 0xd000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802)) |
| 373 | | ROM_LOAD ("abasic.rom", 0xc000, 0x1000, CRC(43798b9b) SHA1(a8ea19f10d4c98fbc1b666e5968f06d46af9a84c)) |
| 374 | | /* roms from another oric emulator */ |
| 375 | | ROM_LOAD ("axr1.rom",0x010000,0x1000, CRC(868fda8b) SHA1(f8417787c28818a7646b9b59d706ef890255049f)) // Atom Externsion ROM AXR1 |
| 376 | | ROM_LOAD ("pcharme.rom",0x011000,0x1000, CRC(9e8bd79f) SHA1(66c57622448b448aa6080911dccb03456d0e3b81)) // P-Charme |
| 377 | | ROM_LOAD ("gags.rom",0x012000,0x1000, CRC(35e1d713) SHA1(94cc2887ad9fea1849d1d53c64d0668e77696ef4)) // GAGS |
| 378 | | ROM_LOAD ("werom.rom",0x013000,0x1000, CRC(dfcb3bf8) SHA1(85a19146844da2d6f03e1cde37ee17429eedeb0d)) // WE-ROM |
| 379 | | ROM_LOAD ("utilikit.rom",0x014000,0x1000, CRC(013b8f93) SHA1(b4341f116a6d1e0cbcd39d64e0b5d14a90dc0356)) // A&F Utility Kit |
| 380 | | ROM_LOAD ("combox.rom",0x015000,0x1000, CRC(9c8210ab) SHA1(ea293f49a98721cdbdf985d6f2fe636290ef0e75)) // ComBox |
| 381 | | ROM_LOAD ("salfaa.rom",0x016000,0x1000, CRC(ef857b25) SHA1(b3812427233060972fa01faf3ce381a21576a5ed)) // SALFAA |
| 382 | | ROM_LOAD ("mousebox.rom",0x017000,0x01000, CRC(0dff30e4) SHA1(b7c0b9c23fcc5cfdc06cb2d2a9e7c2658e248ef7)) // Mouse-Dos Box |
| 383 | | ROM_LOAD ("atomicw.rom",0x018000,0x1000, CRC(a3fd737d) SHA1(d418d9322c69c49106ed2c268ad0864c0f2c4c1b)) // Atomic Windows |
| 742 | /*------------------------------------------------- |
| 743 | ROM( atomeb ) |
| 744 | -------------------------------------------------*/ |
| 745 | |
| 746 | ROM_START( atomeb ) |
| 747 | ROM_REGION( 0x4000, SY6502_TAG, 0 ) |
| 748 | ROM_LOAD( "abasic.ic20", 0x0000, 0x1000, CRC(289b7791) SHA1(0072c83458a9690a3ea1f6094f0f38cf8e96a445) ) |
| 749 | ROM_CONTINUE( 0x3000, 0x1000 ) |
| 750 | ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) ) |
| 751 | ROM_LOAD( "dosrom.u15", 0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) ) |
| 752 | |
| 753 | ROM_REGION( 0x10000, "eprom", 0 ) |
| 754 | ROM_LOAD( "axr1.rom", 0x0000, 0x1000, CRC(868fda8b) SHA1(f8417787c28818a7646b9b59d706ef890255049f) ) // Atom Externsion ROM AXR1 |
| 755 | ROM_LOAD( "pcharme.rom", 0x1000, 0x1000, CRC(9e8bd79f) SHA1(66c57622448b448aa6080911dccb03456d0e3b81) ) // P-Charme |
| 756 | ROM_LOAD( "gags.rom", 0x2000, 0x1000, CRC(35e1d713) SHA1(94cc2887ad9fea1849d1d53c64d0668e77696ef4) ) // GAGS |
| 757 | ROM_LOAD( "werom.rom", 0x3000, 0x1000, CRC(dfcb3bf8) SHA1(85a19146844da2d6f03e1cde37ee17429eedeb0d) ) // WE-ROM |
| 758 | ROM_LOAD( "utilikit.rom", 0x4000, 0x1000, CRC(013b8f93) SHA1(b4341f116a6d1e0cbcd39d64e0b5d14a90dc0356) ) // A&F Utility Kit |
| 759 | ROM_LOAD( "combox.rom", 0x5000, 0x1000, CRC(9c8210ab) SHA1(ea293f49a98721cdbdf985d6f2fe636290ef0e75) ) // ComBox |
| 760 | ROM_LOAD( "salfaa.rom", 0x6000, 0x1000, CRC(ef857b25) SHA1(b3812427233060972fa01faf3ce381a21576a5ed) ) // SALFAA |
| 761 | ROM_LOAD( "mousebox.rom", 0x7000, 0x1000, CRC(0dff30e4) SHA1(b7c0b9c23fcc5cfdc06cb2d2a9e7c2658e248ef7) ) // Mouse-Dos Box |
| 762 | ROM_LOAD( "atomicw.rom", 0x8000, 0x1000, CRC(a3fd737d) SHA1(d418d9322c69c49106ed2c268ad0864c0f2c4c1b) ) // Atomic Windows |
| 384 | 763 | ROM_END |
| 385 | 764 | |
| 765 | /*************************************************************************** |
| 766 | SYSTEM DRIVERS |
| 767 | ***************************************************************************/ |
| 768 | |
| 386 | 769 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 387 | 770 | COMP( 1979, atom, 0, 0, atom, atom, 0, "Acorn", "Atom" , 0) |
| 388 | 771 | COMP( 1979, atomeb, atom, 0, atomeb, atom, 0, "Acorn", "Atom with Eprom Box" , 0) |