Previous 15994 Revisions Next

r3470 Sunday 19th October, 2008 at 16:52:58 UTC by Curt Coder
[ABC80X] Converted to use timer devices.
[ABC77] Changed clock signal direction.
[ABC802] Fixed flash clock signal, separated video to own file.
[ABC806] Fixed flash clock signal, partially implemented vsync delay.
[src/mess]mess.mak
[src/mess/drivers]abc80x.c
[src/mess/includes]abc80x.h
[src/mess/machine]abc77.c abc77.h
[src/mess/video]abc800.c* abc802.c* abc806.c abc80x.c

src/mess/video/abc800.c
r0r3470
1/*****************************************************************************
2 *
3 * video/abc800.c
4 *
5 ****************************************************************************/
6 
7/*
8 
9   TODO:
10 
11   - add proper screen parameters to startup
12   - abc800m high resolution (HR)
13   - abc800c row update
14   - abc800c palette
15   - abc800c high resolution (HR)
16 
17*/
18 
19#include "driver.h"
20#include "includes/abc80x.h"
21#include "machine/z80dart.h"
22#include "video/mc6845.h"
23 
24/* Palette Initialization */
25 
26static PALETTE_INIT( abc800m )
27{
28   palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black
29   palette_set_color_rgb(machine, 1, 0xff, 0xff, 0x00); // yellow (really white, but blue signal is disconnected from monitor)
30}
31 
32static PALETTE_INIT( abc800c )
33{
34   palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black
35   palette_set_color_rgb(machine, 1, 0x00, 0x00, 0xff); // blue
36   palette_set_color_rgb(machine, 2, 0xff, 0x00, 0x00); // red
37   palette_set_color_rgb(machine, 3, 0xff, 0x00, 0xff); // magenta
38   palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green
39   palette_set_color_rgb(machine, 5, 0x00, 0xff, 0xff); // cyan
40   palette_set_color_rgb(machine, 6, 0xff, 0xff, 0x00); // yellow
41   palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white
42}
43 
44/* External Interface */
45 
46WRITE8_HANDLER( abc800m_hrs_w )
47{
48}
49 
50WRITE8_HANDLER( abc800m_hrc_w )
51{
52}
53 
54WRITE8_HANDLER( abc800c_hrs_w )
55{
56}
57 
58WRITE8_HANDLER( abc800c_hrc_w )
59{
60}
61 
62/* MC6845 Row Update */
63 
64static MC6845_UPDATE_ROW( abc800m_update_row )
65{
66   abc800_state *state = device->machine->driver_data;
67 
68   int column;
69 
70   for (column = 0; column < x_count; column++)
71   {
72      int bit;
73 
74      UINT16 address = (videoram[(ma + column) & 0x7ff] << 4) | (ra & 0x0f);
75      UINT8 data = (state->char_rom[address & 0x7ff] & 0x3f);
76 
77      if (column == cursor_x)
78      {
79         data = 0x3f;
80      }
81 
82      data <<= 2;
83 
84      for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++)
85      {
86         int x = (column * ABC800_CHAR_WIDTH) + bit;
87         int color = BIT(data, 7);
88 
89         *BITMAP_ADDR16(bitmap, y, x) = color;
90 
91         data <<= 1;
92      }
93   }
94}
95 
96static MC6845_ON_VSYNC_CHANGED(abc800_vsync_changed)
97{
98   abc800_state *state = device->machine->driver_data;
99 
100   z80dart_set_ri(state->z80dart, 1, vsync);
101}
102 
103static MC6845_UPDATE_ROW( abc800c_update_row )
104{
105}
106 
107/* MC6845 Interfaces */
108 
109static const mc6845_interface abc800m_mc6845_interface = {
110   SCREEN_TAG,
111   ABC800_CCLK,
112   ABC800_CHAR_WIDTH,
113   NULL,
114   abc800m_update_row,
115   NULL,
116   NULL,
117   NULL,
118   abc800_vsync_changed
119};
120 
121static const mc6845_interface abc800c_mc6845_interface = {
122   SCREEN_TAG,
123   ABC800_CCLK,
124   ABC800_CHAR_WIDTH,
125   NULL,
126   abc800c_update_row,
127   NULL,
128   NULL,
129   NULL,
130   abc800_vsync_changed
131};
132 
133/* Video Start */
134 
135static VIDEO_START( abc800 )
136{
137   abc800_state *state = machine->driver_data;
138 
139   /* find devices */
140 
141   state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG);
142 
143   /* find memory regions */
144 
145   state->char_rom = memory_region(machine, "chargen");
146}
147 
148/* Video Update */
149 
150static VIDEO_UPDATE( abc800m )
151{
152   abc800_state *state = screen->machine->driver_data;
153   
154   mc6845_update(state->mc6845, bitmap, cliprect);
155   
156   return 0;
157}
158 
159static VIDEO_UPDATE( abc800c )
160{
161   abc800_state *state = screen->machine->driver_data;
162   
163   mc6845_update(state->mc6845, bitmap, cliprect);
164   
165   return 0;
166}
167 
168/* Machine Drivers */
169 
170MACHINE_DRIVER_START( abc800m_video )
171   // device interface
172   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
173   MDRV_DEVICE_CONFIG(abc800m_mc6845_interface)
174 
175   // video hardware
176   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
177   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
178 
179   MDRV_SCREEN_REFRESH_RATE(60)
180   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
181   MDRV_SCREEN_SIZE(640, 400)
182   MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
183 
184   MDRV_PALETTE_LENGTH(2)
185 
186   MDRV_PALETTE_INIT(abc800m)
187   MDRV_VIDEO_START(abc800)
188   MDRV_VIDEO_UPDATE(abc800m)
189MACHINE_DRIVER_END
190 
191MACHINE_DRIVER_START( abc800c_video )
192   // device interface
193   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
194   MDRV_DEVICE_CONFIG(abc800c_mc6845_interface)
195 
196   // video hardware
197   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
198   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
199 
200   MDRV_SCREEN_REFRESH_RATE(60)
201   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
202   MDRV_SCREEN_SIZE(640, 400)
203   MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
204 
205   MDRV_PALETTE_LENGTH(2)
206 
207   MDRV_PALETTE_INIT(abc800c)
208   MDRV_VIDEO_START(abc800)
209   MDRV_VIDEO_UPDATE(abc800c)
210MACHINE_DRIVER_END
src/mess/video/abc80x.c
r3469r3470
161161{
162162}
163163
164/* Timer Callbacks */
165
166static TIMER_CALLBACK( abc802_flash_tick )
167{
168   abc802_state *state = machine->driver_data;
169
170   state->flshclk = !state->flshclk;
171}
172
173164/* MC6845 Row Update */
174165
175166static MC6845_UPDATE_ROW( abc800m_update_row )
r3469r3470
311302{
312303   abc802_state *state = device->machine->driver_data;
313304
305   state->flshclk_ctr++;
306
307   if (state->flshclk_ctr == 31)
308   {
309      state->flshclk = 1;
310      state->flshclk_ctr = 0;
311   }
312   else
313   {
314      state->flshclk = 0;
315   }
316
314317   z80dart_set_ri(state->z80dart, 1, vsync);
315318}
316319
r3469r3470
360363
361364   /* find devices */
362365
363   state->mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG);
366   state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG);
364367
365368   /* find memory regions */
366369
r3469r3470
373376
374377   /* find devices */
375378
376   state->mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG);
379   state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG);
377380
378381   /* find memory regions */
379382
380383   state->char_rom = memory_region(machine, "chargen");
381384
382   /* allocate timer */
383
384   state->flash_timer = timer_alloc(abc802_flash_tick, NULL);
385   timer_adjust_periodic(state->flash_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2));
386
387385   /* register for state saving */
388386
387   state_save_register_global(state->flshclk_ctr);
389388   state_save_register_global(state->flshclk);
390389   state_save_register_global(state->mux80_40);
391390}
src/mess/video/abc802.c
r0r3470
1/*****************************************************************************
2 *
3 * video/abc802.c
4 *
5 ****************************************************************************/
6 
7/*
8 
9   TODO:
10 
11   - add proper screen parameters to startup
12   - abc802 delay CUR and DEN by 3 CCLK's
13 
14*/
15 
16/*
17 
18   ABC 802 Video
19   *************
20 
21   74LS166 @ 8B
22   ------------
23 
24   A   <-   ATTHAND INV
25   B   <-   ATTHAND INV
26   C   <-   ATTHAND O0
27   D   <-   ATTHAND O1
28   E   <-   CHARGEN A2
29   F   <-   CHARGEN A3
30   G   <-   CHARGEN A4
31   H   <-   CHARGEN A5
32 
33   SI   <-   ATTHAND RI
34 
35   CHARGEN @ 3G
36   ------------
37 
38   A0   <-   CRTC RA0
39   A1   <-   CRTC RA1
40   A2   <-   CRTC RA2
41   A3   <-   CRTC RA3
42   A4   <-   TX DATA 0
43   A5   <-   TX DATA 1
44   A6   <-   TX DATA 2
45   A7   <-   TX DATA 3
46   A8   <-   TX DATA 4
47   A9   <-   TX DATA 5
48   A10   <-   TX DATA 6
49   A11   <-   ATTHAND RG
50   A12   <-   TX DATA 7
51 
52   D0   ->   ATTHAND AT0
53   D1   ->   ATTHAND AT1
54   D2   ->   74LS166 E
55   D3   ->   74LS166 F
56   D4   ->   74LS166 G
57   D5   ->   74LS166 H
58   D6   ->   ATTHAND ATD
59   D7   ->   ATTHAND ATE
60 
61   Notes:
62 
63   - lines A0 thru A3 are pulled high when cursor is enabled
64 
65   ATTHAND @ 2G
66   ------------
67 
68   AT0   <-   CHARGEN D0
69   AT1   <-   CHARGEN D1
70   ATD   <-   CHARGEN D6
71   ATE   <-   CHARGEN D7
72   CUR   <-   CUR-3
73   FC   <-   FLSHCLK
74   IHS   <-   HS
75   LL   <-   74LS166 L
76 
77   O0   ->   74LS166 C
78   O1   ->   74LS166 D
79   RG   ->   CHARGEN A11
80   RI   ->   74LS166 SI
81   INV   ->   74LS166 A, 74LS166 B
82   O   ->
83 
84   PAL equation:
85 
86   IF (VCC)   *OS     =   FC + RF / RC
87            *RG:  =   HS / *RG + *ATE / *RG + ATD / *RG + LL /
88                  *RG + AT1 / *RG + AT0 / ATE + *ATD + *LL +
89                  *AT1 + *AT0
90            *RI:  =   *RI + *INV / *RI + LL / *INV + *LL
91            *RF:  =   HS / *RF + *ATE / *RF + ATD / *RF + LL /
92                  *RF + AT1 / *RF + AT0 / ATE + *ATD + *LL +
93                  *AT1 + AT0
94            *RC:  =   HS / *RC + *ATE / *RC + *ATD / *RC + LL /
95                  *RC + *ATI / *RC + AT0 / ATE + *LL + *AT1 +
96                  *AT0
97   IF (VCC)   *O0     =   *CUR + *AT0 / *CUR + ATE
98            *O1   =   *CUR + *AT1 / *CUR + ATE
99 
100 
101   ATD      Attribute data
102   ATE      Attribute enable
103   AT0,AT1   Attribute address
104   CUR      Cursor
105   FC      FLSH clock
106   HS      Horizontal sync
107   INV      Inverted signal input
108   LL      Load when Low
109   OEL      Output Enable when Low
110   RC
111   RF      Row flash
112   RG      Row graphic
113   RI      Row inverted
114 
115*/
116 
117#include "driver.h"
118#include "includes/abc80x.h"
119#include "machine/z80dart.h"
120#include "video/mc6845.h"
121 
122/* MC6845 Row Update */
123 
124static MC6845_UPDATE_ROW( abc802_update_row )
125{
126   abc802_state *state = device->machine->driver_data;
127 
128   int column;
129 
130   for (column = 0; column < x_count; column++)
131   {
132      int bit;
133 
134      UINT8 code = videoram[(ma + column) & 0x7ff];
135      UINT16 address = ((code & 0x80) << 5) | ((code & 0x7f) << 4);
136      UINT8 ra_latch = ra;
137      UINT8 data;
138 
139      if (column == cursor_x)
140      {
141         ra_latch = 0x0f;
142      }
143 
144      data = state->char_rom[(address + ra_latch) & 0x1fff];
145 
146      if (data & ABC802_ATE)
147      {
148         int rf = 0, rc = 0;
149 
150         if (data & ABC802_ATD)
151         {
152            int attr = data & 0x03;
153 
154            switch (attr)
155            {
156            case 0x00:
157               // RG = 1
158               address |= 0x800;
159               break;
160 
161            case 0x01:
162               rf = 1;
163               break;
164 
165            case 0x02:
166               rc = 1;
167               break;
168 
169            case 0x03:
170               // undefined
171               break;
172            }
173 
174            if ((state->flshclk && rf) || rc)
175            {
176               ra_latch = 0x0e;
177            }
178         }
179 
180         // reload data and mask out two bottom bits
181         data = state->char_rom[(address + ra_latch) & 0x1fff] & 0xfc;
182      }
183       
184      data <<= 2;
185 
186      if (state->mux80_40)
187      {
188         for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++)
189         {
190            int x = (column * ABC800_CHAR_WIDTH) + bit;
191            int color = BIT(data, 7) ^ BIT(code, 7);
192 
193            *BITMAP_ADDR16(bitmap, y, x) = color;
194 
195            data <<= 1;
196         }
197      }
198      else
199      {
200         for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++)
201         {
202            int x = (column * ABC800_CHAR_WIDTH) + (bit << 1);
203            int color = BIT(data, 7) ^ BIT(code, 7);
204 
205            *BITMAP_ADDR16(bitmap, y, x) = color;
206            *BITMAP_ADDR16(bitmap, y, x + 1) = color;
207 
208            data <<= 1;
209         }
210 
211         column++;
212      }
213   }
214}
215 
216static MC6845_ON_VSYNC_CHANGED(abc802_vsync_changed)
217{
218   abc802_state *state = device->machine->driver_data;
219 
220   if (!vsync)
221   {
222      /* flash clock */
223      if (state->flshclk_ctr == 31)
224      {
225         state->flshclk = 1;
226         state->flshclk_ctr = 0;
227      }
228      else
229      {
230         state->flshclk = 0;
231         state->flshclk_ctr++;
232      }
233   }
234 
235   z80dart_set_ri(state->z80dart, 1, vsync);
236}
237 
238/* MC6845 Interfaces */
239 
240static const mc6845_interface abc802_mc6845_interface = {
241   SCREEN_TAG,
242   ABC800_CCLK,
243   ABC800_CHAR_WIDTH,
244   NULL,
245   abc802_update_row,
246   NULL,
247   NULL,
248   NULL,
249   abc802_vsync_changed
250};
251 
252/* Video Start */
253 
254static VIDEO_START( abc802 )
255{
256   abc802_state *state = machine->driver_data;
257 
258   /* find devices */
259 
260   state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG);
261 
262   /* find memory regions */
263 
264   state->char_rom = memory_region(machine, "chargen");
265 
266   /* register for state saving */
267 
268   state_save_register_global(state->flshclk_ctr);
269   state_save_register_global(state->flshclk);
270   state_save_register_global(state->mux80_40);
271}
272 
273/* Video Update */
274 
275static VIDEO_UPDATE( abc802 )
276{
277   abc802_state *state = screen->machine->driver_data;
278   
279   mc6845_update(state->mc6845, bitmap, cliprect);
280   
281   return 0;
282}
283 
284/* Machine Drivers */
285 
286MACHINE_DRIVER_START( abc802_video )
287   // device interface
288   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
289   MDRV_DEVICE_CONFIG(abc802_mc6845_interface)
290 
291   // video hardware
292   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
293   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
294 
295   MDRV_SCREEN_REFRESH_RATE(60)
296   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
297   MDRV_SCREEN_SIZE(640, 400)
298   MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
299 
300   MDRV_PALETTE_LENGTH(2)
301 
302   MDRV_PALETTE_INIT(black_and_white)
303   MDRV_VIDEO_START(abc802)
304   MDRV_VIDEO_UPDATE(abc802)
305MACHINE_DRIVER_END
src/mess/video/abc806.c
r3469r3470
1111   - selection between 512x240, 256x240, and 240x240 HR modes
1212   - add proper screen parameters to startup
1313   - palette configuration from PAL/PROM
14   - vertical sync delay
14   - vertical sync delay in picture
1515   - horizontal positioning of the text and HR screens
1616   - protection device @ 16H
1717   
r3469r3470
3737   palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white
3838}
3939
40/* Timer Callbacks */
41
42static TIMER_CALLBACK( abc806_flash_tick )
43{
44   abc806_state *state = machine->driver_data;
45
46   state->flshclk = !state->flshclk;
47}
48
4940/* High Resolution Screen Select */
5041
5142WRITE8_HANDLER( abc806_hrs_w )
r3469r3470
348339{
349340   abc806_state *state = device->machine->driver_data;
350341
342   int vsync;
343
351344   if (!hsync)
352345   {
353346      state->v50_addr++;
347
348      /* clock current vsync value into the shift register */
349      state->vsync_shift <<= 1;
350      state->vsync_shift = (state->vsync_shift & 0xfffffffffffffffell) | state->vsync;
351
352      vsync = BIT(state->vsync_shift, state->sync);
353
354      if (vsync)
355      {
356         /* clear V50 address */
357         state->v50_addr = 0;
358      }
359      else
360      {
361         /* flash clock */
362         if (state->flshclk_ctr == 31)
363         {
364            state->flshclk = 1;
365            state->flshclk_ctr = 0;
366         }
367         else
368         {
369            state->flshclk = 0;
370            state->flshclk_ctr++;
371         }
372      }
373
374      /* _DEW signal to DART */
375      z80dart_set_ri(state->z80dart, 1, vsync);
354376   }
355377}
356378
357379static MC6845_ON_VSYNC_CHANGED(abc806_vsync_changed)
358380{
359381   abc806_state *state = device->machine->driver_data;
360   
361   if (vsync)
362   {
363      state->v50_addr = 0;
364   }
365382
366   z80dart_set_ri(state->z80dart, 1, vsync);
383   state->vsync = vsync;
367384}
368385
369386/* MC6845 Interfaces */
r3469r3470
462479
463480   /* find devices */
464481
465   state->mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG);
482   state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG);
466483
467484   /* find memory regions */
468485
r3469r3470
475492   state->charram = auto_malloc(ABC806_CHAR_RAM_SIZE);
476493   state->colorram = auto_malloc(ABC806_ATTR_RAM_SIZE);
477494
478   /* allocate timer */
479
480   state->flash_timer = timer_alloc(abc806_flash_tick, NULL);
481   timer_adjust_periodic(state->flash_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2));
482
483495   /* register for state saving */
484496
485497   state_save_register_global_pointer(state->charram, ABC806_CHAR_RAM_SIZE);
r3469r3470
494506   state_save_register_global(state->eme);
495507   state_save_register_global(state->txoff);
496508   state_save_register_global(state->_40);
509   state_save_register_global(state->flshclk_ctr);
497510   state_save_register_global(state->flshclk);
498511   state_save_register_global(state->hru2_a8);
512   state_save_register_global(state->vsync_shift);
513   state_save_register_global(state->vsync);
499514}
500515
501516/* Video Update */
src/mess/includes/abc80x.h
r3469r3470
3737   /* keyboard state */
3838   int abc77_txd;         /* ABC-77 transmit data */
3939
40   /* timers */
41   emu_timer *ctc_timer;
42
4340   /* devices */
4441   const device_config *z80ctc;
4542   const device_config *z80dart;
4643   const device_config *z80sio;
44   const device_config *abc77;
4745   const device_config *mc6845;
4846
4947   /* memory regions */
r3469r3470
5755   int abc77_txd;         /* ABC-77 transmit data */
5856
5957   /* video state */
58   int flshclk_ctr;      /* flash clock counter */
6059   int flshclk;         /* flash clock */
6160   int mux80_40;         /* 40/80 column mode */
6261
63   /* timers */
64   emu_timer *ctc_timer;
65   emu_timer *flash_timer;
66
6762   /* devices */
6863   const device_config *z80ctc;
6964   const device_config *z80dart;
7065   const device_config *z80sio;
66   const device_config *abc77;
7167   const device_config *mc6845;
7268
7369   /* memory regions */
r3469r3470
9389
9490   int txoff;            /* text display enable */
9591   int _40;            /* 40/80 column mode */
92   int flshclk_ctr;      /* flash clock counter */
9693   int flshclk;         /* flash clock */
9794   UINT8 attr_data;      /* attribute data latch */
9895   UINT8 hrs;            /* HR memory mapping */
9996   UINT8 hrc[16];         /* HR palette */
100   UINT8 sync;            /* line synchronization */
97   UINT8 sync;            /* line synchronization delay */
10198   UINT8 v50_addr;         /* vertical sync PROM address */
10299   int hru2_a8;         /* HRU II PROM address line 8 */
100   UINT64 vsync_shift;      /* vertical sync shift register */
101   int vsync;            /* vertical sync */
103102
104   /* timers */
105   emu_timer *ctc_timer;
106   emu_timer *flash_timer;
107
108103   /* devices */
109104   const device_config *z80ctc;
110105   const device_config *z80dart;
111106   const device_config *z80sio;
112107   const device_config *mc6845;
108   const device_config *abc77;
113109   const device_config *e0516;
114110
115111   /* memory regions */
r3469r3470
118114   const UINT8 *char_rom;   /* character generator ROM */
119115};
120116
121/*----------- defined in video/abc80x.c -----------*/
117/*----------- defined in video/abc800.c -----------*/
122118
123119MACHINE_DRIVER_EXTERN(abc800m_video);
124120MACHINE_DRIVER_EXTERN(abc800c_video);
125MACHINE_DRIVER_EXTERN(abc802_video);
126MACHINE_DRIVER_EXTERN(abc806_video);
127121
128122WRITE8_HANDLER( abc800m_hrs_w );
129123WRITE8_HANDLER( abc800m_hrc_w );
r3469r3470
131125WRITE8_HANDLER( abc800c_hrs_w );
132126WRITE8_HANDLER( abc800c_hrc_w );
133127
128/*----------- defined in video/abc802.c -----------*/
129
130MACHINE_DRIVER_EXTERN(abc802_video);
131
132/*----------- defined in video/abc806.c -----------*/
133
134MACHINE_DRIVER_EXTERN(abc806_video);
135
134136WRITE8_HANDLER( abc806_hrs_w );
135137WRITE8_HANDLER( abc806_hrc_w );
136138
src/mess/machine/abc77.c
r3469r3470
33#include "cpu/mcs48/mcs48.h"
44#include "sound/discrete.h"
55
6/*
7
8   TODO:
9
10   - clock generator 74LS393 @ Z6
11
12*/
13
614typedef struct _abc77_t abc77_t;
715struct _abc77_t
816{
r3469r3470
5159   cpunum_set_input_line(device->machine, abc77->cpunum, MCS48_INPUT_IRQ, level ? CLEAR_LINE : ASSERT_LINE);
5260}
5361
54void abc77_clock_w(const device_config *device, int level)
62static TIMER_DEVICE_CALLBACK( clock_tick )
5563{
64   const device_config *device = devtag_get_device(timer->machine, ABC77, ABC77_TAG);
5665   abc77_t *abc77 = get_safe_token(device);
5766
58   abc77->clock = level;
67   abc77->clock = !abc77->clock;
5968}
6069
6170static TIMER_CALLBACK( reset_tick )
r3469r3470
291300   MDRV_CPU_PROGRAM_MAP(abc77_map, 0)
292301   MDRV_CPU_IO_MAP(abc77_io_map, 0)
293302
303   /* serial clock timer */
304   MDRV_TIMER_ADD_PERIODIC("clock", clock_tick, HZ(600*2))
305
294306   /* discrete sound */
295307   MDRV_SOUND_ADD("discrete", DISCRETE, 0)
296308   MDRV_SOUND_CONFIG_DISCRETE(abc77)
r3469r3470
330342   abc77->cpunum = mame_find_cpu_index(device->machine, astring_c(tempstring));
331343   astring_free(tempstring);
332344
333   /* allocate timer */
345   /* allocate reset timer */
334346
335347   abc77->reset_timer = timer_alloc(reset_tick, (FPTR *) device);
336348
src/mess/machine/abc77.h
r3469r3470
3030typedef void (*abc77_on_keydown_changed_func) (const device_config *device, int level);
3131#define ABC77_ON_KEYDOWN_CHANGED(name) void name(const device_config *device, int level)
3232
33typedef void (*abc77_on_clock_changed_func) (const device_config *device, int level);
34#define ABC77_ON_CLOCK_CHANGED(name) void name(const device_config *device, int level)
35
3336/* interface */
3437typedef struct _abc77_interface abc77_interface;
3538struct _abc77_interface
r3469r3470
3740   /* this gets called for every change of the TxD pin (pin 1) */
3841   abc77_on_txd_changed_func      txd_w;
3942
43   /* this gets called for every change of the CLOCK pin (pin 4) */
44   abc77_on_clock_changed_func      clock_w;
45
4046   /* this gets called for every change of the _KEYDOWN pin (pin 5) */
4147   abc77_on_keydown_changed_func   keydown_w;
4248};
r3469r3470
5157/* receive data */
5258void abc77_rxd_w(const device_config *device, int level);
5359
54/* clock */
55void abc77_clock_w(const device_config *device, int level);
56
5760/* reset */
5861void abc77_reset_w(const device_config *device, int level);
5962
src/mess/mess.mak
r3469r3470
11621162   $(MESS_DRIVERS)/abc80.o   \
11631163   $(MESS_VIDEO)/abc80.o   \
11641164   $(MESS_DRIVERS)/abc80x.o   \
1165   $(MESS_VIDEO)/abc80x.o   \
1165   $(MESS_VIDEO)/abc800.o   \
1166   $(MESS_VIDEO)/abc802.o   \
11661167   $(MESS_VIDEO)/abc806.o   \
11671168   $(MESS_MACHINE)/abcbus.o   \
11681169   $(MESS_MACHINE)/abc77.o   \
src/mess/drivers/abc80x.c
r3469r3470
8888
8989/* Keyboard HACK */
9090
91static emu_timer *abc800_keyboard_timer;
9291static int keylatch;
9392
9493static const UINT8 abc800_keycodes[7*4][8] =
9594{
9695   // unshift
9796   { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 },
98   { 0x39, 0x30, 0x2B, 0x60, 0x3C, 0x71, 0x77, 0x65 },
99   { 0x72, 0x74, 0x79, 0x75, 0x69, 0x6F, 0x70, 0x7D },
100   { 0x7E, 0x0D, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68 },
101   { 0x6A, 0x6B, 0x6C, 0x7C, 0x7B, 0x27, 0x08, 0x7A },
102   { 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E },
103   { 0x2D, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
97   { 0x39, 0x30, 0x2b, 0x60, 0x3c, 0x71, 0x77, 0x65 },
98   { 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x7d },
99   { 0x7e, 0x0d, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68 },
100   { 0x6a, 0x6b, 0x6c, 0x7c, 0x7b, 0x27, 0x08, 0x7a },
101   { 0x78, 0x63, 0x76, 0x62, 0x6e, 0x6d, 0x2c, 0x2e },
102   { 0x2d, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
104103
105104   // shift
106105   { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 },
r3469r3470
189188   }
190189}
191190
192static TIMER_CALLBACK( abc800_keyboard_tick )
191static TIMER_DEVICE_CALLBACK( abc800_keyboard_tick )
193192{
194   abc800_keyboard_scan(machine);
193   abc800_keyboard_scan(timer->machine);
195194}
196195
197196/* Read/Write Handlers */
r3469r3470
707706   state->abc77_txd = level;
708707}
709708
709static ABC77_ON_CLOCK_CHANGED( abc800_abc77_clock_changed )
710{
711//   abc800_state *state = device->machine->driver_data;
712
713   /* clock into DART RxTxCB (Receiver/Transmitter Clock B) */
714}
715
710716static ABC77_ON_KEYDOWN_CHANGED( abc800_abc77_keydown_changed )
711717{
712718   abc800_state *state = device->machine->driver_data;
r3469r3470
717723static ABC77_INTERFACE( abc800_abc77_intf )
718724{
719725   abc800_abc77_txd_changed,
726   abc800_abc77_clock_changed,
720727   abc800_abc77_keydown_changed
721728};
722729
723730static WRITE8_DEVICE_HANDLER( abc800_ctc_z2_w )
724731{
725   // write to DART channel A RxC/TxC
732   //abc800_state *state = device->machine->driver_data;
733
734   /* write to DART channel A RxC/TxC */
726735}
727736
728737static const z80ctc_interface abc800_ctc_intf =
r3469r3470
791800   { NULL }
792801};
793802
794static TIMER_CALLBACK(abc800_ctc_tick)
803static void abc800_ctc_trg_w(const device_config *z80ctc)
795804{
796   const device_config *device = ptr;
805   z80ctc_trg_w(z80ctc, 0, 1);
806   z80ctc_trg_w(z80ctc, 0, 0);
797807
798   z80ctc_trg_w(device, 0, 1);
799   z80ctc_trg_w(device, 0, 0);
800   z80ctc_trg_w(device, 1, 1);
801   z80ctc_trg_w(device, 1, 0);
802   z80ctc_trg_w(device, 2, 1);
803   z80ctc_trg_w(device, 2, 0);
808   z80ctc_trg_w(z80ctc, 1, 1);
809   z80ctc_trg_w(z80ctc, 1, 0);
810   
811   z80ctc_trg_w(z80ctc, 2, 1);
812   z80ctc_trg_w(z80ctc, 2, 0);
804813}
805814
815static TIMER_DEVICE_CALLBACK( abc800_ctc_tick )
816{
817   abc800_state *state = timer->machine->driver_data;
818
819   abc800_ctc_trg_w(state->z80ctc);
820}
821
806822static MACHINE_START( abc800 )
807823{
808824   abc800_state *state = machine->driver_data;
809825
810   /* keyboard HACK */
811
812   abc800_keyboard_timer = timer_alloc(abc800_keyboard_tick, NULL);
813   timer_adjust_periodic(abc800_keyboard_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2500));
814
815826   /* find devices */
816827
817828   state->z80ctc = devtag_get_device(machine, Z80CTC, Z80CTC_TAG);
818829   state->z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG);
819830   state->z80sio = devtag_get_device(machine, Z80SIO, Z80SIO_TAG);
820
821   /* allocate timer */
822
823   state->ctc_timer = timer_alloc(abc800_ctc_tick, (void *)state->z80ctc );
824   timer_adjust_periodic(state->ctc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC800_X01/2/2/2));
831   //state->abc77 = devtag_get_device(machine, ABC77, ABC77_TAG);
825832}
826833
827834// ABC802
r3469r3470
833840   state->abc77_txd = level;
834841}
835842
843static ABC77_ON_CLOCK_CHANGED( abc802_abc77_clock_changed )
844{
845//   abc802_state *state = device->machine->driver_data;
846
847   /* clock into DART RxTxCB (Receiver/Transmitter Clock B) */
848}
849
836850static ABC77_ON_KEYDOWN_CHANGED( abc802_abc77_keydown_changed )
837851{
838852   abc802_state *state = device->machine->driver_data;
r3469r3470
843857static ABC77_INTERFACE( abc802_abc77_intf )
844858{
845859   abc802_abc77_txd_changed,
860   abc802_abc77_clock_changed,
846861   abc802_abc77_keydown_changed
847862};
848863
r3469r3470
876891   dart_serial_receive      /* receive handler */
877892};
878893
894static TIMER_DEVICE_CALLBACK( abc802_ctc_tick )
895{
896   abc802_state *state = timer->machine->driver_data;
897
898   abc800_ctc_trg_w(state->z80ctc);
899}
900
901static WRITE8_DEVICE_HANDLER( abc802_ctc_z2_w )
902{
903//   abc802_state *state = device->machine->driver_data;
904
905   /* write to DART channel A RxC/TxC */
906}
907
908static const z80ctc_interface abc802_ctc_intf =
909{
910   Z80_TAG,            /* cpu */
911   ABC800_X01/2/2,         /* clock */
912   0,                    /* timer disables */
913   0,                    /* interrupt handler */
914   0,                  /* ZC/TO0 callback */
915   0,                    /* ZC/TO1 callback */
916   abc802_ctc_z2_w          /* ZC/TO2 callback */
917};
918
879919static MACHINE_START( abc802 )
880920{
881921   abc802_state *state = machine->driver_data;
r3469r3470
885925   state->z80ctc = devtag_get_device(machine, Z80CTC, Z80CTC_TAG);
886926   state->z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG);
887927   state->z80sio = devtag_get_device(machine, Z80SIO, Z80SIO_TAG);
928   state->abc77 = devtag_get_device(machine, ABC77, ABC77_TAG);
888929
889   /* allocate timer */
890
891   state->ctc_timer = timer_alloc(abc800_ctc_tick, (void *)state->z80ctc );
892   timer_adjust_periodic(state->ctc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC800_X01/2/2/2));
893
894930   /* configure memory */
895931
896932   memory_configure_bank(1, 0, 1, memory_region(machine, Z80_TAG), 0);
r3469r3470
911947   state->abc77_txd = level;
912948}
913949
950static ABC77_ON_CLOCK_CHANGED( abc806_abc77_clock_changed )
951{
952//   abc806_state *state = device->machine->driver_data;
953
954   /* clock into DART RxTxCB (Receiver/Transmitter Clock B) */
955}
956
914957static ABC77_ON_KEYDOWN_CHANGED( abc806_abc77_keydown_changed )
915958{
916959   abc806_state *state = device->machine->driver_data;
r3469r3470
921964static ABC77_INTERFACE( abc806_abc77_intf )
922965{
923966   abc806_abc77_txd_changed,
967   abc806_abc77_clock_changed,
924968   abc806_abc77_keydown_changed
925969};
926970
r3469r3470
951995   dart_serial_receive      /* receive handler */
952996};
953997
998static TIMER_DEVICE_CALLBACK( abc806_ctc_tick )
999{
1000   abc806_state *state = timer->machine->driver_data;
1001
1002   abc800_ctc_trg_w(state->z80ctc);
1003}
1004
1005static WRITE8_DEVICE_HANDLER( abc806_ctc_z2_w )
1006{
1007//   abc806_state *state = device->machine->driver_data;
1008
1009   /* write to DART channel A RxC/TxC */
1010}
1011
1012static const z80ctc_interface abc806_ctc_intf =
1013{
1014   Z80_TAG,            /* cpu */
1015   ABC800_X01/2/2,         /* clock */
1016   0,                    /* timer disables */
1017   0,                    /* interrupt handler */
1018   0,                  /* ZC/TO0 callback */
1019   0,                    /* ZC/TO1 callback */
1020   abc806_ctc_z2_w          /* ZC/TO2 callback */
1021};
1022
9541023static MACHINE_START( abc806 )
9551024{
9561025   abc806_state *state = machine->driver_data;
r3469r3470
9641033   state->z80dart = devtag_get_device(machine, Z80DART, Z80DART_TAG);
9651034   state->z80sio = devtag_get_device(machine, Z80SIO, Z80SIO_TAG);
9661035   state->e0516 = devtag_get_device(machine, E0516, E0516_TAG);
1036   state->abc77 = devtag_get_device(machine, ABC77, ABC77_TAG);
9671037
968   /* allocate timer */
969
970   state->ctc_timer = timer_alloc(abc800_ctc_tick, (void *)state->z80ctc );
971   timer_adjust_periodic(state->ctc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC800_X01/2/2/2));
972
9731038   /* setup memory banking */
9741039
9751040   state->videoram = auto_malloc(ABC806_VIDEO_RAM_SIZE);
r3469r3470
10191084
10201085   MDRV_MACHINE_START(abc800)
10211086
1087   /* fake keyboard */
1088   MDRV_TIMER_ADD_PERIODIC("keyboard", abc800_keyboard_tick, USEC(2500))
1089
10221090   /* ABC-77 keyboard */
10231091/*   MDRV_SPEAKER_STANDARD_MONO("mono")
10241092   MDRV_DEVICE_ADD(ABC77_TAG, ABC77)
r3469r3470
10271095   /* video hardware */
10281096   MDRV_IMPORT_FROM(abc800m_video)
10291097   
1098   /* Z80 CTC */
10301099   MDRV_Z80CTC_ADD( Z80CTC_TAG, abc800_ctc_intf )
1100   MDRV_TIMER_ADD_PERIODIC("ctc", abc800_ctc_tick, HZ(ABC800_X01/2/2/2))
1101
1102   /* Z80 SIO/2 */
10311103   MDRV_Z80SIO_ADD( Z80SIO_TAG, abc800_sio_intf )
1104
1105   /* Z80 DART */
10321106   MDRV_Z80DART_ADD( Z80DART_TAG, abc800_dart_intf )
10331107
10341108   /* printer */
r3469r3470
10491123
10501124   MDRV_MACHINE_START(abc800)
10511125
1126   /* fake keyboard */
1127   MDRV_TIMER_ADD_PERIODIC("keyboard", abc800_keyboard_tick, USEC(2500))
1128
10521129   /* ABC-77 keyboard */
10531130/*   MDRV_SPEAKER_STANDARD_MONO("mono")
10541131   MDRV_DEVICE_ADD(ABC77_TAG, ABC77)
r3469r3470
10571134   /* video hardware */
10581135   MDRV_IMPORT_FROM(abc800c_video)
10591136
1137   /* Z80 CTC */
10601138   MDRV_Z80CTC_ADD( Z80CTC_TAG, abc800_ctc_intf )
1139   MDRV_TIMER_ADD_PERIODIC("ctc", abc800_ctc_tick, HZ(ABC800_X01/2/2/2))
1140
1141   /* Z80 SIO/2 */
10611142   MDRV_Z80SIO_ADD( Z80SIO_TAG, abc800_sio_intf )
1143
1144   /* Z80 DART */
10621145   MDRV_Z80DART_ADD( Z80DART_TAG, abc800_dart_intf )
10631146
10641147   /* printer */
r3469r3470
10881171   /* video hardware */
10891172   MDRV_IMPORT_FROM(abc802_video)
10901173
1091   MDRV_Z80CTC_ADD( Z80CTC_TAG, abc800_ctc_intf )
1174   /* Z80 CTC */
1175   MDRV_Z80CTC_ADD( Z80CTC_TAG, abc802_ctc_intf )
1176   MDRV_TIMER_ADD_PERIODIC("ctc", abc802_ctc_tick, HZ(ABC800_X01/2/2/2))
1177
1178   /* Z80 SIO/2 */
10921179   MDRV_Z80SIO_ADD( Z80SIO_TAG, abc800_sio_intf )
1093   MDRV_Z80DART_ADD( Z80DART_TAG, abc802_dart_intf )
10941180
1181   /* Z80 DART */
1182   MDRV_Z80DART_ADD( Z80DART_TAG, abc800_dart_intf )
1183
10951184   /* printer */
10961185   MDRV_DEVICE_ADD("printer", PRINTER)
10971186
r3469r3470
11191208   /* video hardware */
11201209   MDRV_IMPORT_FROM(abc806_video)
11211210
1122   MDRV_Z80CTC_ADD( Z80CTC_TAG, abc800_ctc_intf )
1211   /* Z80 CTC */
1212   MDRV_Z80CTC_ADD( Z80CTC_TAG, abc806_ctc_intf )
1213   MDRV_TIMER_ADD_PERIODIC("ctc", abc806_ctc_tick, HZ(ABC800_X01/2/2/2))
1214
1215   /* Z80 SIO/2 */
11231216   MDRV_Z80SIO_ADD( Z80SIO_TAG, abc800_sio_intf )
1124   MDRV_Z80DART_ADD( Z80DART_TAG, abc806_dart_intf )
11251217
1218   /* Z80 DART */
1219   MDRV_Z80DART_ADD( Z80DART_TAG, abc800_dart_intf )
1220
11261221   /* real time clock */
11271222   MDRV_DEVICE_ADD(E0516_TAG, E0516)
11281223   MDRV_DEVICE_CONFIG(abc806_e0516_intf)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team