src/mess/machine/8530scc.c
| r2927 | r2928 | |
| 11 | 11 | #include "8530scc.h" |
| 12 | 12 | |
| 13 | 13 | |
| 14 | /*************************************************************************** |
| 15 | PARAMETERS |
| 16 | ***************************************************************************/ |
| 17 | |
| 14 | 18 | #define LOG_SCC 0 |
| 15 | 19 | |
| 16 | | static const struct scc8530_interface *scc_intf; |
| 17 | | static int scc_mode; |
| 18 | | static int scc_reg; |
| 19 | | static int scc_status; |
| 20 | 20 | |
| 21 | | static unsigned char scc_reg_val_a[16]; |
| 22 | | static unsigned char scc_reg_val_b[16]; |
| 23 | 21 | |
| 22 | /*************************************************************************** |
| 23 | TYPE DEFINITIONS |
| 24 | ***************************************************************************/ |
| 24 | 25 | |
| 25 | | void scc_init(const struct scc8530_interface *intf) |
| 26 | typedef struct _scc8530_t scc8530_t; |
| 27 | struct _scc8530_t |
| 26 | 28 | { |
| 27 | | scc_intf = intf; |
| 28 | | scc_mode = 0; |
| 29 | | scc_reg = 0; |
| 30 | | scc_status = 0; |
| 29 | int mode; |
| 30 | int reg; |
| 31 | int status; |
| 32 | |
| 33 | UINT8 reg_val_a[16]; |
| 34 | UINT8 reg_val_b[16]; |
| 35 | }; |
| 36 | |
| 37 | |
| 38 | |
| 39 | /*************************************************************************** |
| 40 | INLINE FUNCTIONS |
| 41 | ***************************************************************************/ |
| 42 | |
| 43 | INLINE scc8530_t *get_token(const device_config *device) |
| 44 | { |
| 45 | assert(device->type == SCC8530); |
| 46 | return (scc8530_t *) device->token; |
| 31 | 47 | } |
| 32 | 48 | |
| 33 | 49 | |
| 50 | INLINE scc8530_interface *get_interface(const device_config *device) |
| 51 | { |
| 52 | assert(device->type == SCC8530); |
| 53 | return (scc8530_interface *) device->static_config; |
| 54 | } |
| 34 | 55 | |
| 35 | | void scc_set_status(int status) |
| 56 | |
| 57 | /*************************************************************************** |
| 58 | IMPLEMENTATION |
| 59 | ***************************************************************************/ |
| 60 | |
| 61 | /*------------------------------------------------- |
| 62 | DEVICE_START( scc8530 ) |
| 63 | -------------------------------------------------*/ |
| 64 | |
| 65 | static DEVICE_START( scc8530 ) |
| 36 | 66 | { |
| 37 | | scc_status = status; |
| 67 | scc8530_t *scc = get_token(device); |
| 68 | memset(scc, 0, sizeof(*scc)); |
| 38 | 69 | } |
| 39 | 70 | |
| 40 | 71 | |
| 41 | 72 | |
| 42 | | static int scc_getareg(void) |
| 73 | /*------------------------------------------------- |
| 74 | scc_set_status |
| 75 | -------------------------------------------------*/ |
| 76 | |
| 77 | void scc_set_status(const device_config *device, int status) |
| 43 | 78 | { |
| 79 | scc8530_t *scc = get_token(device); |
| 80 | scc->status = status; |
| 81 | } |
| 82 | |
| 83 | |
| 84 | |
| 85 | /*------------------------------------------------- |
| 86 | scc_acknowledge |
| 87 | -------------------------------------------------*/ |
| 88 | |
| 89 | static void scc_acknowledge(const device_config *device) |
| 90 | { |
| 91 | scc8530_interface *intf = get_interface(device); |
| 92 | if ((intf != NULL) && (intf->acknowledge != NULL)) |
| 93 | (*intf->acknowledge)(device); |
| 94 | } |
| 95 | |
| 96 | |
| 97 | |
| 98 | /*------------------------------------------------- |
| 99 | scc_getareg |
| 100 | -------------------------------------------------*/ |
| 101 | |
| 102 | static int scc_getareg(const device_config *device) |
| 103 | { |
| 104 | scc8530_t *scc = get_token(device); |
| 105 | |
| 44 | 106 | /* Not yet implemented */ |
| 45 | | logerror("SCC: port A reg %i read 0x%02x\n",scc_reg,scc_reg_val_a[scc_reg]); |
| 46 | | return scc_reg_val_a[scc_reg]; |
| 107 | logerror("SCC: port A reg %i read 0x%02x\n", scc->reg, scc->reg_val_a[scc->reg]); |
| 108 | return scc->reg_val_a[scc->reg]; |
| 47 | 109 | } |
| 48 | 110 | |
| 49 | 111 | |
| 50 | 112 | |
| 51 | | static int scc_getbreg(void) |
| 113 | /*------------------------------------------------- |
| 114 | scc_getareg |
| 115 | -------------------------------------------------*/ |
| 116 | |
| 117 | static int scc_getbreg(const device_config *device) |
| 52 | 118 | { |
| 53 | | logerror("SCC: port B reg %i read 0x%02x\n",scc_reg,scc_reg_val_b[scc_reg]); |
| 119 | scc8530_t *scc = get_token(device); |
| 54 | 120 | |
| 55 | | if (scc_reg == 2) |
| 121 | logerror("SCC: port B reg %i read 0x%02x\n", scc->reg, scc->reg_val_b[scc->reg]); |
| 122 | |
| 123 | if (scc->reg == 2) |
| 56 | 124 | { |
| 57 | | // HACK! but lets the Mac Plus mouse move again. Needs further investigation. |
| 58 | | if (scc_intf && scc_intf->acknowledge) |
| 59 | | scc_intf->acknowledge(); |
| 125 | /* HACK! but lets the Mac Plus mouse move again. Needs further investigation. */ |
| 126 | scc_acknowledge(device); |
| 60 | 127 | |
| 61 | | return scc_status; |
| 128 | return scc->status; |
| 62 | 129 | } |
| 63 | 130 | |
| 64 | | return scc_reg_val_b[scc_reg]; |
| 131 | return scc->reg_val_b[scc->reg]; |
| 65 | 132 | } |
| 66 | 133 | |
| 67 | 134 | |
| 68 | 135 | |
| 69 | | static void scc_putareg(int data) |
| 136 | /*------------------------------------------------- |
| 137 | scc_putareg |
| 138 | -------------------------------------------------*/ |
| 139 | |
| 140 | static void scc_putareg(const device_config *device, int data) |
| 70 | 141 | { |
| 71 | | if (scc_reg == 0) |
| 142 | scc8530_t *scc = get_token(device); |
| 143 | |
| 144 | if (scc->reg == 0) |
| 72 | 145 | { |
| 73 | 146 | if (data & 0x10) |
| 74 | | { |
| 75 | | if (scc_intf && scc_intf->acknowledge) |
| 76 | | scc_intf->acknowledge(); |
| 77 | | } |
| 147 | scc_acknowledge(device); |
| 78 | 148 | } |
| 79 | | scc_reg_val_a[scc_reg] = data; |
| 80 | | logerror("SCC: port A reg %i write 0x%02x\n",scc_reg,data); |
| 149 | scc->reg_val_a[scc->reg] = data; |
| 150 | logerror("SCC: port A reg %i write 0x%02x\n", scc->reg, data); |
| 81 | 151 | } |
| 82 | 152 | |
| 83 | 153 | |
| 84 | 154 | |
| 85 | | static void scc_putbreg(int data) |
| 155 | /*------------------------------------------------- |
| 156 | scc_putbreg |
| 157 | -------------------------------------------------*/ |
| 158 | |
| 159 | static void scc_putbreg(const device_config *device, int data) |
| 86 | 160 | { |
| 87 | | if (scc_reg == 0) |
| 161 | scc8530_t *scc = get_token(device); |
| 162 | |
| 163 | if (scc->reg == 0) |
| 88 | 164 | { |
| 89 | 165 | if (data & 0x10) |
| 90 | | { |
| 91 | | if (scc_intf && scc_intf->acknowledge) |
| 92 | | scc_intf->acknowledge(); |
| 93 | | } |
| 166 | scc_acknowledge(device); |
| 94 | 167 | } |
| 95 | | scc_reg_val_b[scc_reg] = data; |
| 96 | | logerror("SCC: port B reg %i write 0x%02x\n",scc_reg,data); |
| 168 | scc->reg_val_b[scc->reg] = data; |
| 169 | logerror("SCC: port B reg %i write 0x%02x\n", scc->reg, data); |
| 97 | 170 | } |
| 98 | 171 | |
| 99 | | unsigned char scc_get_reg_a(int reg) |
| 172 | |
| 173 | |
| 174 | /*------------------------------------------------- |
| 175 | scc_get_reg_a |
| 176 | -------------------------------------------------*/ |
| 177 | |
| 178 | UINT8 scc_get_reg_a(const device_config *device, int reg) |
| 100 | 179 | { |
| 101 | | return scc_reg_val_a[reg]; |
| 180 | scc8530_t *scc = get_token(device); |
| 181 | return scc->reg_val_a[reg]; |
| 102 | 182 | } |
| 103 | 183 | |
| 104 | | unsigned char scc_get_reg_b(int reg) |
| 184 | |
| 185 | |
| 186 | /*------------------------------------------------- |
| 187 | scc_get_reg_b |
| 188 | -------------------------------------------------*/ |
| 189 | |
| 190 | UINT8 scc_get_reg_b(const device_config *device, int reg) |
| 105 | 191 | { |
| 106 | | return scc_reg_val_b[reg]; |
| 192 | scc8530_t *scc = get_token(device); |
| 193 | return scc->reg_val_b[reg]; |
| 107 | 194 | } |
| 108 | 195 | |
| 109 | | void scc_set_reg_a(int reg, unsigned char data) |
| 196 | |
| 197 | |
| 198 | /*------------------------------------------------- |
| 199 | scc_set_reg_a |
| 200 | -------------------------------------------------*/ |
| 201 | |
| 202 | void scc_set_reg_a(const device_config *device, int reg, UINT8 data) |
| 110 | 203 | { |
| 111 | | scc_reg_val_a[reg] = data; |
| 204 | scc8530_t *scc = get_token(device); |
| 205 | scc->reg_val_a[reg] = data; |
| 112 | 206 | } |
| 113 | 207 | |
| 114 | | void scc_set_reg_b(int reg, unsigned char data) |
| 208 | |
| 209 | |
| 210 | /*------------------------------------------------- |
| 211 | scc_set_reg_a |
| 212 | -------------------------------------------------*/ |
| 213 | |
| 214 | void scc_set_reg_b(const device_config *device, int reg, UINT8 data) |
| 115 | 215 | { |
| 116 | | scc_reg_val_b[reg] = data; |
| 216 | scc8530_t *scc = get_token(device); |
| 217 | scc->reg_val_b[reg] = data; |
| 117 | 218 | } |
| 118 | 219 | |
| 119 | | READ8_HANDLER(scc_r) |
| 220 | |
| 221 | |
| 222 | /*------------------------------------------------- |
| 223 | scc_r |
| 224 | -------------------------------------------------*/ |
| 225 | |
| 226 | READ8_DEVICE_HANDLER(scc_r) |
| 120 | 227 | { |
| 228 | scc8530_t *scc = get_token(device); |
| 121 | 229 | UINT8 result = 0; |
| 122 | 230 | |
| 123 | 231 | offset %= 4; |
| r2927 | r2928 | |
| 129 | 237 | { |
| 130 | 238 | case 0: |
| 131 | 239 | /* Channel B (Printer Port) Control */ |
| 132 | | if (scc_mode == 1) |
| 133 | | scc_mode = 0; |
| 240 | if (scc->mode == 1) |
| 241 | scc->mode = 0; |
| 134 | 242 | else |
| 135 | | scc_reg = 0; |
| 243 | scc->reg = 0; |
| 136 | 244 | |
| 137 | | result = scc_getbreg(); |
| 245 | result = scc_getbreg(device); |
| 138 | 246 | break; |
| 139 | 247 | |
| 140 | 248 | case 1: |
| 141 | 249 | /* Channel A (Modem Port) Control */ |
| 142 | | if (scc_mode == 1) |
| 143 | | scc_mode = 0; |
| 250 | if (scc->mode == 1) |
| 251 | scc->mode = 0; |
| 144 | 252 | else |
| 145 | | scc_reg = 0; |
| 253 | scc->reg = 0; |
| 146 | 254 | |
| 147 | | result = scc_getareg(); |
| 255 | result = scc_getareg(device); |
| 148 | 256 | break; |
| 149 | 257 | |
| 150 | 258 | case 2: |
| r2927 | r2928 | |
| 162 | 270 | |
| 163 | 271 | |
| 164 | 272 | |
| 165 | | WRITE8_HANDLER(scc_w) |
| 273 | /*------------------------------------------------- |
| 274 | scc_w |
| 275 | -------------------------------------------------*/ |
| 276 | |
| 277 | WRITE8_DEVICE_HANDLER(scc_w) |
| 166 | 278 | { |
| 279 | scc8530_t *scc = get_token(device); |
| 280 | |
| 167 | 281 | offset &= 3; |
| 168 | 282 | |
| 169 | 283 | switch(offset) |
| 170 | 284 | { |
| 171 | 285 | case 0: |
| 172 | 286 | /* Channel B (Printer Port) Control */ |
| 173 | | if (scc_mode == 0) |
| 287 | if (scc->mode == 0) |
| 174 | 288 | { |
| 175 | 289 | if((data & 0xf0) == 0) // not a reset command |
| 176 | 290 | { |
| 177 | | scc_mode = 1; |
| 178 | | scc_reg = data & 0x0f; |
| 179 | | logerror("SCC: Port B Reg select - %i\n",scc_reg); |
| 180 | | // scc_putbreg(data & 0xf0); |
| 291 | scc->mode = 1; |
| 292 | scc->reg = data & 0x0f; |
| 293 | logerror("SCC: Port B Reg select - %i\n",scc->reg); |
| 294 | // scc_putbreg(device, data & 0xf0); |
| 181 | 295 | } |
| 182 | 296 | } |
| 183 | 297 | else |
| 184 | 298 | { |
| 185 | | scc_mode = 0; |
| 186 | | scc_putbreg(data); |
| 299 | scc->mode = 0; |
| 300 | scc_putbreg(device, data); |
| 187 | 301 | } |
| 188 | 302 | break; |
| 189 | 303 | |
| 190 | 304 | case 1: |
| 191 | 305 | /* Channel A (Modem Port) Control */ |
| 192 | | if (scc_mode == 0) |
| 306 | if (scc->mode == 0) |
| 193 | 307 | { |
| 194 | 308 | if((data & 0xf0) == 0) // not a reset command |
| 195 | 309 | { |
| 196 | | scc_mode = 1; |
| 197 | | scc_reg = data & 0x0f; |
| 198 | | logerror("SCC: Port A Reg select - %i\n",scc_reg); |
| 199 | | // scc_putareg(data & 0xf0); |
| 310 | scc->mode = 1; |
| 311 | scc->reg = data & 0x0f; |
| 312 | logerror("SCC: Port A Reg select - %i\n", scc->reg); |
| 313 | // scc_putareg(device, data & 0xf0); |
| 200 | 314 | } |
| 201 | 315 | } |
| 202 | 316 | else |
| 203 | 317 | { |
| 204 | | scc_mode = 0; |
| 205 | | scc_putareg(data); |
| 318 | scc->mode = 0; |
| 319 | scc_putareg(device, data); |
| 206 | 320 | } |
| 207 | 321 | break; |
| 208 | 322 | |
| r2927 | r2928 | |
| 218 | 332 | } |
| 219 | 333 | } |
| 220 | 334 | |
| 335 | |
| 336 | |
| 337 | /*------------------------------------------------- |
| 338 | DEVICE_GET_INFO( scc8530 ) |
| 339 | -------------------------------------------------*/ |
| 340 | |
| 341 | static DEVICE_SET_INFO( scc8530 ) |
| 342 | { |
| 343 | switch (state) |
| 344 | { |
| 345 | /* no parameters to set */ |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | |
| 350 | |
| 351 | /*------------------------------------------------- |
| 352 | DEVICE_GET_INFO( scc8530 ) |
| 353 | -------------------------------------------------*/ |
| 354 | |
| 355 | DEVICE_GET_INFO( scc8530 ) |
| 356 | { |
| 357 | switch (state) |
| 358 | { |
| 359 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 360 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(scc8530_t); break; |
| 361 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 362 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 363 | |
| 364 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 365 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(scc8530); break; |
| 366 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(scc8530); break; |
| 367 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 368 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 369 | |
| 370 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 371 | case DEVINFO_STR_NAME: info->s = "Zilog 8530 SCC"; break; |
| 372 | case DEVINFO_STR_FAMILY: info->s = "Zilog 8530 SCC"; break; |
| 373 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; |
| 374 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; |
| 375 | case DEVINFO_STR_CREDITS: /* Nothing */ break; |
| 376 | } |
| 377 | } |
src/mess/machine/mac.c
| r2927 | r2928 | |
| 39 | 39 | #include <time.h> |
| 40 | 40 | |
| 41 | 41 | #include "driver.h" |
| 42 | | #include "deprecat.h" |
| 43 | 42 | #include "machine/6522via.h" |
| 44 | 43 | #include "machine/8530scc.h" |
| 45 | 44 | #include "cpu/m68000/m68000.h" |
| r2927 | r2928 | |
| 717 | 716 | * Serial Control Chip |
| 718 | 717 | * *************************************************************************/ |
| 719 | 718 | |
| 720 | | static void mac_scc_ack(void) |
| 719 | static void mac_scc_ack(const device_config *device) |
| 721 | 720 | { |
| 722 | | set_scc_interrupt(Machine, 0); |
| 721 | set_scc_interrupt(device->machine, 0); |
| 723 | 722 | } |
| 724 | 723 | |
| 725 | 724 | |
| 726 | 725 | |
| 727 | 726 | void mac_scc_mouse_irq(running_machine *machine, int x, int y) |
| 728 | 727 | { |
| 728 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 729 | 729 | static int last_was_x = 0; |
| 730 | 730 | |
| 731 | 731 | if (x && y) |
| 732 | 732 | { |
| 733 | 733 | if (last_was_x) |
| 734 | | scc_set_status(0x0a); |
| 734 | scc_set_status(scc, 0x0a); |
| 735 | 735 | else |
| 736 | | scc_set_status(0x02); |
| 736 | scc_set_status(scc, 0x02); |
| 737 | 737 | |
| 738 | 738 | last_was_x ^= 1; |
| 739 | 739 | } |
| 740 | 740 | else |
| 741 | 741 | { |
| 742 | 742 | if (x) |
| 743 | | scc_set_status(0x0a); |
| 743 | scc_set_status(scc, 0x0a); |
| 744 | 744 | else |
| 745 | | scc_set_status(0x02); |
| 745 | scc_set_status(scc, 0x02); |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | //cpunum_set_input_line(machine, 0, 2, ASSERT_LINE); |
| r2927 | r2928 | |
| 753 | 753 | |
| 754 | 754 | READ16_HANDLER ( mac_scc_r ) |
| 755 | 755 | { |
| 756 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 756 | 757 | UINT16 result; |
| 757 | | result = scc_r(machine, offset); |
| 758 | |
| 759 | result = scc_r(scc, offset); |
| 758 | 760 | return (result << 8) | result; |
| 759 | 761 | } |
| 760 | 762 | |
| r2927 | r2928 | |
| 762 | 764 | |
| 763 | 765 | WRITE16_HANDLER ( mac_scc_w ) |
| 764 | 766 | { |
| 765 | | scc_w(machine, offset, (UINT8) data); |
| 767 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 768 | scc_w(scc, offset, (UINT8) data); |
| 766 | 769 | } |
| 767 | 770 | |
| 768 | 771 | |
| 769 | 772 | |
| 770 | | static const struct scc8530_interface mac_scc8530_interface = |
| 773 | const scc8530_interface mac_scc8530_interface = |
| 771 | 774 | { |
| 772 | 775 | mac_scc_ack |
| 773 | 776 | }; |
| r2927 | r2928 | |
| 1304 | 1307 | /* initialize real-time clock */ |
| 1305 | 1308 | rtc_init(); |
| 1306 | 1309 | |
| 1307 | | /* initialize serial */ |
| 1308 | | scc_init(&mac_scc8530_interface); |
| 1309 | | |
| 1310 | 1310 | /* setup the memory overlay */ |
| 1311 | 1311 | set_memory_overlay(machine, 1); |
| 1312 | 1312 | |
src/mess/drivers/x68k.c
| r2927 | r2928 | |
| 531 | 531 | sys.mouse.inputtype++; |
| 532 | 532 | if(sys.mouse.inputtype > 2) |
| 533 | 533 | { |
| 534 | | int val = scc_get_reg_b(0); |
| 534 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 535 | int val = scc_get_reg_b(scc, 0); |
| 535 | 536 | sys.mouse.inputtype = 0; |
| 536 | 537 | sys.mouse.bufferempty = 1; |
| 537 | 538 | val &= ~0x01; |
| 538 | | scc_set_reg_b(0,val); |
| 539 | scc_set_reg_b(scc, 0, val); |
| 539 | 540 | logerror("SCC: mouse buffer empty\n"); |
| 540 | 541 | } |
| 541 | 542 | |
| r2927 | r2928 | |
| 550 | 551 | */ |
| 551 | 552 | static READ16_HANDLER( x68k_scc_r ) |
| 552 | 553 | { |
| 554 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 553 | 555 | offset %= 4; |
| 554 | 556 | switch(offset) |
| 555 | 557 | { |
| 556 | 558 | case 0: |
| 557 | | return scc_r(machine, 0); |
| 559 | return scc_r(scc, 0); |
| 558 | 560 | case 1: |
| 559 | 561 | return x68k_read_mouse(machine); |
| 560 | 562 | case 2: |
| 561 | | return scc_r(machine, 1); |
| 563 | return scc_r(scc, 1); |
| 562 | 564 | case 3: |
| 563 | | return scc_r(machine, 3); |
| 565 | return scc_r(scc, 3); |
| 564 | 566 | default: |
| 565 | 567 | return 0xff; |
| 566 | 568 | } |
| r2927 | r2928 | |
| 568 | 570 | |
| 569 | 571 | static WRITE16_HANDLER( x68k_scc_w ) |
| 570 | 572 | { |
| 573 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 571 | 574 | static unsigned char prev; |
| 572 | 575 | offset %= 4; |
| 573 | 576 | |
| 574 | 577 | switch(offset) |
| 575 | 578 | { |
| 576 | 579 | case 0: |
| 577 | | scc_w(machine, 0,(UINT8)data); |
| 578 | | if((scc_get_reg_b(5) & 0x02) != prev) |
| 580 | scc_w(scc, 0,(UINT8)data); |
| 581 | if((scc_get_reg_b(scc, 5) & 0x02) != prev) |
| 579 | 582 | { |
| 580 | | if(scc_get_reg_b(5) & 0x02) // Request to Send |
| 583 | if(scc_get_reg_b(scc, 5) & 0x02) // Request to Send |
| 581 | 584 | { |
| 582 | | int val = scc_get_reg_b(0); |
| 585 | int val = scc_get_reg_b(scc, 0); |
| 583 | 586 | sys.mouse.bufferempty = 0; |
| 584 | 587 | val |= 0x01; |
| 585 | | scc_set_reg_b(0,val); |
| 588 | scc_set_reg_b(scc, 0,val); |
| 586 | 589 | } |
| 587 | 590 | } |
| 588 | 591 | break; |
| 589 | 592 | case 1: |
| 590 | | scc_w(machine, 2,(UINT8)data); |
| 593 | scc_w(scc, 2,(UINT8)data); |
| 591 | 594 | break; |
| 592 | 595 | case 2: |
| 593 | | scc_w(machine, 1,(UINT8)data); |
| 596 | scc_w(scc, 1,(UINT8)data); |
| 594 | 597 | break; |
| 595 | 598 | case 3: |
| 596 | | scc_w(machine, 3,(UINT8)data); |
| 599 | scc_w(scc, 3,(UINT8)data); |
| 597 | 600 | break; |
| 598 | 601 | } |
| 599 | | prev = scc_get_reg_b(5) & 0x02; |
| 602 | prev = scc_get_reg_b(scc, 5) & 0x02; |
| 600 | 603 | } |
| 601 | 604 | |
| 602 | 605 | static TIMER_CALLBACK(x68k_scc_ack) |
| 603 | 606 | { |
| 607 | const device_config *scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 604 | 608 | if(sys.mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty |
| 605 | 609 | return; |
| 606 | 610 | |
| r2927 | r2928 | |
| 608 | 612 | return; |
| 609 | 613 | |
| 610 | 614 | // hard-code the IRQ vector for now, until the SCC code is more complete |
| 611 | | if((scc_get_reg_a(9) & 0x08) || (scc_get_reg_b(9) & 0x08)) // SCC reg WR9 is the same for both channels |
| 615 | if((scc_get_reg_a(scc, 9) & 0x08) || (scc_get_reg_b(scc, 9) & 0x08)) // SCC reg WR9 is the same for both channels |
| 612 | 616 | { |
| 613 | | if((scc_get_reg_b(1) & 0x18) != 0) // if bits 3 and 4 of WR1 are 0, then Rx IRQs are disabled on this channel |
| 617 | if((scc_get_reg_b(scc, 1) & 0x18) != 0) // if bits 3 and 4 of WR1 are 0, then Rx IRQs are disabled on this channel |
| 614 | 618 | { |
| 615 | | if(scc_get_reg_b(5) & 0x02) // RTS signal |
| 619 | if(scc_get_reg_b(scc, 5) & 0x02) // RTS signal |
| 616 | 620 | { |
| 617 | 621 | sys.mouse.irqactive = 1; |
| 618 | 622 | current_vector[5] = 0x54; |
| r2927 | r2928 | |
| 1601 | 1605 | x68k_ct_w // CT1, CT2 from YM2151 port 0x1b |
| 1602 | 1606 | }; |
| 1603 | 1607 | |
| 1604 | | static const struct scc8530_interface scc_interface = |
| 1605 | | { |
| 1606 | | NULL//x68k_scc_ack |
| 1607 | | }; |
| 1608 | | |
| 1609 | 1608 | static const struct rp5c15_interface rtc_intf = |
| 1610 | 1609 | { |
| 1611 | 1610 | x68k_rtc_alarm_irq |
| r2927 | r2928 | |
| 1999 | 1998 | memset(&sys,0,sizeof(sys)); |
| 2000 | 1999 | |
| 2001 | 2000 | mfp_init(); |
| 2002 | | scc_init(&scc_interface); |
| 2003 | 2001 | rp5c15_init(machine, &rtc_intf); |
| 2004 | 2002 | |
| 2005 | 2003 | cpunum_set_irq_callback(0, x68k_int_ack); |
| r2927 | r2928 | |
| 2037 | 2035 | |
| 2038 | 2036 | MDRV_DEVICE_ADD( "x68k_hdc", X68KHDC ) |
| 2039 | 2037 | |
| 2038 | MDRV_DEVICE_ADD( "scc", SCC8530 ) |
| 2039 | |
| 2040 | 2040 | /* video hardware */ |
| 2041 | 2041 | MDRV_SCREEN_ADD("main", RASTER) |
| 2042 | 2042 | MDRV_SCREEN_REFRESH_RATE(55.45) |
src/mess/drivers/atarist.c
| r2927 | r2928 | |
| 964 | 964 | AM_RANGE(0xff8e20, 0xff8e21) AM_READWRITE(megaste_cache_r, megaste_cache_w) |
| 965 | 965 | AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901, MC68901_TAG, mc68901_register_r, mc68901_register_w, 0xff) |
| 966 | 966 | // AM_RANGE(0xfffa40, 0xfffa5f) AM_READWRITE(megast_fpu_r, megast_fpu_w) |
| 967 | | AM_RANGE(0xff8c80, 0xff8c87) AM_READWRITE8(scc_r, scc_w, 0xff00) |
| 967 | AM_RANGE(0xff8c80, 0xff8c87) AM_DEVREADWRITE8(SCC8530, "scc", scc_r, scc_w, 0xff00) |
| 968 | 968 | AM_RANGE(0xfffc00, 0xfffc01) AM_READWRITE8(acia6850_0_stat_r, acia6850_0_ctrl_w, 0xff00) |
| 969 | 969 | AM_RANGE(0xfffc02, 0xfffc03) AM_READWRITE8(acia6850_0_data_r, acia6850_0_data_w, 0xff00) |
| 970 | 970 | AM_RANGE(0xfffc04, 0xfffc05) AM_READWRITE8(acia6850_1_stat_r, acia6850_1_ctrl_w, 0xff00) |
| r2927 | r2928 | |
| 1726 | 1726 | MDRV_MACHINE_START(atarist) |
| 1727 | 1727 | |
| 1728 | 1728 | // device hardware |
| 1729 | | |
| 1730 | 1729 | MDRV_DEVICE_ADD(MC68901_TAG, MC68901) |
| 1731 | 1730 | MDRV_DEVICE_CONFIG(mfp_intf) |
| 1731 | MDRV_DEVICE_ADD("scc", SCC8530) |
| 1732 | 1732 | |
| 1733 | 1733 | // video hardware |
| 1734 | 1734 | MDRV_SCREEN_ADD("main", RASTER) |
| r2927 | r2928 | |
| 1772 | 1772 | MDRV_MACHINE_START(atariste) |
| 1773 | 1773 | |
| 1774 | 1774 | // device hardware |
| 1775 | | |
| 1776 | 1775 | MDRV_DEVICE_ADD(MC68901_TAG, MC68901) |
| 1777 | 1776 | MDRV_DEVICE_CONFIG(atariste_mfp_intf) |
| 1777 | MDRV_DEVICE_ADD("scc", SCC8530) |
| 1778 | 1778 | |
| 1779 | 1779 | // video hardware |
| 1780 | 1780 | MDRV_SCREEN_ADD("main", RASTER) |
| r2927 | r2928 | |
| 1825 | 1825 | MDRV_MACHINE_START(stbook) |
| 1826 | 1826 | |
| 1827 | 1827 | // device hardware |
| 1828 | | |
| 1829 | 1828 | MDRV_DEVICE_ADD(MC68901_TAG, MC68901) |
| 1830 | 1829 | MDRV_DEVICE_CONFIG(stbook_mfp_intf) |
| 1830 | MDRV_DEVICE_ADD("scc", SCC8530) |
| 1831 | 1831 | |
| 1832 | 1832 | // video hardware |
| 1833 | 1833 | MDRV_SCREEN_ADD("main", LCD) |
src/mess/drivers/ip20.c
| r2927 | r2928 | |
| 110 | 110 | |
| 111 | 111 | static READ32_HANDLER( hpc_r ) |
| 112 | 112 | { |
| 113 | const device_config *scc; |
| 114 | |
| 113 | 115 | offset <<= 2; |
| 114 | 116 | if( offset >= 0x0e00 && offset <= 0x0e7c ) |
| 115 | 117 | { |
| r2927 | r2928 | |
| 182 | 184 | case 0x0d04: |
| 183 | 185 | verboselog( 2, "HPC DUART0 Channel B Data Read\n" ); |
| 184 | 186 | // return 0; |
| 185 | | return scc_r(machine, 2); |
| 187 | scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 188 | return scc_r(scc, 2); |
| 186 | 189 | break; |
| 187 | 190 | case 0x0d08: |
| 188 | 191 | verboselog( 2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask ); |
| r2927 | r2928 | |
| 192 | 195 | case 0x0d0c: |
| 193 | 196 | verboselog( 2, "HPC DUART0 Channel A Data Read\n" ); |
| 194 | 197 | // return 0; |
| 195 | | return scc_r(machine, 3); |
| 198 | scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 199 | return scc_r(scc, 3); |
| 196 | 200 | break; |
| 197 | 201 | case 0x0d10: |
| 198 | 202 | // verboselog( 2, "HPC DUART1 Channel B Control Read\n" ); |
| r2927 | r2928 | |
| 249 | 253 | |
| 250 | 254 | static WRITE32_HANDLER( hpc_w ) |
| 251 | 255 | { |
| 256 | const device_config *scc; |
| 257 | |
| 252 | 258 | offset <<= 2; |
| 253 | 259 | if( offset >= 0x0e00 && offset <= 0x0e7c ) |
| 254 | 260 | { |
| r2927 | r2928 | |
| 383 | 389 | break; |
| 384 | 390 | case 0x0d00: |
| 385 | 391 | verboselog( 2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); |
| 386 | | scc_w(machine, 0, data); |
| 392 | scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 393 | scc_w(scc, 0, data); |
| 387 | 394 | break; |
| 388 | 395 | case 0x0d04: |
| 389 | 396 | verboselog( 2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); |
| 390 | | scc_w(machine, 2, data); |
| 397 | scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 398 | scc_w(scc, 2, data); |
| 391 | 399 | break; |
| 392 | 400 | case 0x0d08: |
| 393 | 401 | verboselog( 2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); |
| 394 | | scc_w(machine, 1, data); |
| 402 | scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 403 | scc_w(scc, 1, data); |
| 395 | 404 | break; |
| 396 | 405 | case 0x0d0c: |
| 397 | 406 | verboselog( 2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); |
| 398 | | scc_w(machine, 3, data); |
| 407 | scc = device_list_find_by_tag(machine->config->devicelist, SCC8530, "scc"); |
| 408 | scc_w(scc, 3, data); |
| 399 | 409 | break; |
| 400 | 410 | case 0x0d10: |
| 401 | 411 | if( ( data & 0x000000ff ) >= 0x00000020 ) |
| r2927 | r2928 | |
| 582 | 592 | |
| 583 | 593 | static DRIVER_INIT( ip204415 ) |
| 584 | 594 | { |
| 585 | | scc_init(NULL); |
| 586 | 595 | wd33c93_init(&scsi_intf); |
| 587 | 596 | add_exit_callback(machine, ip204415_exit); |
| 588 | 597 | } |
| r2927 | r2928 | |
| 635 | 644 | |
| 636 | 645 | MDRV_SOUND_ADD( CDDA, 0 ) |
| 637 | 646 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 647 | |
| 648 | MDRV_DEVICE_ADD("scc", SCC8530) |
| 638 | 649 | MACHINE_DRIVER_END |
| 639 | 650 | |
| 640 | 651 | ROM_START( ip204415 ) |