src/mame/machine/dc.c
| r784 | r785 | |
| 1 | | /*
|
| 2 | | |
| 3 | | dc.c - Sega Dreamcast hardware
|
| 4 | | |
| 5 | | */
|
| 6 | | |
| 7 | | #include "driver.h"
|
| 8 | | #include "dc.h"
|
| 9 | | |
| 10 | | READ64_HANDLER( dc_sysctrl_r )
|
| 11 | | {
|
| 12 | | return 0;
|
| 13 | | }
|
| 14 | | |
| 15 | | WRITE64_HANDLER( dc_sysctrl_w )
|
| 16 | | {
|
| 17 | | mame_printf_verbose("SYSCTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 18 | | }
|
| 19 | | |
| 20 | | READ64_HANDLER( dc_maple_r )
|
| 21 | | {
|
| 22 | | return 0;
|
| 23 | | }
|
| 24 | | |
| 25 | | WRITE64_HANDLER( dc_maple_w )
|
| 26 | | {
|
| 27 | | mame_printf_verbose("MAPLE: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 28 | | }
|
| 29 | | |
| 30 | | READ64_HANDLER( dc_gdrom_r )
|
| 31 | | {
|
| 32 | | return 0;
|
| 33 | | }
|
| 34 | | |
| 35 | | WRITE64_HANDLER( dc_gdrom_w )
|
| 36 | | {
|
| 37 | | mame_printf_verbose("GDROM: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 38 | | }
|
| 39 | | |
| 40 | | READ64_HANDLER( dc_g1_ctrl_r )
|
| 41 | | {
|
| 42 | | return 0;
|
| 43 | | }
|
| 44 | | |
| 45 | | WRITE64_HANDLER( dc_g1_ctrl_w )
|
| 46 | | {
|
| 47 | | mame_printf_verbose("G1CTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 48 | | }
|
| 49 | | |
| 50 | | READ64_HANDLER( dc_g2_ctrl_r )
|
| 51 | | {
|
| 52 | | return 0;
|
| 53 | | }
|
| 54 | | |
| 55 | | WRITE64_HANDLER( dc_g2_ctrl_w )
|
| 56 | | {
|
| 57 | | mame_printf_verbose("G2CTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 58 | | }
|
| 59 | | |
| 60 | | READ64_HANDLER( dc_modem_r )
|
| 61 | | {
|
| 62 | | return 0;
|
| 63 | | }
|
| 64 | | |
| 65 | | WRITE64_HANDLER( dc_modem_w )
|
| 66 | | {
|
| 67 | | mame_printf_verbose("MODEM: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 68 | | }
|
| 69 | | |
| 70 | | READ64_HANDLER( dc_rtc_r )
|
| 71 | | {
|
| 72 | | return 0;
|
| 73 | | }
|
| 74 | | |
| 75 | | WRITE64_HANDLER( dc_rtc_w )
|
| 76 | | {
|
| 77 | | mame_printf_verbose("RTC: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 78 | | }
|
| 79 | | |
| 80 | | MACHINE_RESET( dc )
|
| 81 | | {
|
| 82 | | /* halt the ARM7 */
|
| 83 | | cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
|
| 84 | | }
|
| 85 | | |
| 86 | | READ64_HANDLER( dc_aica_reg_r )
|
| 87 | | {
|
| 88 | | return 0;
|
| 89 | | }
|
| 90 | | |
| 91 | | WRITE64_HANDLER( dc_aica_reg_w )
|
| 92 | | {
|
| 93 | | mame_printf_verbose("AICA REG: write %llx to %x, mask %llx\n", data, offset, mem_mask);
|
| 94 | | }
|
| 95 | | |
| 1 | /* |
| 2 | |
| 3 | dc.c - Sega Dreamcast hardware |
| 4 | |
| 5 | */ |
| 6 | |
| 7 | #include "driver.h" |
| 8 | #include "dc.h" |
| 9 | |
| 10 | READ64_HANDLER( dc_sysctrl_r ) |
| 11 | { |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | WRITE64_HANDLER( dc_sysctrl_w ) |
| 16 | { |
| 17 | mame_printf_verbose("SYSCTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 18 | } |
| 19 | |
| 20 | READ64_HANDLER( dc_maple_r ) |
| 21 | { |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | WRITE64_HANDLER( dc_maple_w ) |
| 26 | { |
| 27 | mame_printf_verbose("MAPLE: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 28 | } |
| 29 | |
| 30 | READ64_HANDLER( dc_gdrom_r ) |
| 31 | { |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | WRITE64_HANDLER( dc_gdrom_w ) |
| 36 | { |
| 37 | mame_printf_verbose("GDROM: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 38 | } |
| 39 | |
| 40 | READ64_HANDLER( dc_g1_ctrl_r ) |
| 41 | { |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | WRITE64_HANDLER( dc_g1_ctrl_w ) |
| 46 | { |
| 47 | mame_printf_verbose("G1CTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 48 | } |
| 49 | |
| 50 | READ64_HANDLER( dc_g2_ctrl_r ) |
| 51 | { |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | WRITE64_HANDLER( dc_g2_ctrl_w ) |
| 56 | { |
| 57 | mame_printf_verbose("G2CTRL: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 58 | } |
| 59 | |
| 60 | READ64_HANDLER( dc_modem_r ) |
| 61 | { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | WRITE64_HANDLER( dc_modem_w ) |
| 66 | { |
| 67 | mame_printf_verbose("MODEM: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 68 | } |
| 69 | |
| 70 | READ64_HANDLER( dc_rtc_r ) |
| 71 | { |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | WRITE64_HANDLER( dc_rtc_w ) |
| 76 | { |
| 77 | mame_printf_verbose("RTC: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 78 | } |
| 79 | |
| 80 | MACHINE_RESET( dc ) |
| 81 | { |
| 82 | /* halt the ARM7 */ |
| 83 | cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE); |
| 84 | } |
| 85 | |
| 86 | READ64_HANDLER( dc_aica_reg_r ) |
| 87 | { |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | WRITE64_HANDLER( dc_aica_reg_w ) |
| 92 | { |
| 93 | mame_printf_verbose("AICA REG: write %llx to %x, mask %llx\n", data, offset, mem_mask); |
| 94 | } |
| 95 | |
src/mess/video/dl1416.c
| r784 | r785 | |
| 1 | | /*****************************************************************************
|
| 2 | | *
|
| 3 | | * video/dl1416.c
|
| 4 | | *
|
| 5 | | * DL1416
|
| 6 | | *
|
| 7 | | * 4-Digit 16-Segment Alphanumeric Intelligent Display
|
| 8 | | * with Memory/Decoder/Driver
|
| 9 | | *
|
| 10 | | * Notes:
|
| 11 | | * - Currently supports the DL1416T.
|
| 12 | | * - Partial support for DL1416B is available, it just needs the right
|
| 13 | | * character set and MAME core support for its display.
|
| 14 | | * - Cursor support is implemented but not tested, as the AIM65 does not
|
| 15 | | * seem to use it.
|
| 16 | | *
|
| 17 | | * Todo:
|
| 18 | | * - Is the DL1416A identical to the DL1416T? If not, we need to add
|
| 19 | | * support for it.
|
| 20 | | *
|
| 21 | | * Changes:
|
| 22 | | * - 2007-07-30: Initial version. [Dirk Best]
|
| 23 | | *
|
| 24 | | * **************************************************************************/
|
| 25 | | |
| 26 | | |
| 27 | | /*****************************************************************************
|
| 28 | | Includes
|
| 29 | | *****************************************************************************/
|
| 30 | | |
| 31 | | |
| 32 | | #include "dl1416.h"
|
| 33 | | |
| 34 | | |
| 35 | | |
| 36 | | /*****************************************************************************
|
| 37 | | Macros
|
| 38 | | *****************************************************************************/
|
| 39 | | |
| 40 | | |
| 41 | | #define MAX_DL1416 (5)
|
| 42 | | |
| 43 | | #define SEG_UNDEF (-1)
|
| 44 | | #define SEG_BLANK (0)
|
| 45 | | #define SEG_CURSOR (0xffff)
|
| 46 | | |
| 47 | | |
| 48 | | |
| 49 | | /*****************************************************************************
|
| 50 | | Type definitions
|
| 51 | | *****************************************************************************/
|
| 52 | | |
| 53 | | /* DL1416 chip state */
|
| 54 | | typedef struct _dl1416_state dl1416_state;
|
| 55 | | |
| 56 | | struct _dl1416_state
|
| 57 | | {
|
| 58 | | const dl1416_interface *intf;
|
| 59 | | |
| 60 | | int write_enable;
|
| 61 | | int chip_enable;
|
| 62 | | int cursor_enable;
|
| 63 | | |
| 64 | | UINT16 cursor_ram[4];
|
| 65 | | };
|
| 66 | | |
| 67 | | |
| 68 | | |
| 69 | | /*****************************************************************************
|
| 70 | | Global variables
|
| 71 | | *****************************************************************************/
|
| 72 | | |
| 73 | | |
| 74 | | /* We use the following order for the segments:
|
| 75 | | *
|
| 76 | | * 000 111
|
| 77 | | * 7D A E2
|
| 78 | | * 7 D A E 2
|
| 79 | | * 7 DAE 2
|
| 80 | | * 888 999
|
| 81 | | * 6 CBF 3
|
| 82 | | * 6 C B F 3
|
| 83 | | * 6C B F3
|
| 84 | | * 555 444
|
| 85 | | */
|
| 86 | | |
| 87 | | /* Character set DL1416T */
|
| 88 | | static const int dl1416t_segments[128] = {
|
| 89 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 90 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 91 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 92 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 93 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 94 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 95 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 96 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 97 | | 0x0000, 0x2421, 0x0480, 0x0f3c, /* ! " # */
|
| 98 | | 0x0fbb, 0x5f99, 0xa579, 0x4000, /* $ % & ' */
|
| 99 | | 0xc000, 0x3000, 0xff00, 0x0f00, /* ( ) * + */
|
| 100 | | 0x1000, 0x0300, 0x0020, 0x5000, /* , - . / */
|
| 101 | | 0x0ce1, 0x0c00, 0x0561, 0x0d21, /* 0 1 2 3 */
|
| 102 | | 0x0d80, 0x09a1, 0x09e1, 0x0c01, /* 4 5 6 7 */
|
| 103 | | 0x0de1, 0x0da1, 0x0021, 0x1001, /* 8 9 : ; */
|
| 104 | | 0x5030, 0x0330, 0xa030, 0x0a07, /* < = > ? */
|
| 105 | | 0x097f, 0x03cf, 0x0e3f, 0x00f3, /* @ A B C */
|
| 106 | | 0x0c3f, 0x01f3, 0x01c3, 0x02fb, /* D E F G */
|
| 107 | | 0x03cc, 0x0c33, 0x0c63, 0xc1c0, /* H I J K */
|
| 108 | | 0x00f0, 0x60cc, 0xa0cc, 0x00ff, /* L M N O */
|
| 109 | | 0x03c7, 0x80ff, 0x83c7, 0x03bb, /* P Q R S */
|
| 110 | | 0x0c03, 0x00fc, 0x50c0, 0x90cc, /* T U V W */
|
| 111 | | 0xf000, 0x6800, 0x5033, 0x00e1, /* X Y Z [ */
|
| 112 | | 0xa000, 0x001e, 0x9000, 0x0030, /* \ ] ^ _ */
|
| 113 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 114 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 115 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 116 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 117 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 118 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 119 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
| 120 | | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF /* undefined */
|
| 121 | | };
|
| 122 | | |
| 123 | | |
| 124 | | static dl1416_state dl1416[MAX_DL1416];
|
| 125 | | |
| 126 | | |
| 127 | | |
| 128 | | /*****************************************************************************
|
| 129 | | Implementation
|
| 130 | | *****************************************************************************/
|
| 131 | | |
| 132 | | /* Config */
|
| 133 | | void dl1416_config(int which, const dl1416_interface *intf)
|
| 134 | | {
|
| 135 | | assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call dl1416_config at init time!");
|
| 136 | | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!");
|
| 137 | | |
| 138 | | dl1416[which].intf = intf;
|
| 139 | | |
| 140 | | state_save_register_item("dl1416", which, dl1416[which].chip_enable);
|
| 141 | | state_save_register_item("dl1416", which, dl1416[which].cursor_enable);
|
| 142 | | state_save_register_item("dl1416", which, dl1416[which].write_enable);
|
| 143 | | state_save_register_item_array("dl1416", which, dl1416[which].cursor_ram);
|
| 144 | | }
|
| 145 | | |
| 146 | | |
| 147 | | /* Reset */
|
| 148 | | void dl1416_reset(int which)
|
| 149 | | {
|
| 150 | | int i;
|
| 151 | | |
| 152 | | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!");
|
| 153 | | |
| 154 | | /* Disable all lines */
|
| 155 | | dl1416[which].chip_enable = FALSE;
|
| 156 | | dl1416[which].write_enable = FALSE;
|
| 157 | | dl1416[which].cursor_enable = FALSE;
|
| 158 | | |
| 159 | | /* Randomize cursor memory */
|
| 160 | | for (i = 0; i < 4; i++)
|
| 161 | | dl1416[which].cursor_ram[i] = mame_rand(Machine);
|
| 162 | | }
|
| 163 | | |
| 164 | | |
| 165 | | /* Write enable, active low */
|
| 166 | | void dl1416_set_input_w(int which, int data)
|
| 167 | | {
|
| 168 | | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!");
|
| 169 | | dl1416[which].write_enable = !data;
|
| 170 | | }
|
| 171 | | |
| 172 | | |
| 173 | | /* Chip enable, active low */
|
| 174 | | void dl1416_set_input_ce(int which, int data)
|
| 175 | | {
|
| 176 | | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!");
|
| 177 | | dl1416[which].chip_enable = !data;
|
| 178 | | }
|
| 179 | | |
| 180 | | |
| 181 | | /* Cursor enable, active low */
|
| 182 | | void dl1416_set_input_cu(int which, int data)
|
| 183 | | {
|
| 184 | | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!");
|
| 185 | | dl1416[which].cursor_enable = !data;
|
| 186 | | }
|
| 187 | | |
| 188 | | |
| 189 | | /* Data */
|
| 190 | | void dl1416_write(int which, offs_t offset, UINT8 data)
|
| 191 | | {
|
| 192 | | int i, digit;
|
| 193 | | |
| 194 | | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!");
|
| 195 | | |
| 196 | | offset &= 0x03; /* A0-A1 */
|
| 197 | | data &= 0x7f; /* D0-D6 */
|
| 198 | | |
| 199 | | /* Only try to update the data if we are enabled and write is enabled */
|
| 200 | | if (dl1416[which].chip_enable && dl1416[which].write_enable)
|
| 201 | | {
|
| 202 | | if (dl1416[which].cursor_enable)
|
| 203 | | {
|
| 204 | | switch (dl1416[which].intf->type)
|
| 205 | | {
|
| 206 | | |
| 207 | | case DL1416B:
|
| 208 | | |
| 209 | | /* The cursor will be set if D0 is high and the original */
|
| 210 | | /* character restored otherwise */
|
| 211 | | digit = data & 1 ? SEG_CURSOR : dl1416[which].cursor_ram[offset];
|
| 212 | | |
| 213 | | /* Call update function */
|
| 214 | | dl1416[which].intf->digit_changed(offset, digit);
|
| 215 | | |
| 216 | | break;
|
| 217 | | |
| 218 | | case DL1416T:
|
| 219 | | |
| 220 | | for (i = 0; i < 4; i++)
|
| 221 | | {
|
| 222 | | /* Save old digit */
|
| 223 | | int previous_digit = dl1416[which].cursor_ram[i];
|
| 224 | | |
| 225 | | /* Either set the cursor or restore the original character */
|
| 226 | | digit = data & i ? SEG_CURSOR : dl1416[which].cursor_ram[i];
|
| 227 | | |
| 228 | | /* Call update function if we changed something */
|
| 229 | | if (previous_digit != digit)
|
| 230 | | dl1416[which].intf->digit_changed(i, digit);
|
| 231 | | }
|
| 232 | | break;
|
| 233 | | |
| 234 | | }
|
| 235 | | }
|
| 236 | | else
|
| 237 | | {
|
| 238 | | /* On the DL1416T, a digit can only be changed if there is no */
|
| 239 | | /* previously stored cursor, or overriden by an undefined */
|
| 240 | | /* character (blank) */
|
| 241 | | if ((dl1416[which].intf->type != DL1416T) || (
|
| 242 | | (dl1416[which].cursor_ram[offset] != SEG_CURSOR) ||
|
| 243 | | (dl1416t_segments[data] == SEG_UNDEF)))
|
| 244 | | {
|
| 245 | | /* Load data */
|
| 246 | | digit = dl1416t_segments[data];
|
| 247 | | |
| 248 | | /* Undefined characters are replaced by blanks */
|
| 249 | | if (digit == SEG_UNDEF)
|
| 250 | | digit = SEG_BLANK;
|
| 251 | | |
| 252 | | /* Save value */
|
| 253 | | dl1416[which].cursor_ram[offset] = digit;
|
| 254 | | |
| 255 | | /* Call update function */
|
| 256 | | dl1416[which].intf->digit_changed(offset, digit);
|
| 257 | | }
|
| 258 | | }
|
| 259 | | }
|
| 260 | | }
|
| 261 | | |
| 262 | | |
| 263 | | /* Standard handlers */
|
| 264 | | WRITE8_HANDLER( dl1416_0_w ) { dl1416_write(0, offset, data); }
|
| 265 | | WRITE8_HANDLER( dl1416_1_w ) { dl1416_write(1, offset, data); }
|
| 266 | | WRITE8_HANDLER( dl1416_2_w ) { dl1416_write(2, offset, data); }
|
| 267 | | WRITE8_HANDLER( dl1416_3_w ) { dl1416_write(3, offset, data); }
|
| 268 | | WRITE8_HANDLER( dl1416_4_w ) { dl1416_write(4, offset, data); }
|
| 1 | /***************************************************************************** |
| 2 | * |
| 3 | * video/dl1416.c |
| 4 | * |
| 5 | * DL1416 |
| 6 | * |
| 7 | * 4-Digit 16-Segment Alphanumeric Intelligent Display |
| 8 | * with Memory/Decoder/Driver |
| 9 | * |
| 10 | * Notes: |
| 11 | * - Currently supports the DL1416T. |
| 12 | * - Partial support for DL1416B is available, it just needs the right |
| 13 | * character set and MAME core support for its display. |
| 14 | * - Cursor support is implemented but not tested, as the AIM65 does not |
| 15 | * seem to use it. |
| 16 | * |
| 17 | * Todo: |
| 18 | * - Is the DL1416A identical to the DL1416T? If not, we need to add |
| 19 | * support for it. |
| 20 | * |
| 21 | * Changes: |
| 22 | * - 2007-07-30: Initial version. [Dirk Best] |
| 23 | * |
| 24 | * **************************************************************************/ |
| 25 | |
| 26 | |
| 27 | /***************************************************************************** |
| 28 | Includes |
| 29 | *****************************************************************************/ |
| 30 | |
| 31 | |
| 32 | #include "dl1416.h" |
| 33 | |
| 34 | |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | Macros |
| 38 | *****************************************************************************/ |
| 39 | |
| 40 | |
| 41 | #define MAX_DL1416 (5) |
| 42 | |
| 43 | #define SEG_UNDEF (-1) |
| 44 | #define SEG_BLANK (0) |
| 45 | #define SEG_CURSOR (0xffff) |
| 46 | |
| 47 | |
| 48 | |
| 49 | /***************************************************************************** |
| 50 | Type definitions |
| 51 | *****************************************************************************/ |
| 52 | |
| 53 | /* DL1416 chip state */ |
| 54 | typedef struct _dl1416_state dl1416_state; |
| 55 | |
| 56 | struct _dl1416_state |
| 57 | { |
| 58 | const dl1416_interface *intf; |
| 59 | |
| 60 | int write_enable; |
| 61 | int chip_enable; |
| 62 | int cursor_enable; |
| 63 | |
| 64 | UINT16 cursor_ram[4]; |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | |
| 69 | /***************************************************************************** |
| 70 | Global variables |
| 71 | *****************************************************************************/ |
| 72 | |
| 73 | |
| 74 | /* We use the following order for the segments: |
| 75 | * |
| 76 | * 000 111 |
| 77 | * 7D A E2 |
| 78 | * 7 D A E 2 |
| 79 | * 7 DAE 2 |
| 80 | * 888 999 |
| 81 | * 6 CBF 3 |
| 82 | * 6 C B F 3 |
| 83 | * 6C B F3 |
| 84 | * 555 444 |
| 85 | */ |
| 86 | |
| 87 | /* Character set DL1416T */ |
| 88 | static const int dl1416t_segments[128] = { |
| 89 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 90 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 91 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 92 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 93 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 94 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 95 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 96 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 97 | 0x0000, 0x2421, 0x0480, 0x0f3c, /* ! " # */ |
| 98 | 0x0fbb, 0x5f99, 0xa579, 0x4000, /* $ % & ' */ |
| 99 | 0xc000, 0x3000, 0xff00, 0x0f00, /* ( ) * + */ |
| 100 | 0x1000, 0x0300, 0x0020, 0x5000, /* , - . / */ |
| 101 | 0x0ce1, 0x0c00, 0x0561, 0x0d21, /* 0 1 2 3 */ |
| 102 | 0x0d80, 0x09a1, 0x09e1, 0x0c01, /* 4 5 6 7 */ |
| 103 | 0x0de1, 0x0da1, 0x0021, 0x1001, /* 8 9 : ; */ |
| 104 | 0x5030, 0x0330, 0xa030, 0x0a07, /* < = > ? */ |
| 105 | 0x097f, 0x03cf, 0x0e3f, 0x00f3, /* @ A B C */ |
| 106 | 0x0c3f, 0x01f3, 0x01c3, 0x02fb, /* D E F G */ |
| 107 | 0x03cc, 0x0c33, 0x0c63, 0xc1c0, /* H I J K */ |
| 108 | 0x00f0, 0x60cc, 0xa0cc, 0x00ff, /* L M N O */ |
| 109 | 0x03c7, 0x80ff, 0x83c7, 0x03bb, /* P Q R S */ |
| 110 | 0x0c03, 0x00fc, 0x50c0, 0x90cc, /* T U V W */ |
| 111 | 0xf000, 0x6800, 0x5033, 0x00e1, /* X Y Z [ */ |
| 112 | 0xa000, 0x001e, 0x9000, 0x0030, /* \ ] ^ _ */ |
| 113 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 114 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 115 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 116 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 117 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 118 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 119 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ |
| 120 | SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF /* undefined */ |
| 121 | }; |
| 122 | |
| 123 | |
| 124 | static dl1416_state dl1416[MAX_DL1416]; |
| 125 | |
| 126 | |
| 127 | |
| 128 | /***************************************************************************** |
| 129 | Implementation |
| 130 | *****************************************************************************/ |
| 131 | |
| 132 | /* Config */ |
| 133 | void dl1416_config(int which, const dl1416_interface *intf) |
| 134 | { |
| 135 | assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call dl1416_config at init time!"); |
| 136 | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!"); |
| 137 | |
| 138 | dl1416[which].intf = intf; |
| 139 | |
| 140 | state_save_register_item("dl1416", which, dl1416[which].chip_enable); |
| 141 | state_save_register_item("dl1416", which, dl1416[which].cursor_enable); |
| 142 | state_save_register_item("dl1416", which, dl1416[which].write_enable); |
| 143 | state_save_register_item_array("dl1416", which, dl1416[which].cursor_ram); |
| 144 | } |
| 145 | |
| 146 | |
| 147 | /* Reset */ |
| 148 | void dl1416_reset(int which) |
| 149 | { |
| 150 | int i; |
| 151 | |
| 152 | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!"); |
| 153 | |
| 154 | /* Disable all lines */ |
| 155 | dl1416[which].chip_enable = FALSE; |
| 156 | dl1416[which].write_enable = FALSE; |
| 157 | dl1416[which].cursor_enable = FALSE; |
| 158 | |
| 159 | /* Randomize cursor memory */ |
| 160 | for (i = 0; i < 4; i++) |
| 161 | dl1416[which].cursor_ram[i] = mame_rand(Machine); |
| 162 | } |
| 163 | |
| 164 | |
| 165 | /* Write enable, active low */ |
| 166 | void dl1416_set_input_w(int which, int data) |
| 167 | { |
| 168 | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!"); |
| 169 | dl1416[which].write_enable = !data; |
| 170 | } |
| 171 | |
| 172 | |
| 173 | /* Chip enable, active low */ |
| 174 | void dl1416_set_input_ce(int which, int data) |
| 175 | { |
| 176 | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!"); |
| 177 | dl1416[which].chip_enable = !data; |
| 178 | } |
| 179 | |
| 180 | |
| 181 | /* Cursor enable, active low */ |
| 182 | void dl1416_set_input_cu(int which, int data) |
| 183 | { |
| 184 | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!"); |
| 185 | dl1416[which].cursor_enable = !data; |
| 186 | } |
| 187 | |
| 188 | |
| 189 | /* Data */ |
| 190 | void dl1416_write(int which, offs_t offset, UINT8 data) |
| 191 | { |
| 192 | int i, digit; |
| 193 | |
| 194 | assert_always(which < MAX_DL1416, "'which' exceeds maximum number of configured DL1416s!"); |
| 195 | |
| 196 | offset &= 0x03; /* A0-A1 */ |
| 197 | data &= 0x7f; /* D0-D6 */ |
| 198 | |
| 199 | /* Only try to update the data if we are enabled and write is enabled */ |
| 200 | if (dl1416[which].chip_enable && dl1416[which].write_enable) |
| 201 | { |
| 202 | if (dl1416[which].cursor_enable) |
| 203 | { |
| 204 | switch (dl1416[which].intf->type) |
| 205 | { |
| 206 | |
| 207 | case DL1416B: |
| 208 | |
| 209 | /* The cursor will be set if D0 is high and the original */ |
| 210 | /* character restored otherwise */ |
| 211 | digit = data & 1 ? SEG_CURSOR : dl1416[which].cursor_ram[offset]; |
| 212 | |
| 213 | /* Call update function */ |
| 214 | dl1416[which].intf->digit_changed(offset, digit); |
| 215 | |
| 216 | break; |
| 217 | |
| 218 | case DL1416T: |
| 219 | |
| 220 | for (i = 0; i < 4; i++) |
| 221 | { |
| 222 | /* Save old digit */ |
| 223 | int previous_digit = dl1416[which].cursor_ram[i]; |
| 224 | |
| 225 | /* Either set the cursor or restore the original character */ |
| 226 | digit = data & i ? SEG_CURSOR : dl1416[which].cursor_ram[i]; |
| 227 | |
| 228 | /* Call update function if we changed something */ |
| 229 | if (previous_digit != digit) |
| 230 | dl1416[which].intf->digit_changed(i, digit); |
| 231 | } |
| 232 | break; |
| 233 | |
| 234 | } |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | /* On the DL1416T, a digit can only be changed if there is no */ |
| 239 | /* previously stored cursor, or overriden by an undefined */ |
| 240 | /* character (blank) */ |
| 241 | if ((dl1416[which].intf->type != DL1416T) || ( |
| 242 | (dl1416[which].cursor_ram[offset] != SEG_CURSOR) || |
| 243 | (dl1416t_segments[data] == SEG_UNDEF))) |
| 244 | { |
| 245 | /* Load data */ |
| 246 | digit = dl1416t_segments[data]; |
| 247 | |
| 248 | /* Undefined characters are replaced by blanks */ |
| 249 | if (digit == SEG_UNDEF) |
| 250 | digit = SEG_BLANK; |
| 251 | |
| 252 | /* Save value */ |
| 253 | dl1416[which].cursor_ram[offset] = digit; |
| 254 | |
| 255 | /* Call update function */ |
| 256 | dl1416[which].intf->digit_changed(offset, digit); |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | |
| 263 | /* Standard handlers */ |
| 264 | WRITE8_HANDLER( dl1416_0_w ) { dl1416_write(0, offset, data); } |
| 265 | WRITE8_HANDLER( dl1416_1_w ) { dl1416_write(1, offset, data); } |
| 266 | WRITE8_HANDLER( dl1416_2_w ) { dl1416_write(2, offset, data); } |
| 267 | WRITE8_HANDLER( dl1416_3_w ) { dl1416_write(3, offset, data); } |
| 268 | WRITE8_HANDLER( dl1416_4_w ) { dl1416_write(4, offset, data); } |
src/mess/layout/aim65.lay
| r784 | r785 | |
| 1 | | <!-- aim65.lay -->
|
| 2 | | |
| 3 | | <!-- 2007-07-30: Initial version. [Dirk Best] -->
|
| 4 | | |
| 5 | | <mamelayout version="2">
|
| 6 | | |
| 7 | | <element name="digit" defstate="0">
|
| 8 | | <led16seg>
|
| 9 | | <!-- Note: Peak wavelength of the DL1416 chips = 660 nm -->
|
| 10 | | <color red="1.0" green="0.0" blue="0.0" />
|
| 11 | | </led16seg>
|
| 12 | | </element>
|
| 13 | | |
| 14 | | <element name="background">
|
| 15 | | <rect>
|
| 16 | | <bounds left="0" top="0" right="1" bottom="1" />
|
| 17 | | <color red="0.0" green="0.0" blue="0.0" />
|
| 18 | | </rect>
|
| 19 | | </element>
|
| 20 | | |
| 21 | | <view name="Default">
|
| 22 | | |
| 23 | | <!-- Black background -->
|
| 24 | | <bezel element="background">
|
| 25 | | <bounds left="0" top="0" right="803" bottom="328" />
|
| 26 | | </bezel>
|
| 27 | | |
| 28 | | <!-- DL1416A DS1 -->
|
| 29 | | <bezel name="digit0" element="digit">
|
| 30 | | <bounds left="65" top="70" right="90" bottom="120" />
|
| 31 | | </bezel>
|
| 32 | | <bezel name="digit1" element="digit">
|
| 33 | | <bounds left="99" top="70" right="124" bottom="120" />
|
| 34 | | </bezel>
|
| 35 | | <bezel name="digit2" element="digit">
|
| 36 | | <bounds left="133" top="70" right="158" bottom="120" />
|
| 37 | | </bezel>
|
| 38 | | <bezel name="digit3" element="digit">
|
| 39 | | <bounds left="167" top="70" right="192" bottom="120" />
|
| 40 | | </bezel>
|
| 41 | | |
| 42 | | <!-- DL1416A DS2 -->
|
| 43 | | <bezel name="digit4" element="digit">
|
| 44 | | <bounds left="204" top="70" right="229" bottom="120" />
|
| 45 | | </bezel>
|
| 46 | | <bezel name="digit5" element="digit">
|
| 47 | | <bounds left="238" top="70" right="263" bottom="120" />
|
| 48 | | </bezel>
|
| 49 | | <bezel name="digit6" element="digit">
|
| 50 | | <bounds left="272" top="70" right="297" bottom="120" />
|
| 51 | | </bezel>
|
| 52 | | <bezel name="digit7" element="digit">
|
| 53 | | <bounds left="306" top="70" right="331" bottom="120" />
|
| 54 | | </bezel>
|
| 55 | | |
| 56 | | <!-- DL1416A DS3 -->
|
| 57 | | <bezel name="digit8" element="digit">
|
| 58 | | <bounds left="343" top="70" right="368" bottom="120" />
|
| 59 | | </bezel>
|
| 60 | | <bezel name="digit9" element="digit">
|
| 61 | | <bounds left="377" top="70" right="402" bottom="120" />
|
| 62 | | </bezel>
|
| 63 | | <bezel name="digit10" element="digit">
|
| 64 | | <bounds left="411" top="70" right="436" bottom="120" />
|
| 65 | | </bezel>
|
| 66 | | <bezel name="digit11" element="digit">
|
| 67 | | <bounds left="445" top="70" right="470" bottom="120" />
|
| 68 | | </bezel>
|
| 69 | | |
| 70 | | <!-- DL1416A DS4 -->
|
| 71 | | <bezel name="digit12" element="digit">
|
| 72 | | <bounds left="482" top="70" right="507" bottom="120" />
|
| 73 | | </bezel>
|
| 74 | | <bezel name="digit13" element="digit">
|
| 75 | | <bounds left="516" top="70" right="541" bottom="120" />
|
| 76 | | </bezel>
|
| 77 | | <bezel name="digit14" element="digit">
|
| 78 | | <bounds left="550" top="70" right="575" bottom="120" />
|
| 79 | | </bezel>
|
| 80 | | <bezel name="digit15" element="digit">
|
| 81 | | <bounds left="584" top="70" right="609" bottom="120" />
|
| 82 | | </bezel>
|
| 83 | | |
| 84 | | <!-- DL1416A DS5 -->
|
| 85 | | <bezel name="digit16" element="digit">
|
| 86 | | <bounds left="621" top="70" right="646" bottom="120" />
|
| 87 | | </bezel>
|
| 88 | | <bezel name="digit17" element="digit">
|
| 89 | | <bounds left="655" top="70" right="680" bottom="120" />
|
| 90 | | </bezel>
|
| 91 | | <bezel name="digit18" element="digit">
|
| 92 | | <bounds left="689" top="70" right="714" bottom="120" />
|
| 93 | | </bezel>
|
| 94 | | <bezel name="digit19" element="digit">
|
| 95 | | <bounds left="723" top="70" right="748" bottom="120" />
|
| 96 | | </bezel>
|
| 97 | | |
| 98 | | </view>
|
| 99 | | |
| 100 | | </mamelayout>
|
| 1 | <!-- aim65.lay --> |
| 2 | |
| 3 | <!-- 2007-07-30: Initial version. [Dirk Best] --> |
| 4 | |
| 5 | <mamelayout version="2"> |
| 6 | |
| 7 | <element name="digit" defstate="0"> |
| 8 | <led16seg> |
| 9 | <!-- Note: Peak wavelength of the DL1416 chips = 660 nm --> |
| 10 | <color red="1.0" green="0.0" blue="0.0" /> |
| 11 | </led16seg> |
| 12 | </element> |
| 13 | |
| 14 | <element name="background"> |
| 15 | <rect> |
| 16 | <bounds left="0" top="0" right="1" bottom="1" /> |
| 17 | <color red="0.0" green="0.0" blue="0.0" /> |
| 18 | </rect> |
| 19 | </element> |
| 20 | |
| 21 | <view name="Default"> |
| 22 | |
| 23 | <!-- Black background --> |
| 24 | <bezel element="background"> |
| 25 | <bounds left="0" top="0" right="803" bottom="328" /> |
| 26 | </bezel> |
| 27 | |
| 28 | <!-- DL1416A DS1 --> |
| 29 | <bezel name="digit0" element="digit"> |
| 30 | <bounds left="65" top="70" right="90" bottom="120" /> |
| 31 | </bezel> |
| 32 | <bezel name="digit1" element="digit"> |
| 33 | <bounds left="99" top="70" right="124" bottom="120" /> |
| 34 | </bezel> |
| 35 | <bezel name="digit2" element="digit"> |
| 36 | <bounds left="133" top="70" right="158" bottom="120" /> |
| 37 | </bezel> |
| 38 | <bezel name="digit3" element="digit"> |
| 39 | <bounds left="167" top="70" right="192" bottom="120" /> |
| 40 | </bezel> |
| 41 | |
| 42 | <!-- DL1416A DS2 --> |
| 43 | <bezel name="digit4" element="digit"> |
| 44 | <bounds left="204" top="70" right="229" bottom="120" /> |
| 45 | </bezel> |
| 46 | <bezel name="digit5" element="digit"> |
| 47 | <bounds left="238" top="70" right="263" bottom="120" /> |
| 48 | </bezel> |
| 49 | <bezel name="digit6" element="digit"> |
| 50 | <bounds left="272" top="70" right="297" bottom="120" /> |
| 51 | </bezel> |
| 52 | <bezel name="digit7" element="digit"> |
| 53 | <bounds left="306" top="70" right="331" bottom="120" /> |
| 54 | </bezel> |
| 55 | |
| 56 | <!-- DL1416A DS3 --> |
| 57 | <bezel name="digit8" element="digit"> |
| 58 | <bounds left="343" top="70" right="368" bottom="120" /> |
| 59 | </bezel> |
| 60 | <bezel name="digit9" element="digit"> |
| 61 | <bounds left="377" top="70" right="402" bottom="120" /> |
| 62 | </bezel> |
| 63 | <bezel name="digit10" element="digit"> |
| 64 | <bounds left="411" top="70" right="436" bottom="120" /> |
| 65 | </bezel> |
| 66 | <bezel name="digit11" element="digit"> |
| 67 | <bounds left="445" top="70" right="470" bottom="120" /> |
| 68 | </bezel> |
| 69 | |
| 70 | <!-- DL1416A DS4 --> |
| 71 | <bezel name="digit12" element="digit"> |
| 72 | <bounds left="482" top="70" right="507" bottom="120" /> |
| 73 | </bezel> |
| 74 | <bezel name="digit13" element="digit"> |
| 75 | <bounds left="516" top="70" right="541" bottom="120" /> |
| 76 | </bezel> |
| 77 | <bezel name="digit14" element="digit"> |
| 78 | <bounds left="550" top="70" right="575" bottom="120" /> |
| 79 | </bezel> |
| 80 | <bezel name="digit15" element="digit"> |
| 81 | <bounds left="584" top="70" right="609" bottom="120" /> |
| 82 | </bezel> |
| 83 | |
| 84 | <!-- DL1416A DS5 --> |
| 85 | <bezel name="digit16" element="digit"> |
| 86 | <bounds left="621" top="70" right="646" bottom="120" /> |
| 87 | </bezel> |
| 88 | <bezel name="digit17" element="digit"> |
| 89 | <bounds left="655" top="70" right="680" bottom="120" /> |
| 90 | </bezel> |
| 91 | <bezel name="digit18" element="digit"> |
| 92 | <bounds left="689" top="70" right="714" bottom="120" /> |
| 93 | </bezel> |
| 94 | <bezel name="digit19" element="digit"> |
| 95 | <bounds left="723" top="70" right="748" bottom="120" /> |
| 96 | </bezel> |
| 97 | |
| 98 | </view> |
| 99 | |
| 100 | </mamelayout> |