src/mess/machine/74145.c
| r0 | r1406 | |
| 1 | /*****************************************************************************
|
| 2 | *
|
| 3 | * machine/74145.h
|
| 4 | *
|
| 5 | * BCD-to-Decimal decoder
|
| 6 | * |
| 7 | * __ __
|
| 8 | * 0-| v |-VCC
|
| 9 | * 1-| |-A
|
| 10 | * 2-| |-B
|
| 11 | * 3-| |-C
|
| 12 | * 4-| |-D
|
| 13 | * 5-| |-9
|
| 14 | * 6-| |-8
|
| 15 | * GND-|_____|-7
|
| 16 | *
|
| 17 | * |
| 18 | * Truth table
|
| 19 | * _______________________________
|
| 20 | * | Inputs | Outputs |
|
| 21 | * | D C B A | 0 1 2 3 4 5 6 7 8 9 |
|
| 22 | * |-------------------------------|
|
| 23 | * | L L L L | L H H H H H H H H H |
|
| 24 | * | L L L H | H L H H H H H H H H |
|
| 25 | * | L L H L | H H L H H H H H H H |
|
| 26 | * | L L H H | H H H L H H H H H H |
|
| 27 | * | L H L L | H H H H L H H H H H |
|
| 28 | * |-------------------------------|
|
| 29 | * | L H L H | H H H H H L H H H H |
|
| 30 | * | L H H L | H H H H H H L H H H |
|
| 31 | * | L H H H | H H H H H H H L H H |
|
| 32 | * | H L L L | H H H H H H H H L H |
|
| 33 | * | H L L H | H H H H H H H H H L |
|
| 34 | * |-------------------------------|
|
| 35 | * | H L H L | H H H H H H H H H H |
|
| 36 | * | H L H H | H H H H H H H H H H |
|
| 37 | * | H H L L | H H H H H H H H H H |
|
| 38 | * | H H L H | H H H H H H H H H H |
|
| 39 | * | H H H L | H H H H H H H H H H |
|
| 40 | * | H H H H | H H H H H H H H H H |
|
| 41 | * -------------------------------
|
| 42 | * |
| 43 | ****************************************************************************/
|
| 44 | |
| 45 | #include "74145.h"
|
| 46 | |
| 47 | |
| 48 | |
| 49 | /*****************************************************************************
|
| 50 | Macros
|
| 51 | *****************************************************************************/
|
| 52 | |
| 53 | |
| 54 | #define MAX_74145 (1)
|
| 55 | |
| 56 | |
| 57 | |
| 58 | /*****************************************************************************
|
| 59 | Type definitions
|
| 60 | *****************************************************************************/
|
| 61 | |
| 62 | |
| 63 | typedef struct _ttl74145_state ttl74145_state;
|
| 64 | struct _ttl74145_state
|
| 65 | {
|
| 66 | UINT16 number;
|
| 67 | };
|
| 68 | |
| 69 | |
| 70 | |
| 71 | /*****************************************************************************
|
| 72 | Global variables
|
| 73 | *****************************************************************************/
|
| 74 | |
| 75 | |
| 76 | static ttl74145_state ttl74145[MAX_74145];
|
| 77 | |
| 78 | |
| 79 | |
| 80 | /*****************************************************************************
|
| 81 | Implementation
|
| 82 | *****************************************************************************/
|
| 83 | |
| 84 | |
| 85 | /* Reset */
|
| 86 | void ttl74145_reset(int which)
|
| 87 | {
|
| 88 | ttl74145[which].number = 0;
|
| 89 | }
|
| 90 | |
| 91 | |
| 92 | /* Data Write */
|
| 93 | void ttl74145_write(int which, offs_t offset, UINT8 data)
|
| 94 | {
|
| 95 | ttl74145[which].number = bcd_2_dec(data & 0x0f);
|
| 96 | }
|
| 97 | |
| 98 | |
| 99 | int ttl74145_output_0(int which) { return ttl74145[which].number == 0; }
|
| 100 | int ttl74145_output_1(int which) { return ttl74145[which].number == 1; }
|
| 101 | int ttl74145_output_2(int which) { return ttl74145[which].number == 2; }
|
| 102 | int ttl74145_output_3(int which) { return ttl74145[which].number == 3; }
|
| 103 | int ttl74145_output_4(int which) { return ttl74145[which].number == 4; }
|
| 104 | int ttl74145_output_5(int which) { return ttl74145[which].number == 5; }
|
| 105 | int ttl74145_output_6(int which) { return ttl74145[which].number == 6; }
|
| 106 | int ttl74145_output_7(int which) { return ttl74145[which].number == 7; }
|
| 107 | int ttl74145_output_8(int which) { return ttl74145[which].number == 8; }
|
| 108 | int ttl74145_output_9(int which) { return ttl74145[which].number == 9; }
|
| 109 | |
| 110 | |
| 111 | WRITE8_HANDLER( ttl74145_0_w ) { ttl74145_write(0, offset, data); }
|
src/mess/machine/sym1.c
| r1405 | r1406 | |
| 16 | 16 | /* Peripheral chips */ |
| 17 | 17 | #include "machine/6522via.h" |
| 18 | 18 | #include "machine/6532riot.h" |
| 19 | #include "machine/74145.h" |
| 20 | #include "sound/speaker.h" |
| 19 | 21 | |
| 20 | 22 | |
| 21 | 23 | static UINT8 riot_port_a, riot_port_b; |
| 22 | | static UINT8 sym1_led[6]; |
| 24 | emu_timer *led_update; |
| 23 | 25 | |
| 24 | 26 | |
| 25 | | |
| 26 | 27 | /****************************************************************************** |
| 27 | 28 | 6532 RIOT |
| 28 | 29 | ******************************************************************************/ |
| 29 | 30 | |
| 30 | 31 | |
| 31 | | /* |
| 32 | | 8903 7segment display output, key pressed |
| 33 | | 892c keyboard input only ???? |
| 34 | | */ |
| 32 | static TIMER_CALLBACK( led_refresh ) |
| 33 | { |
| 34 | /* update digits depending on the status of the output lines */ |
| 35 | if (ttl74145_output_0(0)) output_set_digit_value(0, riot_port_a); |
| 36 | if (ttl74145_output_1(0)) output_set_digit_value(1, riot_port_a); |
| 37 | if (ttl74145_output_2(0)) output_set_digit_value(2, riot_port_a); |
| 38 | if (ttl74145_output_3(0)) output_set_digit_value(3, riot_port_a); |
| 39 | if (ttl74145_output_4(0)) output_set_digit_value(4, riot_port_a); |
| 40 | if (ttl74145_output_5(0)) output_set_digit_value(5, riot_port_a); |
| 41 | } |
| 35 | 42 | |
| 36 | 43 | |
| 44 | static void sym1_led_w(void) |
| 45 | { |
| 46 | timer_adjust(led_update, ATTOTIME_IN_USEC(70), 0, attotime_never); |
| 47 | } |
| 48 | |
| 49 | |
| 37 | 50 | static READ8_HANDLER( sym1_riot_a_r ) |
| 38 | 51 | { |
| 39 | 52 | int data = 0xff; |
| r1405 | r1406 | |
| 80 | 93 | } |
| 81 | 94 | |
| 82 | 95 | |
| 83 | | static void sym1_led_w(void) |
| 96 | static WRITE8_HANDLER( sym1_riot_a_w ) |
| 84 | 97 | { |
| 85 | | if ((riot_port_b & 0x0f) < 6) |
| 86 | | { |
| 87 | | sym1_led[riot_port_b] |= riot_port_a; |
| 88 | | output_set_digit_value(riot_port_b & 0x07, sym1_led[riot_port_b]); |
| 89 | | } |
| 90 | | } |
| 98 | logerror("%x: riot_a_w 0x%02x\n", activecpu_get_pc(), data); |
| 91 | 99 | |
| 100 | /* save for later use */ |
| 101 | riot_port_a = data; |
| 92 | 102 | |
| 93 | | static WRITE8_HANDLER( sym1_riot_a_w ) |
| 94 | | { |
| 95 | | riot_port_a = data; |
| 96 | | logerror("riot_a_w 0x%02x\n", data); |
| 103 | /* refresh the leds */ |
| 97 | 104 | sym1_led_w(); |
| 98 | 105 | } |
| 99 | 106 | |
| 100 | 107 | |
| 101 | 108 | static WRITE8_HANDLER( sym1_riot_b_w ) |
| 102 | 109 | { |
| 110 | logerror("%x: riot_b_w 0x%02x\n", activecpu_get_pc(), data); |
| 111 | |
| 112 | /* save for later use */ |
| 103 | 113 | riot_port_b = data; |
| 104 | | logerror("riot_b_w 0x%02x\n", data); |
| 114 | |
| 115 | /* first 4 output pins are connected to the 74145 */ |
| 116 | ttl74145_0_w(0, data & 0x0f); |
| 117 | |
| 118 | /* speaker is connected to output 6 of the 74145 */ |
| 119 | speaker_level_w(0, ttl74145_output_6(0)); |
| 120 | |
| 121 | /* refresh the leds */ |
| 105 | 122 | sym1_led_w(); |
| 106 | 123 | } |
| 107 | 124 | |
| r1405 | r1406 | |
| 127 | 144 | } |
| 128 | 145 | |
| 129 | 146 | |
| 130 | | static struct via6522_interface via0 = |
| 147 | static READ8_HANDLER( sym1_via0_b_r ) |
| 131 | 148 | { |
| 132 | | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| 133 | | sym1_irq |
| 149 | return 0xff; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | static WRITE8_HANDLER( sym1_via0_b_w ) |
| 154 | { |
| 155 | logerror("%x: via0_b_w 0x%02x\n", activecpu_get_pc(), data); |
| 156 | } |
| 157 | |
| 158 | |
| 159 | /* PA0: Write protect R6532 RAM |
| 160 | * PA1: Write protect RAM 0x400-0x7ff |
| 161 | * PA2: Write protect RAM 0x800-0xbff |
| 162 | * PA3: Write protect RAM 0xc00-0xfff |
| 163 | */ |
| 164 | static WRITE8_HANDLER( sym1_via2_a_w ) |
| 165 | { |
| 166 | logerror("SYM1 VIA2 W 0x%02x\n", data); |
| 167 | |
| 168 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa600, 0xa67f, 0, 0, |
| 169 | ((readinputportbytag("WP") & 0x01) && !(data & 0x01)) ? MWA8_NOP : MWA8_BANK5); |
| 170 | |
| 171 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0400, 0x07ff, 0, 0, |
| 172 | ((readinputportbytag("WP") & 0x02) && !(data & 0x02)) ? MWA8_NOP : MWA8_BANK2); |
| 173 | |
| 174 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0bff, 0, 0, |
| 175 | ((readinputportbytag("WP") & 0x04) && !(data & 0x04)) ? MWA8_NOP : MWA8_BANK3); |
| 176 | |
| 177 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c00, 0x0fff, 0, 0, |
| 178 | ((readinputportbytag("WP") & 0x08) && !(data & 0x08)) ? MWA8_NOP : MWA8_BANK4); |
| 179 | } |
| 180 | |
| 181 | |
| 182 | static const struct via6522_interface via0 = |
| 183 | { |
| 184 | NULL, /* VIA Port A Input */ |
| 185 | sym1_via0_b_r, /* VIA Port B Input */ |
| 186 | NULL, /* VIA Port CA1 Input */ |
| 187 | NULL, /* VIA Port CB1 Input */ |
| 188 | NULL, /* VIA Port CA2 Input */ |
| 189 | NULL, /* VIA Port CB2 Input */ |
| 190 | NULL, /* VIA Port A Output */ |
| 191 | sym1_via0_b_w, /* VIA Port B Output */ |
| 192 | NULL, /* VIA Port CA1 Output */ |
| 193 | NULL, /* VIA Port CB1 Output */ |
| 194 | NULL, /* VIA Port CA2 Output */ |
| 195 | NULL, /* VIA Port CB2 Output */ |
| 196 | sym1_irq /* VIA IRQ Callback */ |
| 134 | 197 | }; |
| 135 | 198 | |
| 136 | 199 | |
| 137 | | static struct via6522_interface via1 = |
| 200 | static const struct via6522_interface via1 = |
| 138 | 201 | { |
| 139 | | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| 140 | | sym1_irq |
| 202 | NULL, /* VIA Port A Input */ |
| 203 | NULL, /* VIA Port B Input */ |
| 204 | NULL, /* VIA Port CA1 Input */ |
| 205 | NULL, /* VIA Port CB1 Input */ |
| 206 | NULL, /* VIA Port CA2 Input */ |
| 207 | NULL, /* VIA Port CB2 Input */ |
| 208 | NULL, /* VIA Port A Output */ |
| 209 | NULL, /* VIA Port B Output */ |
| 210 | NULL, /* VIA Port CA1 Output */ |
| 211 | NULL, /* VIA Port CB1 Output */ |
| 212 | NULL, /* VIA Port CA2 Output */ |
| 213 | NULL, /* VIA Port CB2 Output */ |
| 214 | sym1_irq /* VIA IRQ Callback */ |
| 141 | 215 | }; |
| 142 | 216 | |
| 143 | 217 | |
| 144 | | static struct via6522_interface via2 = |
| 218 | static const struct via6522_interface via2 = |
| 145 | 219 | { |
| 146 | | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| 147 | | sym1_irq |
| 220 | NULL, /* VIA Port A Input */ |
| 221 | NULL, /* VIA Port B Input */ |
| 222 | NULL, /* VIA Port CA1 Input */ |
| 223 | NULL, /* VIA Port CB1 Input */ |
| 224 | NULL, /* VIA Port CA2 Input */ |
| 225 | NULL, /* VIA Port CB2 Input */ |
| 226 | sym1_via2_a_w, /* VIA Port A Output */ |
| 227 | NULL, /* VIA Port B Output */ |
| 228 | NULL, /* VIA Port CA1 Output */ |
| 229 | NULL, /* VIA Port CB1 Output */ |
| 230 | NULL, /* VIA Port CA2 Output */ |
| 231 | NULL, /* VIA Port CB2 Output */ |
| 232 | sym1_irq /* VIA IRQ Callback */ |
| 148 | 233 | }; |
| 149 | 234 | |
| 150 | 235 | |
| r1405 | r1406 | |
| 156 | 241 | |
| 157 | 242 | DRIVER_INIT( sym1 ) |
| 158 | 243 | { |
| 159 | | /* install expansion memory */ |
| 160 | | if (mess_ram_size > 1024) |
| 244 | /* wipe expansion memory banks that are not installed */ |
| 245 | if (mess_ram_size < 4*1024) |
| 161 | 246 | { |
| 162 | 247 | memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, |
| 163 | | 0x0400, mess_ram_size - 1, 0, 0, MRA8_RAM, MWA8_RAM); |
| 248 | mess_ram_size, 0x0fff, 0, 0, MRA8_NOP, MWA8_NOP); |
| 164 | 249 | } |
| 165 | 250 | |
| 251 | /* configure vias and riot */ |
| 166 | 252 | via_config(0, &via0); |
| 167 | 253 | via_config(1, &via1); |
| 168 | 254 | via_config(2, &via2); |
| 169 | 255 | r6532_config(0, &r6532_interface); |
| 170 | 256 | r6532_set_clock(0, OSC_Y1); |
| 171 | 257 | r6532_reset(0); |
| 258 | |
| 259 | /* allocate a timer to refresh the led display */ |
| 260 | led_update = timer_alloc(led_refresh, NULL); |
| 172 | 261 | } |
| 173 | 262 | |
| 174 | 263 | |
| r1405 | r1406 | |
| 176 | 265 | { |
| 177 | 266 | via_reset(); |
| 178 | 267 | r6532_reset(0); |
| 268 | ttl74145_reset(0); |
| 179 | 269 | |
| 180 | | /* Make 0xf800 to 0xffff point to the last half of the monitor ROM */ |
| 181 | | /* so that the CPU can find its reset vectors */ |
| 270 | /* make 0xf800 to 0xffff point to the last half of the monitor ROM |
| 271 | so that the CPU can find its reset vectors */ |
| 182 | 272 | memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, |
| 183 | 273 | 0xf800, 0xffff, 0, 0, MRA8_BANK1, MWA8_ROM); |
| 184 | | memory_configure_bank(1, 0, 1, sym1_monitor + 0x800, 0); |
| 185 | | memory_set_bank(1, 0); |
| 274 | memory_set_bankptr(1, sym1_monitor + 0x800); |
| 186 | 275 | } |
src/mess/drivers/sym1.c
| r1405 | r1406 | |
| 14 | 14 | /* Peripheral chips */ |
| 15 | 15 | #include "machine/6532riot.h" |
| 16 | 16 | #include "machine/6522via.h" |
| 17 | | #include "sound/beep.h" |
| 18 | 17 | |
| 19 | 18 | /* Layout */ |
| 20 | 19 | #include "sym1.lh" |
| 21 | 20 | |
| 22 | 21 | |
| 22 | |
| 23 | /* pointers to memory locations */ |
| 23 | 24 | UINT8 *sym1_monitor; |
| 25 | UINT8 *sym1_ram_1k; |
| 26 | UINT8 *sym1_ram_2k; |
| 27 | UINT8 *sym1_ram_3k; |
| 28 | UINT8 *sym1_riot_ram; |
| 24 | 29 | |
| 25 | 30 | |
| 26 | 31 | |
| r1405 | r1406 | |
| 31 | 36 | |
| 32 | 37 | static ADDRESS_MAP_START( sym1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 33 | 38 | AM_RANGE(0x0000, 0x03ff) AM_RAM /* U12/U13 RAM */ |
| 39 | AM_RANGE(0x0400, 0x07ff) AM_RAM AM_RAMBANK(2) AM_BASE(&sym1_ram_1k) |
| 40 | AM_RANGE(0x0800, 0x0bff) AM_RAM AM_RAMBANK(3) AM_BASE(&sym1_ram_2k) |
| 41 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_RAMBANK(4) AM_BASE(&sym1_ram_3k) |
| 34 | 42 | AM_RANGE(0x8000, 0x8fff) AM_ROM AM_BASE(&sym1_monitor) /* U20 Monitor ROM */ |
| 35 | 43 | AM_RANGE(0xa000, 0xa00f) AM_READWRITE(via_0_r, via_0_w) /* U25 VIA #1 */ |
| 36 | 44 | AM_RANGE(0xa400, 0xa40f) AM_READWRITE(r6532_0_r, r6532_0_w) /* U27 RIOT */ |
| 37 | | AM_RANGE(0xa600, 0xa67f) AM_RAM /* U27 RIOT RAM */ |
| 45 | AM_RANGE(0xa600, 0xa67f) AM_RAM AM_RAMBANK(5) AM_BASE(&sym1_riot_ram) /* U27 RIOT RAM */ |
| 38 | 46 | AM_RANGE(0xa800, 0xa80f) AM_READWRITE(via_1_r, via_1_w) /* U28 VIA #2 */ |
| 39 | 47 | AM_RANGE(0xac00, 0xac0f) AM_READWRITE(via_2_r, via_2_w) /* U29 VIA #3 */ |
| 40 | 48 | ADDRESS_MAP_END |
| r1405 | r1406 | |
| 87 | 95 | PORT_START /* IN4 */ |
| 88 | 96 | PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("DEBUG OFF") PORT_CODE(KEYCODE_F6) |
| 89 | 97 | PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("DEBUG ON") PORT_CODE(KEYCODE_F7) |
| 98 | |
| 99 | PORT_START_TAG("WP") |
| 100 | PORT_DIPNAME(0x01, 0x01, "6532 RAM WP") |
| 101 | PORT_DIPSETTING(0x00, DEF_STR(Off)) |
| 102 | PORT_DIPSETTING(0x01, DEF_STR(On)) |
| 103 | PORT_DIPNAME(0x02, 0x02, "1K RAM WP") |
| 104 | PORT_DIPSETTING(0x00, DEF_STR(Off)) |
| 105 | PORT_DIPSETTING(0x02, DEF_STR(On)) |
| 106 | PORT_DIPNAME(0x04, 0x04, "2K RAM WP") |
| 107 | PORT_DIPSETTING(0x00, DEF_STR(Off)) |
| 108 | PORT_DIPSETTING(0x04, DEF_STR(On)) |
| 109 | PORT_DIPNAME(0x08, 0x08, "3K RAM WP") |
| 110 | PORT_DIPSETTING(0x00, DEF_STR(Off)) |
| 111 | PORT_DIPSETTING(0x08, DEF_STR(On)) |
| 90 | 112 | INPUT_PORTS_END |
| 91 | 113 | |
| 92 | 114 | |
| r1405 | r1406 | |
| 109 | 131 | |
| 110 | 132 | /* sound hardware */ |
| 111 | 133 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 112 | | MDRV_SOUND_ADD(BEEP, 0) |
| 134 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 113 | 135 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 114 | 136 | MACHINE_DRIVER_END |
| 115 | 137 | |
| r1405 | r1406 | |
| 160 | 182 | |
| 161 | 183 | |
| 162 | 184 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 163 | | COMP( 1978, sym1, 0, 0, sym1, sym1, sym1, sym1, "Synertek Systems Corp.", "SYM-1/SY-VIM-1", GAME_NOT_WORKING ) |
| 185 | COMP( 1978, sym1, 0, 0, sym1, sym1, sym1, sym1, "Synertek Systems Corp.", "SYM-1/SY-VIM-1", 0 ) |