Previous 15994 Revisions Next

r1406 Thursday 13th December, 2007 at 17:07:50 UTC by Dirk Best
[SYM1] Better LED support, memory write protect support and added speaker emulation. System is now marked as working.
[docs]messnew.txt
[src/mess]mess.mak
[src/mess/drivers]sym1.c
[src/mess/machine]74145.c* 74145.h* sym1.c

src/mess/machine/74145.c
r0r1406
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 
63typedef struct _ttl74145_state ttl74145_state;
64struct _ttl74145_state
65{
66   UINT16 number;
67};
68 
69 
70 
71/*****************************************************************************
72 Global variables
73*****************************************************************************/
74 
75 
76static ttl74145_state ttl74145[MAX_74145];
77 
78 
79 
80/*****************************************************************************
81 Implementation
82*****************************************************************************/
83 
84 
85/* Reset */
86void ttl74145_reset(int which)
87{
88   ttl74145[which].number = 0;
89}
90 
91 
92/* Data Write */
93void ttl74145_write(int which, offs_t offset, UINT8 data)
94{
95   ttl74145[which].number = bcd_2_dec(data & 0x0f);
96}
97 
98 
99int ttl74145_output_0(int which) { return ttl74145[which].number == 0; }
100int ttl74145_output_1(int which) { return ttl74145[which].number == 1; }
101int ttl74145_output_2(int which) { return ttl74145[which].number == 2; }
102int ttl74145_output_3(int which) { return ttl74145[which].number == 3; }
103int ttl74145_output_4(int which) { return ttl74145[which].number == 4; }
104int ttl74145_output_5(int which) { return ttl74145[which].number == 5; }
105int ttl74145_output_6(int which) { return ttl74145[which].number == 6; }
106int ttl74145_output_7(int which) { return ttl74145[which].number == 7; }
107int ttl74145_output_8(int which) { return ttl74145[which].number == 8; }
108int ttl74145_output_9(int which) { return ttl74145[which].number == 9; }
109 
110 
111WRITE8_HANDLER( ttl74145_0_w ) { ttl74145_write(0, offset, data); }
src/mess/machine/74145.h
r0r1406
1/*****************************************************************************
2 *
3 * machine/74145.h
4 *
5 ****************************************************************************/
6 
7#ifndef TTL74145_H_
8#define TTL74145_H_
9 
10#include "driver.h"
11 
12/* Configuration */
13void ttl74145_reset(int which);
14 
15/* Output pin states */
16int ttl74145_output_0(int which);
17int ttl74145_output_1(int which);
18int ttl74145_output_2(int which);
19int ttl74145_output_3(int which);
20int ttl74145_output_4(int which);
21int ttl74145_output_5(int which);
22int ttl74145_output_6(int which);
23int ttl74145_output_7(int which);
24int ttl74145_output_8(int which);
25int ttl74145_output_9(int which);
26 
27/* Standard handlers */
28WRITE8_HANDLER( ttl74145_0_w );
29 
30#endif /*TTL74145_H_*/
src/mess/machine/sym1.c
r1405r1406
1616/* Peripheral chips */
1717#include "machine/6522via.h"
1818#include "machine/6532riot.h"
19#include "machine/74145.h"
20#include "sound/speaker.h"
1921
2022
2123static UINT8 riot_port_a, riot_port_b;
22static UINT8 sym1_led[6];
24emu_timer *led_update;
2325
2426
25
2627/******************************************************************************
2728 6532 RIOT
2829******************************************************************************/
2930
3031
31/*
32  8903 7segment display output, key pressed
33  892c keyboard input only ????
34*/
32static 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}
3542
3643
44static void sym1_led_w(void)
45{
46   timer_adjust(led_update, ATTOTIME_IN_USEC(70), 0, attotime_never);
47}
48
49
3750static READ8_HANDLER( sym1_riot_a_r )
3851{
3952   int data = 0xff;
r1405r1406
8093}
8194
8295
83static void sym1_led_w(void)
96static WRITE8_HANDLER( sym1_riot_a_w )
8497{
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);
9199
100   /* save for later use */
101   riot_port_a = data;
92102
93static 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 */
97104   sym1_led_w();
98105}
99106
100107
101108static WRITE8_HANDLER( sym1_riot_b_w )
102109{
110   logerror("%x: riot_b_w 0x%02x\n", activecpu_get_pc(), data);
111
112   /* save for later use */
103113   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 */
105122   sym1_led_w();
106123}
107124
r1405r1406
127144}
128145
129146
130static struct via6522_interface via0 =
147static READ8_HANDLER( sym1_via0_b_r )
131148{
132   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
133   sym1_irq
149   return 0xff;
150}
151
152
153static 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 */
164static 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
182static 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 */
134197};
135198
136199
137static struct via6522_interface via1 =
200static const struct via6522_interface via1 =
138201{
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 */
141215};
142216
143217
144static struct via6522_interface via2 =
218static const struct via6522_interface via2 =
145219{
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 */
148233};
149234
150235
r1405r1406
156241
157242DRIVER_INIT( sym1 )
158243{
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)
161246   {
162247      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);
164249   }
165250
251   /* configure vias and riot */
166252   via_config(0, &via0);
167253   via_config(1, &via1);
168254   via_config(2, &via2);
169255   r6532_config(0, &r6532_interface);
170256   r6532_set_clock(0, OSC_Y1);
171257   r6532_reset(0);
258   
259   /* allocate a timer to refresh the led display */
260   led_update = timer_alloc(led_refresh, NULL);
172261}
173262
174263
r1405r1406
176265{
177266   via_reset();
178267   r6532_reset(0);
268   ttl74145_reset(0);
179269
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 */
182272   memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
183273         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);
186275}
src/mess/mess.mak
r1405r1406
442442   $(MESS_MACHINE)/tc8521.o   \
443443   $(MESS_VIDEO)/crtc6845.o   \
444444   $(MESS_MACHINE)/rriot.o    \
445   $(MESS_MACHINE)/74145.o    \
445446   $(MESS_MACHINE)/uart8250.o \
446447   $(MESS_MACHINE)/pc_mouse.o \
447448   $(MESS_MACHINE)/pclpt.o    \
src/mess/drivers/sym1.c
r1405r1406
1414/* Peripheral chips */
1515#include "machine/6532riot.h"
1616#include "machine/6522via.h"
17#include "sound/beep.h"
1817
1918/* Layout */
2019#include "sym1.lh"
2120
2221
22
23/* pointers to memory locations */
2324UINT8 *sym1_monitor;
25UINT8 *sym1_ram_1k;
26UINT8 *sym1_ram_2k;
27UINT8 *sym1_ram_3k;
28UINT8 *sym1_riot_ram;
2429
2530
2631
r1405r1406
3136
3237static ADDRESS_MAP_START( sym1_map, ADDRESS_SPACE_PROGRAM, 8 )
3338   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)
3442   AM_RANGE(0x8000, 0x8fff) AM_ROM AM_BASE(&sym1_monitor)       /* U20 Monitor ROM */
3543   AM_RANGE(0xa000, 0xa00f) AM_READWRITE(via_0_r, via_0_w)      /* U25 VIA #1 */
3644   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 */
3846   AM_RANGE(0xa800, 0xa80f) AM_READWRITE(via_1_r, via_1_w)      /* U28 VIA #2 */
3947   AM_RANGE(0xac00, 0xac0f) AM_READWRITE(via_2_r, via_2_w)      /* U29 VIA #3 */
4048ADDRESS_MAP_END
r1405r1406
8795   PORT_START         /* IN4 */
8896   PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("DEBUG OFF") PORT_CODE(KEYCODE_F6)
8997   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))
90112INPUT_PORTS_END
91113
92114
r1405r1406
109131
110132   /* sound hardware */
111133   MDRV_SPEAKER_STANDARD_MONO("mono")
112   MDRV_SOUND_ADD(BEEP, 0)
134   MDRV_SOUND_ADD(SPEAKER, 0)
113135   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
114136MACHINE_DRIVER_END
115137
r1405r1406
160182
161183
162184/*    YEAR  NAME  PARENT COMPAT MACHINE INPUT INIT  CONFIG COMPANY                   FULLNAME          FLAGS */
163COMP( 1978, sym1, 0,     0,     sym1,   sym1, sym1, sym1,  "Synertek Systems Corp.", "SYM-1/SY-VIM-1", GAME_NOT_WORKING )
185COMP( 1978, sym1, 0,     0,     sym1,   sym1, sym1, sym1,  "Synertek Systems Corp.", "SYM-1/SY-VIM-1", 0 )
docs/messnew.txt
r1405r1406
1818
1919- [SYM1] Fixed bug #1442.  [Dirk Best]
2020
21- [SYM1] Better LED support, memory write protect support and added speaker
22  emulation. System is now marked as working.  [Dirk Best]
23
2124- [TI99] Fixed fatal regressions introduced a few releases ago.  [Michael Zapf]
2225
2326- [X68000] Improved video timing.  [Barry Rodewald]
r1405r1406
4447
4548- Changed spacing between natural keyboard key names.  [Nate Woods]
4649
50- Added a general 74145 BCD-to-decimal decoder emulation, currently used
51  by the SYM-1 driver.  [Dirk Best]
4752
4853
54
49550.121
5056
5157New System Drivers Supported (in no particular order):

Previous 15994 Revisions Next


© 1998-2018 The MESS Team