src/mess/machine/msm58321.c
| r0 | r5203 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | OKI MSM58321 Real Time Clock emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | /* |
| 11 | |
| 12 | TODO: |
| 13 | |
| 14 | - count |
| 15 | - stop |
| 16 | - reset |
| 17 | - reference registers |
| 18 | |
| 19 | */ |
| 20 | |
| 21 | #include "driver.h" |
| 22 | #include "msm58321.h" |
| 23 | |
| 24 | /*************************************************************************** |
| 25 | PARAMETERS |
| 26 | ***************************************************************************/ |
| 27 | |
| 28 | #define LOG 1 |
| 29 | |
| 30 | enum |
| 31 | { |
| 32 | REGISTER_S1 = 0, |
| 33 | REGISTER_S0, |
| 34 | REGISTER_MI1, |
| 35 | REGISTER_MI10, |
| 36 | REGISTER_H1, |
| 37 | REGISTER_H10, |
| 38 | REGISTER_W, |
| 39 | REGISTER_D1, |
| 40 | REGISTER_D10, |
| 41 | REGISTER_MO1, |
| 42 | REGISTER_MO10, |
| 43 | REGISTER_Y1, |
| 44 | REGISTER_Y10, |
| 45 | REGISTER_RESET, |
| 46 | REGISTER_REF0, |
| 47 | REGISTER_REF1 |
| 48 | }; |
| 49 | |
| 50 | /*************************************************************************** |
| 51 | TYPE DEFINITIONS |
| 52 | ***************************************************************************/ |
| 53 | |
| 54 | typedef struct _msm58321_t msm58321_t; |
| 55 | struct _msm58321_t |
| 56 | { |
| 57 | devcb_resolved_write_line out_busy_func; |
| 58 | |
| 59 | UINT8 reg[13]; /* registers */ |
| 60 | int busy; /* busy flag */ |
| 61 | |
| 62 | /* timers */ |
| 63 | emu_timer *busy_timer; |
| 64 | }; |
| 65 | |
| 66 | /*************************************************************************** |
| 67 | INLINE FUNCTIONS |
| 68 | ***************************************************************************/ |
| 69 | |
| 70 | INLINE msm58321_t *get_safe_token(const device_config *device) |
| 71 | { |
| 72 | assert(device != NULL); |
| 73 | assert(device->token != NULL); |
| 74 | |
| 75 | return (msm58321_t *)device->token; |
| 76 | } |
| 77 | |
| 78 | INLINE const msm58321_interface *get_interface(const device_config *device) |
| 79 | { |
| 80 | assert(device != NULL); |
| 81 | assert(device->type == MSM58321); |
| 82 | return (const msm58321_interface *) device->static_config; |
| 83 | } |
| 84 | |
| 85 | /*************************************************************************** |
| 86 | IMPLEMENTATION |
| 87 | ***************************************************************************/ |
| 88 | |
| 89 | READ8_DEVICE_HANDLER( msm58321_r ) |
| 90 | { |
| 91 | msm58321_t *msm58321 = get_safe_token(device); |
| 92 | |
| 93 | UINT8 data = 0; |
| 94 | |
| 95 | switch(offset & 0x0f) |
| 96 | { |
| 97 | case REGISTER_RESET: |
| 98 | break; |
| 99 | |
| 100 | case REGISTER_REF0: |
| 101 | case REGISTER_REF1: |
| 102 | break; |
| 103 | |
| 104 | default: |
| 105 | data = msm58321->reg[offset]; |
| 106 | break; |
| 107 | } |
| 108 | |
| 109 | return data; |
| 110 | } |
| 111 | |
| 112 | WRITE8_DEVICE_HANDLER( msm58321_w ) |
| 113 | { |
| 114 | msm58321_t *msm58321 = get_safe_token(device); |
| 115 | |
| 116 | switch(offset & 0x0f) |
| 117 | { |
| 118 | case REGISTER_RESET: |
| 119 | if (LOG) logerror("MSM58321 '%s' Reset\n", device->tag); |
| 120 | break; |
| 121 | |
| 122 | case REGISTER_REF0: |
| 123 | case REGISTER_REF1: |
| 124 | if (LOG) logerror("MSM58321 '%s' Reference Signal\n", device->tag); |
| 125 | break; |
| 126 | |
| 127 | default: |
| 128 | if (LOG) logerror("MSM58321 '%s' Register %01x = %01x\n", device->tag, offset, data & 0x0f); |
| 129 | msm58321->reg[offset] = data & 0x0f; |
| 130 | break; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | WRITE_LINE_DEVICE_HANDLER( msm58321_stop_w ) |
| 135 | { |
| 136 | // msm58321_t *msm58321 = get_safe_token(device); |
| 137 | |
| 138 | if (LOG) logerror("MSM58321 '%s' STOP: %u\n", device->tag, state); |
| 139 | } |
| 140 | |
| 141 | WRITE_LINE_DEVICE_HANDLER( msm58321_test_w ) |
| 142 | { |
| 143 | // msm58321_t *msm58321 = get_safe_token(device); |
| 144 | |
| 145 | if (LOG) logerror("MSM58321 '%s' TEST: %u\n", device->tag, state); |
| 146 | } |
| 147 | |
| 148 | /*------------------------------------------------- |
| 149 | TIMER_CALLBACK( busy_tick ) |
| 150 | -------------------------------------------------*/ |
| 151 | |
| 152 | static TIMER_CALLBACK( busy_tick ) |
| 153 | { |
| 154 | const device_config *device = ptr; |
| 155 | msm58321_t *msm58321 = get_safe_token(device); |
| 156 | |
| 157 | devcb_call_write_line(&msm58321->out_busy_func, msm58321->busy); |
| 158 | |
| 159 | msm58321->busy = !msm58321->busy; |
| 160 | } |
| 161 | |
| 162 | /*------------------------------------------------- |
| 163 | DEVICE_START( msm58321 ) |
| 164 | -------------------------------------------------*/ |
| 165 | |
| 166 | static DEVICE_START( msm58321 ) |
| 167 | { |
| 168 | msm58321_t *msm58321 = get_safe_token(device); |
| 169 | const msm58321_interface *intf = get_interface(device); |
| 170 | |
| 171 | /* resolve callbacks */ |
| 172 | devcb_resolve_write_line(&msm58321->out_busy_func, &intf->out_busy_func, device); |
| 173 | |
| 174 | /* create busy timer */ |
| 175 | msm58321->busy_timer = timer_alloc(device->machine, busy_tick, (void *)device); |
| 176 | timer_adjust_periodic(msm58321->busy_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2)); |
| 177 | |
| 178 | /* register for state saving */ |
| 179 | // state_save_register_device_item(device, 0, msm58321->); |
| 180 | } |
| 181 | |
| 182 | /*------------------------------------------------- |
| 183 | DEVICE_GET_INFO( msm58321 ) |
| 184 | -------------------------------------------------*/ |
| 185 | |
| 186 | DEVICE_GET_INFO( msm58321 ) |
| 187 | { |
| 188 | switch (state) |
| 189 | { |
| 190 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 191 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(msm58321_t); break; |
| 192 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 193 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 194 | |
| 195 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 196 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(msm58321); break; |
| 197 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 198 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 199 | |
| 200 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 201 | case DEVINFO_STR_NAME: strcpy(info->s, "OKI MSM58321"); break; |
| 202 | case DEVINFO_STR_FAMILY: strcpy(info->s, "OKI MSM58321"); break; |
| 203 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 204 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 205 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break; |
| 206 | } |
| 207 | } |
src/mess/machine/i8214.c
| r0 | r5203 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Intel 8214 Priority Interrupt Controller emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | /* |
| 11 | |
| 12 | TODO: |
| 13 | |
| 14 | - cascading |
| 15 | |
| 16 | */ |
| 17 | |
| 18 | #include "driver.h" |
| 19 | #include "i8214.h" |
| 20 | |
| 21 | /*************************************************************************** |
| 22 | PARAMETERS |
| 23 | ***************************************************************************/ |
| 24 | |
| 25 | #define LOG 0 |
| 26 | |
| 27 | /*************************************************************************** |
| 28 | TYPE DEFINITIONS |
| 29 | ***************************************************************************/ |
| 30 | |
| 31 | typedef struct _i8214_t i8214_t; |
| 32 | struct _i8214_t |
| 33 | { |
| 34 | devcb_resolved_write_line out_int_func; |
| 35 | devcb_resolved_write_line out_enlg_func; |
| 36 | |
| 37 | int inte; /* interrupt enable */ |
| 38 | int int_dis; /* interrupt disable flip-flop */ |
| 39 | int latch; /* interrupt latch */ |
| 40 | int a; /* request level */ |
| 41 | int b; /* current status register */ |
| 42 | UINT8 r; /* interrupt requests */ |
| 43 | int sgs; /* status group select */ |
| 44 | int etlg; /* enable this level group */ |
| 45 | }; |
| 46 | |
| 47 | /*************************************************************************** |
| 48 | INLINE FUNCTIONS |
| 49 | ***************************************************************************/ |
| 50 | |
| 51 | INLINE i8214_t *get_safe_token(const device_config *device) |
| 52 | { |
| 53 | assert(device != NULL); |
| 54 | assert(device->token != NULL); |
| 55 | |
| 56 | return (i8214_t *)device->token; |
| 57 | } |
| 58 | |
| 59 | INLINE const i8214_interface *get_interface(const device_config *device) |
| 60 | { |
| 61 | assert(device != NULL); |
| 62 | assert((device->type == I8214)); |
| 63 | return (const i8214_interface *) device->static_config; |
| 64 | } |
| 65 | |
| 66 | INLINE void trigger_interrupt(i8214_t *i8214) |
| 67 | { |
| 68 | devcb_call_write_line(&i8214->out_int_func, ASSERT_LINE); |
| 69 | devcb_call_write_line(&i8214->out_int_func, CLEAR_LINE); |
| 70 | } |
| 71 | |
| 72 | INLINE void check_interrupt(const device_config *device) |
| 73 | { |
| 74 | i8214_t *i8214 = get_safe_token(device); |
| 75 | int level; |
| 76 | |
| 77 | if (i8214->int_dis) return; |
| 78 | |
| 79 | for (level = 7; level >= 0; level--) |
| 80 | { |
| 81 | if (!BIT(i8214->r, level)) |
| 82 | { |
| 83 | /* latch interrupt level */ |
| 84 | i8214->latch = level; |
| 85 | |
| 86 | if (i8214->sgs) |
| 87 | { |
| 88 | if (level > i8214->b) |
| 89 | { |
| 90 | if (LOG) logerror("I8214 '%s' Interrupt Level %u\n", device->tag, level); |
| 91 | i8214->a = level; |
| 92 | trigger_interrupt(i8214); |
| 93 | } |
| 94 | } |
| 95 | else |
| 96 | { |
| 97 | if (LOG) logerror("I8214 '%s' Interrupt Level %u\n", device->tag, level); |
| 98 | i8214->a = level; |
| 99 | trigger_interrupt(i8214); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /*************************************************************************** |
| 106 | IMPLEMENTATION |
| 107 | ***************************************************************************/ |
| 108 | |
| 109 | READ8_DEVICE_HANDLER( i8214_a_r ) |
| 110 | { |
| 111 | i8214_t *i8214 = get_safe_token(device); |
| 112 | |
| 113 | UINT8 a = ~i8214->a & 0x07; |
| 114 | |
| 115 | i8214->int_dis = 0; |
| 116 | check_interrupt(device); |
| 117 | |
| 118 | if (LOG) logerror("I8214 '%s' A: %01x\n", device->tag, a); |
| 119 | |
| 120 | return a; |
| 121 | } |
| 122 | |
| 123 | WRITE8_DEVICE_HANDLER( i8214_b_w ) |
| 124 | { |
| 125 | i8214_t *i8214 = get_safe_token(device); |
| 126 | |
| 127 | i8214->b = ~data & 0x07; |
| 128 | |
| 129 | if (LOG) logerror("I8214 '%s' B: %01x\n", device->tag, i8214->b); |
| 130 | |
| 131 | check_interrupt(device); |
| 132 | } |
| 133 | |
| 134 | WRITE_LINE_DEVICE_HANDLER( i8214_elr_w ) |
| 135 | { |
| 136 | i8214_t *i8214 = get_safe_token(device); |
| 137 | |
| 138 | if (LOG) logerror("I8214 '%s' ELR: %u\n", device->tag, state); |
| 139 | |
| 140 | if (state) |
| 141 | { |
| 142 | i8214->a = 0; |
| 143 | i8214->b = 0; |
| 144 | i8214->sgs = 0; |
| 145 | |
| 146 | check_interrupt(device); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | WRITE_LINE_DEVICE_HANDLER( i8214_etlg_w ) |
| 151 | { |
| 152 | i8214_t *i8214 = get_safe_token(device); |
| 153 | |
| 154 | if (LOG) logerror("I8214 '%s' ETLG: %u\n", device->tag, state); |
| 155 | |
| 156 | i8214->etlg = state; |
| 157 | } |
| 158 | |
| 159 | WRITE_LINE_DEVICE_HANDLER( i8214_sgs_w ) |
| 160 | { |
| 161 | i8214_t *i8214 = get_safe_token(device); |
| 162 | |
| 163 | if (LOG) logerror("I8214 '%s' SGS: %u\n", device->tag, state); |
| 164 | |
| 165 | i8214->sgs = state; |
| 166 | |
| 167 | check_interrupt(device); |
| 168 | } |
| 169 | |
| 170 | WRITE_LINE_DEVICE_HANDLER( i8214_inte_w ) |
| 171 | { |
| 172 | i8214_t *i8214 = get_safe_token(device); |
| 173 | |
| 174 | if (LOG) logerror("I8214 '%s' INTE: %u\n", device->tag, state); |
| 175 | |
| 176 | i8214->inte = state; |
| 177 | } |
| 178 | |
| 179 | WRITE8_DEVICE_HANDLER( i8214_r_w ) |
| 180 | { |
| 181 | i8214_t *i8214 = get_safe_token(device); |
| 182 | |
| 183 | if (LOG) logerror("I8214 '%s' R: %02x\n", device->tag, data); |
| 184 | |
| 185 | i8214->r = data; |
| 186 | |
| 187 | check_interrupt(device); |
| 188 | } |
| 189 | |
| 190 | /*------------------------------------------------- |
| 191 | DEVICE_START( i8214 ) |
| 192 | -------------------------------------------------*/ |
| 193 | |
| 194 | static DEVICE_START( i8214 ) |
| 195 | { |
| 196 | i8214_t *i8214 = get_safe_token(device); |
| 197 | const i8214_interface *intf = get_interface(device); |
| 198 | |
| 199 | /* resolve callbacks */ |
| 200 | devcb_resolve_write_line(&i8214->out_int_func, &intf->out_int_func, device); |
| 201 | devcb_resolve_write_line(&i8214->out_enlg_func, &intf->out_enlg_func, device); |
| 202 | |
| 203 | /* register for state saving */ |
| 204 | state_save_register_device_item(device, 0, i8214->inte); |
| 205 | state_save_register_device_item(device, 0, i8214->int_dis); |
| 206 | state_save_register_device_item(device, 0, i8214->latch); |
| 207 | state_save_register_device_item(device, 0, i8214->a); |
| 208 | state_save_register_device_item(device, 0, i8214->b); |
| 209 | state_save_register_device_item(device, 0, i8214->r); |
| 210 | state_save_register_device_item(device, 0, i8214->sgs); |
| 211 | state_save_register_device_item(device, 0, i8214->etlg); |
| 212 | } |
| 213 | |
| 214 | /*------------------------------------------------- |
| 215 | DEVICE_GET_INFO( i8214 ) |
| 216 | -------------------------------------------------*/ |
| 217 | |
| 218 | DEVICE_GET_INFO( i8214 ) |
| 219 | { |
| 220 | switch (state) |
| 221 | { |
| 222 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 223 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(i8214_t); break; |
| 224 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 225 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 226 | |
| 227 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 228 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(i8214); break; |
| 229 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 230 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 231 | |
| 232 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 233 | case DEVINFO_STR_NAME: strcpy(info->s, "Intel 8214"); break; |
| 234 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Intel 8080"); break; |
| 235 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 236 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 237 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break; |
| 238 | } |
| 239 | } |
src/mess/drivers/v1050.c
| r5202 | r5203 | |
| 11 | 11 | TODO: |
| 12 | 12 | |
| 13 | 13 | - video |
| 14 | | - µPB8214 chip |
| 14 | - interrupts |
| 15 | - keyboard |
| 15 | 16 | - RTC58321 chip |
| 16 | | - keyboard |
| 17 | 17 | - winchester |
| 18 | 18 | |
| 19 | 19 | */ |
| r5202 | r5203 | |
| 25 | 25 | #include "cpu/mcs48/mcs48.h" |
| 26 | 26 | #include "devices/basicdsk.h" |
| 27 | 27 | #include "machine/ctronics.h" |
| 28 | #include "machine/i8214.h" |
| 28 | 29 | #include "machine/i8255a.h" |
| 30 | #include "machine/msm58321.h" |
| 29 | 31 | #include "machine/msm8251.h" |
| 30 | 32 | #include "machine/wd17xx.h" |
| 31 | 33 | #include "video/mc6845.h" |
| r5202 | r5203 | |
| 35 | 37 | return image_from_devtype_and_index(machine, IO_FLOPPY, drive); |
| 36 | 38 | } |
| 37 | 39 | |
| 40 | void v1050_set_int(running_machine *machine, UINT8 mask, int state) |
| 41 | { |
| 42 | v1050_state *driver_state = machine->driver_data; |
| 43 | |
| 44 | if (state) |
| 45 | { |
| 46 | driver_state->int_state |= mask; |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | driver_state->int_state &= ~mask; |
| 51 | } |
| 52 | |
| 53 | i8214_r_w(driver_state->i8214, 0, ~(driver_state->int_state & driver_state->int_mask)); |
| 54 | } |
| 55 | |
| 38 | 56 | static void v1050_bankswitch(running_machine *machine) |
| 39 | 57 | { |
| 40 | 58 | v1050_state *state = machine->driver_data; |
| r5202 | r5203 | |
| 72 | 90 | |
| 73 | 91 | /* Read/Write Handlers */ |
| 74 | 92 | |
| 93 | static READ8_HANDLER( v1050_i8214_r ) |
| 94 | { |
| 95 | v1050_state *state = space->machine->driver_data; |
| 96 | |
| 97 | return i8214_a_r(state->i8214, 0) << 1; |
| 98 | } |
| 99 | |
| 100 | static WRITE8_HANDLER( v1050_i8214_w ) |
| 101 | { |
| 102 | v1050_state *state = space->machine->driver_data; |
| 103 | |
| 104 | i8214_b_w(state->i8214, 0, (data >> 1) & 0x07); |
| 105 | i8214_sgs_w(state->i8214, BIT(data, 4)); |
| 106 | } |
| 107 | |
| 108 | static READ8_HANDLER( vint_clr_r ) |
| 109 | { |
| 110 | v1050_set_int(space->machine, INT_VSYNC, 0); |
| 111 | |
| 112 | return 0xff; |
| 113 | } |
| 114 | |
| 115 | static WRITE8_HANDLER( vint_clr_w ) |
| 116 | { |
| 117 | v1050_set_int(space->machine, INT_VSYNC, 0); |
| 118 | } |
| 119 | |
| 120 | static READ8_HANDLER( dint_clr_r ) |
| 121 | { |
| 122 | v1050_set_int(space->machine, INT_DISPLAY, 0); |
| 123 | |
| 124 | return 0xff; |
| 125 | } |
| 126 | |
| 127 | static WRITE8_HANDLER( dint_clr_w ) |
| 128 | { |
| 129 | v1050_set_int(space->machine, INT_DISPLAY, 0); |
| 130 | } |
| 131 | |
| 75 | 132 | static WRITE8_HANDLER( dvint_clr_w ) |
| 76 | 133 | { |
| 77 | 134 | cputag_set_input_line(space->machine, M6502_TAG, INPUT_LINE_IRQ0, CLEAR_LINE); |
| 78 | 135 | } |
| 79 | 136 | |
| 137 | static WRITE8_HANDLER( dint_w ) |
| 138 | { |
| 139 | v1050_set_int(space->machine, INT_DISPLAY, 1); |
| 140 | } |
| 141 | |
| 80 | 142 | static WRITE8_HANDLER( bank_w ) |
| 81 | 143 | { |
| 82 | 144 | v1050_state *state = space->machine->driver_data; |
| r5202 | r5203 | |
| 108 | 170 | AM_RANGE(0x90, 0x93) AM_DEVREADWRITE(I8255_MISC_TAG, i8255a_r, i8255a_w) |
| 109 | 171 | AM_RANGE(0x94, 0x97) AM_DEVREADWRITE(MB8877_TAG, wd17xx_r, wd17xx_w) |
| 110 | 172 | AM_RANGE(0x9c, 0x9f) AM_DEVREADWRITE(I8255_RTC_TAG, i8255a_r, i8255a_w) |
| 111 | | // AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w) |
| 112 | | // AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w) |
| 113 | | // AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(UPB8214_TAG, pic8214_r, pic8214_w) |
| 173 | AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w) |
| 174 | AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w) |
| 175 | AM_RANGE(0xc0, 0xc0) AM_READWRITE(v1050_i8214_r, v1050_i8214_w) |
| 114 | 176 | AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w) |
| 115 | 177 | // AM_RANGE(0xe0, 0xe1) AM_READWRITE(sasi_r, sasi_w) |
| 116 | 178 | ADDRESS_MAP_END |
| r5202 | r5203 | |
| 122 | 184 | AM_RANGE(0x8001, 0x8001) AM_DEVREADWRITE(HD6845_TAG, mc6845_register_r, mc6845_register_w) |
| 123 | 185 | AM_RANGE(0x9000, 0x9003) AM_DEVREADWRITE(I8255_M6502_TAG, i8255a_r, i8255a_w) |
| 124 | 186 | AM_RANGE(0xa000, 0xa000) AM_READWRITE(v1050_attr_r, v1050_attr_w) |
| 125 | | // AM_RANGE(0xb000, 0xb000) AM_WRITE(z80int_w) |
| 187 | AM_RANGE(0xb000, 0xb000) AM_WRITE(dint_w) |
| 126 | 188 | AM_RANGE(0xc000, 0xc000) AM_WRITE(dvint_clr_w) |
| 127 | 189 | AM_RANGE(0xe000, 0xffff) AM_ROM |
| 128 | 190 | ADDRESS_MAP_END |
| r5202 | r5203 | |
| 257 | 319 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 258 | 320 | INPUT_PORTS_END |
| 259 | 321 | |
| 322 | /* 8214 Interface */ |
| 323 | |
| 324 | static WRITE_LINE_DEVICE_HANDLER( v1050_8214_int_w ) |
| 325 | { |
| 326 | if (state) |
| 327 | { |
| 328 | cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, ASSERT_LINE); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | static I8214_INTERFACE( v1050_8214_intf ) |
| 333 | { |
| 334 | DEVCB_LINE(v1050_8214_int_w), |
| 335 | DEVCB_NULL |
| 336 | }; |
| 337 | |
| 338 | /* MSM58321 Interface */ |
| 339 | |
| 340 | static WRITE_LINE_DEVICE_HANDLER( msm58321_busy_w ) |
| 341 | { |
| 342 | v1050_state *driver_state = device->machine->driver_data; |
| 343 | |
| 344 | driver_state->rtc_busy = state; |
| 345 | } |
| 346 | |
| 347 | static MSM58321_INTERFACE( msm58321_intf ) |
| 348 | { |
| 349 | DEVCB_LINE(msm58321_busy_w) |
| 350 | }; |
| 351 | |
| 260 | 352 | /* Display 8255A Interface */ |
| 261 | 353 | |
| 262 | 354 | static WRITE8_DEVICE_HANDLER( crt_z80_ppi8255_c_w ) |
| r5202 | r5203 | |
| 402 | 494 | |
| 403 | 495 | /* Real Time Clock 8255A Interface */ |
| 404 | 496 | |
| 497 | static READ8_DEVICE_HANDLER( rtc_8255_a_r ) |
| 498 | { |
| 499 | /* |
| 500 | |
| 501 | bit signal description |
| 502 | |
| 503 | PA0 D0 RTC data bit 0 |
| 504 | PA1 D1 RTC data bit 1 |
| 505 | PA2 D2 RTC data bit 2 |
| 506 | PA3 D3 RTC data bit 3 |
| 507 | PA4 |
| 508 | PA5 |
| 509 | PA6 |
| 510 | PA7 |
| 511 | |
| 512 | */ |
| 513 | |
| 514 | logerror("RTC data read\n"); |
| 515 | |
| 516 | return 0; |
| 517 | } |
| 518 | |
| 519 | static WRITE8_DEVICE_HANDLER( rtc_8255_a_w ) |
| 520 | { |
| 521 | /* |
| 522 | |
| 523 | bit signal description |
| 524 | |
| 525 | PA0 D0 RTC data bit 0 |
| 526 | PA1 D1 RTC data bit 1 |
| 527 | PA2 D2 RTC data bit 2 |
| 528 | PA3 D3 RTC data bit 3 |
| 529 | PA4 |
| 530 | PA5 |
| 531 | PA6 |
| 532 | PA7 |
| 533 | |
| 534 | */ |
| 535 | |
| 536 | logerror("RTC data write %01x\n", data & 0x0f); |
| 537 | } |
| 538 | |
| 405 | 539 | static WRITE8_DEVICE_HANDLER( rtc_8255_b_w ) |
| 406 | 540 | { |
| 407 | 541 | /* |
| r5202 | r5203 | |
| 422 | 556 | v1050_state *state = device->machine->driver_data; |
| 423 | 557 | |
| 424 | 558 | state->int_mask = data; |
| 559 | |
| 560 | logerror("Interrupt Mask: %02x\n", data); |
| 425 | 561 | } |
| 426 | 562 | |
| 427 | 563 | static READ8_DEVICE_HANDLER( rtc_8255_c_r ) |
| r5202 | r5203 | |
| 441 | 577 | |
| 442 | 578 | */ |
| 443 | 579 | |
| 444 | | return 0xff; |
| 580 | v1050_state *state = device->machine->driver_data; |
| 581 | |
| 582 | return state->rtc_busy << 3; |
| 445 | 583 | } |
| 446 | 584 | |
| 447 | 585 | static WRITE8_DEVICE_HANDLER( rtc_8255_c_w ) |
| r5202 | r5203 | |
| 460 | 598 | PC7 clock device select |
| 461 | 599 | |
| 462 | 600 | */ |
| 601 | |
| 602 | // v1050_state *state = device->machine->driver_data; |
| 603 | logerror("Clock Address Write: %u\n", BIT(data, 4)); |
| 604 | logerror("Clock Data Write: %u\n", BIT(data, 5)); |
| 605 | logerror("Clock Data Read: %u\n", BIT(data, 6)); |
| 606 | logerror("Clock Device Select: %u\n", BIT(data, 7)); |
| 463 | 607 | } |
| 464 | 608 | |
| 465 | 609 | static I8255A_INTERFACE( rtc_8255_intf ) |
| 466 | 610 | { |
| 467 | | DEVCB_NULL, // Port A read (RTC data) |
| 611 | DEVCB_HANDLER(rtc_8255_a_r), // Port A read |
| 468 | 612 | DEVCB_NULL, // Port B read |
| 469 | 613 | DEVCB_HANDLER(rtc_8255_c_r), // Port C read |
| 470 | | DEVCB_NULL, // Port A write (RTC data) |
| 614 | DEVCB_HANDLER(rtc_8255_a_w), // Port A read |
| 471 | 615 | DEVCB_HANDLER(rtc_8255_b_w), // Port B write |
| 472 | 616 | DEVCB_HANDLER(rtc_8255_c_w) // Port C write |
| 473 | 617 | }; |
| r5202 | r5203 | |
| 476 | 620 | |
| 477 | 621 | static WD17XX_CALLBACK( v1050_mb8877_callback ) |
| 478 | 622 | { |
| 479 | | // v1050_state *driver_state = device->machine->driver_data; |
| 480 | | |
| 481 | 623 | switch (state) |
| 482 | 624 | { |
| 483 | 625 | case WD17XX_IRQ_CLR: |
| 484 | | // if (driver_state->f_int_enb) upb8214_r2_w(driver_state->upb8214, 0); |
| 626 | v1050_set_int(device->machine, INT_FLOPPY, 0); |
| 485 | 627 | break; |
| 486 | 628 | |
| 487 | 629 | case WD17XX_IRQ_SET: |
| 488 | | // if (driver_state->f_int_enb) upb8214_r2_w(driver_state->upb8214, 1); |
| 630 | v1050_set_int(device->machine, INT_FLOPPY, 1); |
| 489 | 631 | break; |
| 490 | 632 | |
| 491 | 633 | case WD17XX_DRQ_CLR: |
| r5202 | r5203 | |
| 511 | 653 | const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); |
| 512 | 654 | |
| 513 | 655 | /* find devices */ |
| 514 | | state->upb8214 = devtag_get_device(machine, UPB8214_TAG); |
| 656 | state->i8214 = devtag_get_device(machine, UPB8214_TAG); |
| 657 | state->msm58321 = devtag_get_device(machine, MSM58321_TAG); |
| 515 | 658 | state->i8255a_crt_z80 = devtag_get_device(machine, I8255_DISP_TAG); |
| 516 | 659 | state->i8255a_crt_m6502 = devtag_get_device(machine, I8255_M6502_TAG); |
| 517 | 660 | state->mb8877 = devtag_get_device(machine, MB8877_TAG); |
| 518 | 661 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); |
| 519 | 662 | |
| 663 | /* initialize I8214 */ |
| 664 | i8214_etlg_w(state->i8214, 1); |
| 665 | i8214_inte_w(state->i8214, 1); |
| 666 | |
| 520 | 667 | /* setup memory banking */ |
| 521 | 668 | memory_configure_bank(machine, 1, 0, 2, mess_ram, 0x10000); |
| 522 | 669 | memory_configure_bank(machine, 1, 2, 1, mess_ram + 0x1c000, 0); |
| r5202 | r5203 | |
| 563 | 710 | MDRV_IMPORT_FROM(v1050_video) |
| 564 | 711 | |
| 565 | 712 | /* devices */ |
| 566 | | MDRV_I8255A_ADD(I8255_DISP_TAG, disp_8255_intf) |
| 713 | MDRV_I8214_ADD(UPB8214_TAG, XTAL_16MHz/4, v1050_8214_intf) // NEC µPB8214C |
| 714 | MDRV_MSM58321_ADD(MSM58321_TAG, XTAL_32_768kHz, msm58321_intf) // OKI MSM58321RS |
| 715 | MDRV_I8255A_ADD(I8255_DISP_TAG, disp_8255_intf) // NEC D8255AC-5 |
| 567 | 716 | MDRV_I8255A_ADD(I8255_MISC_TAG, misc_8255_intf) |
| 568 | 717 | MDRV_I8255A_ADD(I8255_RTC_TAG, rtc_8255_intf) |
| 569 | 718 | MDRV_WD1793_ADD(MB8877_TAG, v1050_wd17xx_intf ) |