Previous 199869 Revisions Next

r17713 Saturday 8th September, 2012 at 08:36:07 UTC by Curt Coder
(MESS) c128: Refactored to use the new VIC-IIe, and rewrote the MOS8563 VDC as an MC6845 variant. The VIC-IIe and VDC now have their own screens. Not fully working yet, WIP. (nw)
[src/emu/video]mc6845.c mc6845.h
[src/mess/drivers]c128.c
[src/mess/includes]c128.h
[src/mess/machine]c128.c
[src/mess/video]mos6566.h

trunk/src/emu/video/mc6845.c
r17712r17713
4040const device_type SY6845E = &device_creator<sy6845e_device>;
4141const device_type HD6345 = &device_creator<hd6345_device>;
4242const device_type AMS40041 = &device_creator<ams40041_device>;
43const device_type MOS8563 = &device_creator<mos8563_device>;
44const device_type MOS8568 = &device_creator<mos8568_device>;
4345
4446
4547/* mode macros */
r17712r17713
5254#define MODE_DISPLAY_ENABLE_SKEW   ((m_mode_control & 0x10) != 0)
5355#define MODE_ROW_COLUMN_ADDRESSING   ((m_mode_control & 0x04) != 0)
5456
57#define VSS_CBRATE               BIT(m_vert_scroll, 5)
58#define VSS_RVS                  BIT(m_vert_scroll, 6)
59#define VSS_COPY               BIT(m_vert_scroll, 7)
5560
61#define HSS_DBL                  BIT(m_horiz_scroll, 4)
62#define HSS_SEMI               BIT(m_horiz_scroll, 5)
63#define HSS_ATTR               BIT(m_horiz_scroll, 6)
64#define HSS_TEXT               BIT(m_horiz_scroll, 7)
65
66#define ATTR_COLOR                (attr & 0x0f)
67#define ATTR_BLINK                BIT(attr, 4)
68#define ATTR_UNDERLINE             BIT(attr, 5)
69#define ATTR_REVERSE             BIT(attr, 6)
70#define ATTR_ALTERNATE_CHARSET      BIT(attr, 7)
71
72
5673void mc6845_device::device_config_complete()
5774{
5875   const mc6845_interface *intf = reinterpret_cast<const mc6845_interface *>(static_config());
r17712r17713
242259}
243260
244261
262WRITE8_MEMBER( mos8563_device::address_w )
263{
264   m_register_address_latch = data & 0x3f;
265
266   m_update_ready_bit = 0;
267}
268
269
270READ8_MEMBER( mos8563_device::status_r )
271{
272   UINT8 ret = 0;
273
274   /* VBLANK bit */
275   if (!m_line_enable_ff)
276      ret = ret | 0x20;
277
278   /* light pen latched */
279   if (m_light_pen_latched)
280      ret = ret | 0x40;
281
282   /* UPDATE ready */
283   if (m_update_ready_bit)
284      ret = ret | 0x80;
285
286   m_update_ready_bit = 1;
287
288   return ret;
289}
290
291
292READ8_MEMBER( mos8563_device::register_r )
293{
294   UINT8 ret = 0xff;
295
296   switch (m_register_address_latch)
297   {
298      case 0x00:   ret = m_horiz_char_total; break;
299      case 0x01:   ret = m_horiz_disp; break;
300      case 0x02:   ret = m_horiz_sync_pos; break;
301      case 0x03:   ret = m_sync_width; break;
302      case 0x04:   ret = m_vert_char_total; break;
303      case 0x05:   ret = m_vert_total_adj; break;
304      case 0x06:   ret = m_vert_disp; break;
305      case 0x07:   ret = m_vert_sync_pos; break;
306      case 0x08:   ret = m_mode_control; break;
307      case 0x09:   ret = m_max_ras_addr; break;
308      case 0x0a:   ret = m_cursor_start_ras; break;
309      case 0x0b:   ret = m_cursor_end_ras; break;
310      case 0x0c:  ret = (m_disp_start_addr >> 8) & 0xff; break;
311      case 0x0d:  ret = (m_disp_start_addr >> 0) & 0xff; break;
312      case 0x0e:  ret = (m_cursor_addr     >> 8) & 0xff; break;
313      case 0x0f:  ret = (m_cursor_addr     >> 0) & 0xff; break;
314      case 0x10:  ret = (m_light_pen_addr  >> 8) & 0xff; m_light_pen_latched = false; break;
315      case 0x11:  ret = (m_light_pen_addr  >> 0) & 0xff; m_light_pen_latched = false; break;
316      case 0x12:  ret = (m_update_addr     >> 8) & 0xff; break;
317      case 0x13:  ret = (m_update_addr     >> 0) & 0xff; break;
318      case 0x14:  ret = (m_attribute_addr  >> 8) & 0xff; break;
319      case 0x15:  ret = (m_attribute_addr  >> 0) & 0xff; break;
320      case 0x16:   ret = m_horiz_char; break;
321      case 0x17:   ret = m_vert_char_disp; break;
322      case 0x18:   ret = m_vert_scroll; break;
323      case 0x19:   ret = m_horiz_scroll; break;
324      case 0x1a:   ret = m_color; break;
325      case 0x1b:   ret = m_row_addr_incr; break;
326      case 0x1c:   ret = m_char_base_addr; break;
327      case 0x1d:   ret = m_underline_ras; break;
328      case 0x1e:   ret = 0; break;
329      case 0x1f:   ret = read_videoram(m_update_addr++); break;
330      case 0x20:  ret = (m_block_addr      >> 8) & 0xff; break;
331      case 0x21:  ret = (m_block_addr      >> 0) & 0xff; break;
332      case 0x22:  ret = (m_de_begin        >> 8) & 0xff; break;
333      case 0x23:  ret = (m_de_begin        >> 0) & 0xff; break;
334      case 0x24:   ret = m_dram_refresh; break;
335      case 0x25:   ret = m_sync_polarity | 0x3f; break;
336   }
337
338   return ret;
339}
340
341
342WRITE8_MEMBER( mos8563_device::register_w )
343{
344   if (LOG)  logerror("%s:MOS8563 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
345
346   switch (m_register_address_latch)
347   {
348      case 0x00:  m_horiz_char_total =   data & 0xff; break;
349      case 0x01:  m_horiz_disp       =   data & 0xff; break;
350      case 0x02:  m_horiz_sync_pos   =   data & 0xff; break;
351      case 0x03:  m_sync_width       =   data & 0xff; break;
352      case 0x04:  m_vert_char_total  =   data & 0xff; break;
353      case 0x05:  m_vert_total_adj   =   data & 0x1f; break;
354      case 0x06:  m_vert_disp        =   data & 0xff; break;
355      case 0x07:  m_vert_sync_pos    =   data & 0xff; break;
356      case 0x08:  m_mode_control     =   data & 0x03; break;
357      case 0x09:  m_max_ras_addr     =   data & 0x1f; break;
358      case 0x0a:  m_cursor_start_ras =   data & 0x7f; break;
359      case 0x0b:  m_cursor_end_ras   =   data & 0x1f; break;
360      case 0x0c:  m_disp_start_addr  = ((data & 0xff) << 8) | (m_disp_start_addr & 0x00ff); break;
361      case 0x0d:  m_disp_start_addr  = ((data & 0xff) << 0) | (m_disp_start_addr & 0xff00); break;
362      case 0x0e:  m_cursor_addr      = ((data & 0xff) << 8) | (m_cursor_addr & 0x00ff); break;
363      case 0x0f:  m_cursor_addr      = ((data & 0xff) << 0) | (m_cursor_addr & 0xff00); break;
364      case 0x10: /* read-only */ break;
365      case 0x11: /* read-only */ break;
366      case 0x12:  m_update_addr       = ((data & 0xff) << 8) | (m_update_addr & 0x00ff); break;
367      case 0x13:   m_update_addr       = ((data & 0xff) << 0) | (m_update_addr & 0xff00); break;
368      case 0x14:  m_attribute_addr   = ((data & 0xff) << 8) | (m_attribute_addr & 0x00ff); break;
369      case 0x15:  m_attribute_addr   = ((data & 0xff) << 0) | (m_attribute_addr & 0xff00); break;
370      case 0x16:    m_horiz_char       =   data & 0xff; break;
371      case 0x17:   m_vert_char_disp   =   data & 0x1f; break;
372      case 0x18:   m_vert_scroll      =   data & 0x1f; break;
373      case 0x19:   m_horiz_scroll      =   data & 0x1f; break;
374      case 0x1a:   m_color               =   data & 0xff; break;
375      case 0x1b:   m_row_addr_incr      =   data & 0xff; break;
376      case 0x1c:   m_char_base_addr   =   data & 0xf0; break;
377      case 0x1d:   m_underline_ras    =   data & 0x1f; break;
378      case 0x1e:
379         m_word_count = data & 0xff;
380         
381         do
382         {
383            UINT8 byte = VSS_COPY ? read_videoram(m_block_addr++) : m_data;
384
385            write_videoram(m_update_addr++, byte);
386         } while (m_word_count-- > 0);
387         break;
388      case 0x1f:
389         m_data = data & 0xff;
390
391         write_videoram(m_update_addr++, m_data);
392         break;
393      case 0x20:  m_block_addr         = ((data & 0xff) << 8) | (m_block_addr & 0x00ff); break;
394      case 0x21:  m_block_addr         = ((data & 0xff) << 0) | (m_block_addr & 0xff00); break;
395      case 0x22:  m_de_begin         = ((data & 0xff) << 8) | (m_de_begin & 0x00ff); break;
396      case 0x23:  m_de_begin         = ((data & 0xff) << 0) | (m_de_begin & 0xff00); break;
397      case 0x24:   m_dram_refresh     =   data & 0x0f; break;
398      case 0x25:   m_sync_polarity    =   data & 0xc0; break;
399   }
400
401   recompute_parameters(false);
402}
403
404
405inline UINT8 mos8563_device::read_videoram(offs_t offset)
406{
407   return space(AS_0)->read_byte(offset);
408}
409
410inline void mos8563_device::write_videoram(offs_t offset, UINT8 data)
411{
412   space(AS_0)->write_byte(offset, data);
413}
414
415
245416READ_LINE_MEMBER( mc6845_device::de_r )
246417{
247418   return m_de;
r17712r17713
9891160}
9901161
9911162
1163void mos8563_device::device_start()
1164{
1165   mc6845_device::device_start();
1166
1167   m_supports_status_reg_d5 = true;
1168   m_supports_status_reg_d6 = true;
1169   m_supports_status_reg_d7 = true;
1170   m_update_ready_bit = 1;
1171
1172   save_item(NAME(m_char_buffer));
1173   save_item(NAME(m_attr_buffer));
1174   save_item(NAME(m_attribute_addr));
1175   save_item(NAME(m_horiz_char));
1176   save_item(NAME(m_vert_char_disp));
1177   save_item(NAME(m_vert_scroll));
1178   save_item(NAME(m_horiz_scroll));
1179   save_item(NAME(m_color));
1180   save_item(NAME(m_row_addr_incr));
1181   save_item(NAME(m_char_base_addr));
1182   save_item(NAME(m_underline_ras));
1183   save_item(NAME(m_word_count));
1184   save_item(NAME(m_data));
1185   save_item(NAME(m_block_addr));
1186   save_item(NAME(m_de_begin));
1187   save_item(NAME(m_dram_refresh));
1188}
1189
1190
1191void mos8568_device::device_start()
1192{
1193   mos8563_device::device_start();
1194
1195   save_item(NAME(m_sync_polarity));
1196}
1197
1198
9921199void mc6845_device::device_reset()
9931200{
9941201   /* internal registers other than status remain unchanged, all outputs go low */
r17712r17713
10251232void hd6345_device::device_reset() { mc6845_device::device_reset(); }
10261233void ams40041_device::device_reset() { mc6845_device::device_reset(); }
10271234
1235void mos8563_device::device_reset()
1236{
1237   mc6845_device::device_reset();
10281238
1239   m_sync_polarity = 0xc0;
1240}
1241
1242void mos8568_device::device_reset() { mos8563_device::device_reset(); }
1243
1244
1245//-------------------------------------------------
1246//  memory_space_config - return a description of
1247//  any address spaces owned by this device
1248//-------------------------------------------------
1249
1250const address_space_config *mos8563_device::memory_space_config(address_spacenum spacenum) const
1251{
1252   switch (spacenum)
1253   {
1254      case AS_0: return &m_videoram_space_config;
1255      default: return NULL;
1256   }
1257}
1258
1259// default address maps
1260static ADDRESS_MAP_START( mos8563_videoram_map, AS_0, 8, mos8563_device )
1261   AM_RANGE(0x0000, 0xffff) AM_RAM
1262ADDRESS_MAP_END
1263
1264
10291265r6545_1_device::r6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
10301266   : mc6845_device(mconfig, R6545_1, "R6545-1", tag, owner, clock)
10311267{
r17712r17713
10781314   : mc6845_device(mconfig, AMS40041, "40041", tag, owner, clock)
10791315{
10801316}
1317
1318
1319mos8563_device::mos8563_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
1320   : mc6845_device(mconfig, type, name, tag, owner, clock),
1321     device_memory_interface(mconfig, *this),
1322     m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mos8563_videoram_map))
1323{
1324}
1325
1326
1327mos8563_device::mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1328   : mc6845_device(mconfig, MOS8563, "MOS8563", tag, owner, clock),
1329     device_memory_interface(mconfig, *this),
1330     m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mos8563_videoram_map))
1331{
1332}
1333
1334
1335mos8568_device::mos8568_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1336   : mos8563_device(mconfig, MOS8568, "MOS8568", tag, owner, clock)
1337{
1338}
1339
1340
1341// VICE palette
1342static const rgb_t MOS8563_PALETTE[] =
1343{
1344   MAKE_RGB(0x00, 0x00, 0x00),
1345   MAKE_RGB(0x20, 0x20, 0x20),
1346   MAKE_RGB(0x00, 0x00, 0x80),
1347   MAKE_RGB(0x00, 0x00, 0xff),
1348   MAKE_RGB(0x00, 0x80, 0x00),
1349   MAKE_RGB(0x00, 0xff, 0x00),
1350   MAKE_RGB(0x00, 0x80, 0x80),
1351   MAKE_RGB(0x00, 0xff, 0xff),
1352   MAKE_RGB(0x80, 0x00, 0x00),
1353   MAKE_RGB(0xff, 0x00, 0x00),
1354   MAKE_RGB(0x80, 0x00, 0x80),
1355   MAKE_RGB(0xff, 0x00, 0xff),
1356   MAKE_RGB(0x80, 0x80, 0x00),
1357   MAKE_RGB(0xff, 0xff, 0x00),
1358   MAKE_RGB(0xc0, 0xc0, 0xc0),
1359   MAKE_RGB(0xff, 0xff, 0xff)
1360};
1361
1362
1363void mos8563_device::update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
1364{
1365   for (int column = 0; column < x_count; column++)
1366   {
1367      if (HSS_TEXT)
1368      {
1369         // TODO graphics
1370      }
1371      else
1372      {
1373         UINT8 code = read_videoram(ma + column);
1374
1375         offs_t attr_addr = m_attribute_addr + column;
1376         UINT8 attr = 0;
1377
1378         UINT8 cth = (m_horiz_char >> 4) + 1;
1379         UINT8 cdh = (m_horiz_char & 0x0f) + 1;
1380         UINT8 cdv = m_vert_char_disp;
1381
1382         // attributes
1383         int fg;
1384         int bg = m_color & 0x0f;
1385
1386         if (HSS_ATTR)
1387         {
1388            attr = read_videoram(attr_addr);
1389            fg = ATTR_COLOR;
1390         }
1391         else
1392         {
1393            fg = m_color >> 4;
1394         }
1395
1396         offs_t font_addr;
1397
1398         if (m_max_ras_addr < 16)
1399            font_addr = ((m_char_base_addr >> 5) << 13) | (ATTR_ALTERNATE_CHARSET << 12) | (code << 4) | ra;
1400         else
1401            font_addr = ((m_char_base_addr >> 5) << 13) | (ATTR_ALTERNATE_CHARSET << 13) | (code << 5) | ra;
1402
1403         UINT8 data = read_videoram(font_addr);
1404
1405         if (column == cursor_x) data = 0xff;
1406         if (ra >= cdv) data = 0;
1407         if (ATTR_UNDERLINE && (ra == m_underline_ras)) data = 0xff;
1408
1409         if (ATTR_REVERSE)
1410         {
1411            int temp = bg;
1412            bg = fg;
1413            fg = temp;
1414         }
1415         // TODO ATTR_BLINK
1416
1417         for (int bit = 0; bit < MIN(cdh, 8); bit++)
1418         {
1419            int x = (column * cth) + bit;
1420
1421            bitmap.pix32(y, x) = MOS8563_PALETTE[BIT(data, 7) ? fg : bg];
1422            data <<= 1;
1423         }
1424      }
1425   }
1426}
trunk/src/emu/video/mc6845.h
r17712r17713
2121   MCFG_DEVICE_ADD(_tag, _variant, _clock) \
2222   MCFG_DEVICE_CONFIG(_config)
2323
24#define MCFG_MOS8563_ADD(_tag, _screen_tag, _clock, _config, _map) \
25   MCFG_DEVICE_ADD(_tag, MOS8563, _clock) \
26   MCFG_DEVICE_CONFIG(_config) \
27   MCFG_DEVICE_ADDRESS_MAP(AS_0, _map) \
28   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
29   MCFG_SCREEN_REFRESH_RATE(60) \
30   MCFG_SCREEN_SIZE(640, 200) \
31   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) \
32   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8563_device, screen_update)
2433
34#define MCFG_MOS8568_ADD(_tag, _screen_tag, _clock, _config, _map) \
35   MCFG_DEVICE_ADD(_tag, MOS8568, _clock) \
36   MCFG_DEVICE_CONFIG(_config) \
37   MCFG_DEVICE_ADDRESS_MAP(AS_0, _map) \
38   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
39   MCFG_SCREEN_REFRESH_RATE(60) \
40   MCFG_SCREEN_SIZE(640, 200) \
41   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) \
42   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8568_device, screen_update)
43
44
2545class mc6845_device;
2646
2747/* callback definitions */
r17712r17713
158178   virtual void device_post_load();
159179   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
160180
161private:
162181   bool m_supports_disp_start_addr_r;
163182   bool m_supports_vert_sync_width;
164183   bool m_supports_status_reg_d5;
r17712r17713
358377   virtual void device_reset();
359378};
360379
380class mos8563_device : public mc6845_device,
381                  public device_memory_interface
382{
383public:
384   mos8563_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
385   mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
361386
387   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
388
389   DECLARE_WRITE8_MEMBER( address_w );
390   DECLARE_READ8_MEMBER( status_r );
391   DECLARE_READ8_MEMBER( register_r );
392   DECLARE_WRITE8_MEMBER( register_w );
393
394   inline UINT8 read_videoram(offs_t offset);
395   inline void write_videoram(offs_t offset, UINT8 data);
396
397   void update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param);
398
399protected:
400   // device-level overrides
401   virtual void device_start();
402   virtual void device_reset();
403
404   const address_space_config      m_videoram_space_config;
405
406   UINT8 m_char_buffer[80];
407   UINT8 m_attr_buffer[80];
408
409   /* register file */
410   UINT16   m_attribute_addr;      /* 0x14/0x15 */
411   UINT8   m_horiz_char;         /* 0x16 */
412   UINT8   m_vert_char_disp;      /* 0x17 */
413   UINT8   m_vert_scroll;         /* 0x18 */
414   UINT8   m_horiz_scroll;         /* 0x19 */
415   UINT8   m_color;            /* 0x1a */
416   UINT8   m_row_addr_incr;      /* 0x1b */
417   UINT8   m_char_base_addr;      /* 0x1c */
418   UINT8   m_underline_ras;      /* 0x1d */
419   UINT8   m_word_count;         /* 0x1e */
420   UINT8   m_data;               /* 0x1f */
421   UINT16   m_block_addr;         /* 0x20/0x21 */
422   UINT16   m_de_begin;            /* 0x22/0x23 */
423   UINT8   m_dram_refresh;         /* 0x24 */
424   UINT8   m_sync_polarity;      /* 0x25 */
425};
426
427class mos8568_device : public mos8563_device
428{
429public:
430   mos8568_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
431
432protected:
433   // device-level overrides
434   virtual void device_start();
435   virtual void device_reset();
436};
437
438
362439extern const device_type MC6845;
363440extern const device_type MC6845_1;
364441extern const device_type R6545_1;
r17712r17713
369446extern const device_type SY6845E;
370447extern const device_type HD6345;
371448extern const device_type AMS40041;
449extern const device_type MOS8563;
450extern const device_type MOS8568;
372451
373452
453
374454#endif
trunk/src/mess/machine/c128.c
r17712r17713
1818#include "imagedev/cassette.h"
1919#include "machine/6526cia.h"
2020#include "sound/sid6581.h"
21#include "video/vic6567.h"
22#include "video/vdc8563.h"
21#include "video/mos6566.h"
22#include "video/mc6845.h"
2323
2424#define MMU_PAGE1 ((((state->m_mmu[10]&0xf)<<8)|state->m_mmu[9])<<8)
2525#define MMU_PAGE0 ((((state->m_mmu[8]&0xf)<<8)|state->m_mmu[7])<<8)
r17712r17713
135135
136136static READ8_DEVICE_HANDLER( c128_cia0_port_b_r )
137137{
138   c128_state *state = device->machine().driver_data<c128_state>();
138//   c128_state *state = device->machine().driver_data<c128_state>();
139139   UINT8 value = 0xff;
140140   UINT8 cia0porta = mos6526_pa_r(device->machine().device("cia_0"), 0);
141   device_t *vic2e = device->machine().device("vic2e");
141   //device_t *vic2e = device->machine().device("vic2e");
142142
143143   value &= cbm_common_cia0_port_b_r(device, cia0porta);
144
145   if (!vic2e_k0_r(vic2e))
144/*
145   if (!vic2e->k0_r())
146146      value &= state->m_keyline[0];
147   if (!vic2e_k1_r(vic2e))
147   if (!vic2e->k1_r())
148148      value &= state->m_keyline[1];
149   if (!vic2e_k2_r(vic2e))
149   if (!vic2e->k2_r())
150150      value &= state->m_keyline[2];
151
151*/
152152   return value;
153153}
154154
155155static WRITE8_DEVICE_HANDLER( c128_cia0_port_b_w )
156156{
157   device_t *vic2e = device->machine().device("vic2e");
158   vic2_lightpen_write(vic2e, data & 0x10);
157   mos6566_device *vic2e = device->machine().device<mos6566_device>("vic2e");
158
159   vic2e->lp_w(BIT(data, 4));
159160}
160161
161162static void c128_irq( running_machine &machine, int level )
r17712r17713
387388   device_t *cia_0 = space->machine().device("cia_0");
388389   device_t *cia_1 = space->machine().device("cia_1");
389390   device_t *sid = space->machine().device("sid6581");
390   device_t *vic2e = space->machine().device("vic2e");
391   device_t *vdc8563 = space->machine().device("vdc8563");
391   mos6566_device *vic2e = space->machine().device<mos6566_device>("vic2e");
392   mos8563_device *vdc8563 = space->machine().device<mos8563_device>("vdc8563");
392393
393394   UINT8 c64_port6510 = m6510_get_port(space->machine().device<legacy_cpu_device>("m8502"));
394395
r17712r17713
404405      switch ((offset&0xf00)>>8)
405406      {
406407      case 0:case 1: case 2: case 3:
407         vic2_port_w(vic2e, offset & 0x3ff, data);
408         vic2e->write(*space, offset & 0x3f, data);
408409         break;
409410      case 4:
410411         sid6581_w(sid, offset & 0x3f, data);
r17712r17713
412413      case 5:
413414         c128_mmu8722_port_w(space, offset & 0xff, data);
414415         break;
415      case 6:case 7:
416         vdc8563_port_w(vdc8563, offset & 0xff, data);
416      case 6: case 7:
417         if (offset & 0x01)
418            vdc8563->register_w(*space, 0, data);
419         else
420            vdc8563->address_w(*space, 0, data);
417421         break;
418422      case 8: case 9: case 0xa: case 0xb:
419423          if (state->m_c64mode)
r17712r17713
445449   device_t *cia_0 = space->machine().device("cia_0");
446450   device_t *cia_1 = space->machine().device("cia_1");
447451   device_t *sid = space->machine().device("sid6581");
448   device_t *vic2e= space->machine().device("vic2e");
449   device_t *vdc8563 = space->machine().device("vdc8563");
452   mos6566_device *vic2e = space->machine().device<mos6566_device>("vic2e");
453   mos8563_device *vdc8563 = space->machine().device<mos8563_device>("vdc8563");
450454
451455   if (offset < 0x400)
452      return vic2_port_r(vic2e, offset & 0x3ff);
456      return vic2e->read(*space, offset & 0x3f);
453457   else if (offset < 0x500)
454458      return sid6581_r(sid, offset & 0xff);
455459   else if (offset < 0x600)
456460      return c128_mmu8722_port_r(space, offset & 0xff);
457461   else if (offset < 0x800)
458      return vdc8563_port_r(vdc8563, offset & 0xff);
462         if (offset & 0x01)
463            return vdc8563->register_r(*space, 0);
464         else
465            return vdc8563->status_r(*space, 0);
459466   else if (offset < 0xc00)
460467      return state->m_colorram[offset & 0x3ff];
461468   else if (offset == 0xc00)
r17712r17713
10721079{
10731080   c128_state *state = device->machine().driver_data<c128_state>();
10741081
1075   UINT8 direction = offset; // HACK ALERT!
1076
1077   /* if line is marked as input then keep current value */
1078   data = (state->m_c64_port_data & ~direction) | (data & direction);
1079
1080   /* resistors make P0,P1,P2 go high when respective line is changed to input */
1081   if (!(direction & 0x04))
1082      data |= 0x04;
1083
1084   if (!(direction & 0x02))
1085      data |= 0x02;
1086
1087   if (!(direction & 0x01))
1088      data |= 0x01;
1089
1090   state->m_c64_port_data = data;
1091
10921082   if (state->m_tape_on)
10931083   {
1094      if (direction & 0x08)
1084      device->machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
1085
1086      if (!(data & 0x20))
10951087      {
1096         device->machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
1088         device->machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
1089         state->m_datasette_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
10971090      }
1098
1099      if (direction & 0x20)
1091      else
11001092      {
1101         if (!(data & 0x20))
1102         {
1103            device->machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
1104            state->m_datasette_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
1105         }
1106         else
1107         {
1108            device->machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
1109            state->m_datasette_timer->reset();
1110         }
1093         device->machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
1094         state->m_datasette_timer->reset();
11111095      }
11121096   }
11131097
r17712r17713
11211105READ8_DEVICE_HANDLER(c128_m6510_port_read)
11221106{
11231107   c128_state *state = device->machine().driver_data<c128_state>();
1124   UINT8 data = state->m_c64_port_data;
1108   UINT8 data = 0x07;
11251109
11261110   if ((device->machine().device<cassette_image_device>(CASSETTE_TAG)->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
11271111      data &= ~0x10;
r17712r17713
11821166
11831167DRIVER_INIT_MEMBER(c128_state,c128)
11841168{
1185   device_t *vic2e = machine().device("vic2e");
1186   device_t *vdc8563 = machine().device("vdc8563");
1169   //device_t *vic2e = machine().device("vic2e");
1170   //device_t *vdc8563 = machine().device("vdc8563");
11871171
11881172   c128_common_driver_init(machine());
11891173
1190   vic2_set_rastering(vic2e, 0);
1191   vdc8563_set_rastering(vdc8563, 1);
1174   //vic2_set_rastering(vic2e, 0);
1175   //vdc8563_set_rastering(vdc8563, 1);
11921176}
11931177
11941178DRIVER_INIT_MEMBER(c128_state,c128pal)
11951179{
1196   device_t *vic2e = machine().device("vic2e");
1197   device_t *vdc8563 = machine().device("vdc8563");
1180   //device_t *vic2e = machine().device("vic2e");
1181   //device_t *vdc8563 = machine().device("vdc8563");
11981182
11991183   c128_common_driver_init(machine());
12001184   m_pal = 1;
12011185
1202   vic2_set_rastering(vic2e, 1);
1203   vdc8563_set_rastering(vdc8563, 0);
1186   //vic2_set_rastering(vic2e, 1);
1187   //vdc8563_set_rastering(vdc8563, 0);
12041188}
12051189
12061190DRIVER_INIT_MEMBER(c128_state,c128d)
r17712r17713
12531237   c128_state *state = device->machine().driver_data<c128_state>();
12541238   static const char *const c128ports[] = { "KP0", "KP1", "KP2" };
12551239   int i, value;
1256   device_t *vic2e = device->machine().device("vic2e");
1257   device_t *vdc8563 = device->machine().device("vdc8563");
1240   //device_t *vic2e = device->machine().device("vic2e");
1241   //device_t *vdc8563 = device->machine().device("vdc8563");
12581242
12591243   c128_nmi(device->machine());
12601244
r17712r17713
12621246   {
12631247      if (device->machine().root_device().ioport("SPECIAL")->read() & 0x08)
12641248      {
1265         vic2_set_rastering(vic2e, 0);
1266         vdc8563_set_rastering(vdc8563, 1);
1249         //vic2_set_rastering(vic2e, 0);
1250         //vdc8563_set_rastering(vdc8563, 1);
12671251         device->machine().primary_screen->set_visible_area(0, 655, 0, 215);
12681252      }
12691253      else
12701254      {
1271         vic2_set_rastering(vic2e, 1);
1272         vdc8563_set_rastering(vdc8563, 0);
1255         //vic2_set_rastering(vic2e, 1);
1256         //vdc8563_set_rastering(vdc8563, 0);
12731257         if (state->m_pal)
12741258            device->machine().primary_screen->set_visible_area(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1);
12751259         else
r17712r17713
12951279      state->m_keyline[i] = value;
12961280   }
12971281}
1298
1299SCREEN_UPDATE_IND16( c128 )
1300{
1301   device_t *vic2e = screen.machine().device("vic2e");
1302   device_t *vdc8563 = screen.machine().device("vdc8563");
1303
1304   vdc8563_video_update(vdc8563, bitmap, cliprect);
1305   vic2_video_update(vic2e, bitmap, cliprect);
1306   return 0;
1307}
trunk/src/mess/includes/c128.h
r17712r17713
2727   DECLARE_READ8_MEMBER( vic_lightpen_y_cb );
2828   DECLARE_READ8_MEMBER( vic_lightpen_button_cb );
2929   DECLARE_READ8_MEMBER( vic_dma_read );
30   DECLARE_READ8_MEMBER( vic_dma_read_ultimax );
3130   DECLARE_READ8_MEMBER( vic_dma_read_color );
3231   DECLARE_WRITE_LINE_MEMBER( vic_interrupt );
3332   DECLARE_READ8_MEMBER( vic_rdy_cb );
r17712r17713
9291extern MACHINE_RESET( c128 );
9392extern INTERRUPT_GEN( c128_frame_interrupt );
9493
95extern SCREEN_UPDATE_IND16( c128 );
96
9794void c128_bankswitch_64(running_machine &machine, int reset);
9895
99int c128_dma_read(running_machine &machine, int offset);
100int c128_dma_read_color(running_machine &machine, int offset);
101void c128_vic_interrupt(running_machine &machine, int level);
102
10396extern READ8_DEVICE_HANDLER(c128_m6510_port_read);
10497extern WRITE8_DEVICE_HANDLER(c128_m6510_port_write);
10598
trunk/src/mess/video/mos6566.h
r17712r17713
133133   MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) \
134134   MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) \
135135   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \
136   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8562_device, screen_update)
136   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8564_device, screen_update)
137137
138138#define MCFG_MOS6569_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
139139   MCFG_DEVICE_ADD(_tag, MOS6569, _clock) \
r17712r17713
166166   MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) \
167167   MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) \
168168   MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) \
169   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8565_device, screen_update)
169   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8566_device, screen_update)
170170
171171
172172#define MOS6566_INTERFACE(_name) \
trunk/src/mess/drivers/c128.c
r17712r17713
178178#include "machine/6526cia.h"
179179
180180#include "machine/cbmipt.h"
181#include "video/vic6567.h"
182#include "video/vdc8563.h"
181#include "video/mos6566.h"
182#include "video/mc6845.h"
183183
184184
185185/* devices config */
r17712r17713
251251
252252static ADDRESS_MAP_START( c128_z80_io , AS_IO, 8, c128_state )
253253   AM_RANGE(0x1000, 0x13ff) AM_READWRITE_LEGACY(c64_colorram_read, c64_colorram_write)
254   AM_RANGE(0xd000, 0xd3ff) AM_DEVREADWRITE_LEGACY("vic2e", vic2_port_r, vic2_port_w)
254   AM_RANGE(0xd000, 0xd3ff) AM_DEVREADWRITE("vic2e", mos6566_device, read, write)
255255   AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE_LEGACY("sid6581", sid6581_r, sid6581_w)
256256   AM_RANGE(0xd500, 0xd5ff) AM_READWRITE_LEGACY(c128_mmu8722_port_r, c128_mmu8722_port_w)
257   AM_RANGE(0xd600, 0xd7ff) AM_DEVREADWRITE_LEGACY("vdc8563", vdc8563_port_r, vdc8563_port_w)
257   //AM_RANGE(0xd600, 0xd7ff) AM_DEVREADWRITE_LEGACY("vdc8563", vdc8563_port_r, vdc8563_port_w)
258   AM_RANGE(0xd600, 0xd600) AM_MIRROR(0x1fe) AM_DEVREADWRITE("vdc8563", mos8563_device, status_r, address_w)
259   AM_RANGE(0xd601, 0xd601) AM_MIRROR(0x1fe) AM_DEVREADWRITE("vdc8563", mos8563_device, register_r, register_w)
258260   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE_LEGACY("cia_0", mos6526_r, mos6526_w)
259261   AM_RANGE(0xdd00, 0xddff) AM_DEVREADWRITE_LEGACY("cia_1", mos6526_r, mos6526_w)
260262/*  AM_RANGE(0xdf00, 0xdfff) AM_READWRITE_LEGACY(dma_port_r, dma_port_w) */
r17712r17713
501503   PORT_CONFSETTING( 0x20, "Swedish/Finnish" )
502504INPUT_PORTS_END
503505
504
505506/*************************************
506507 *
507 *  Graphics definitions
508 *
509 *************************************/
510
511static const unsigned char vic2_palette[] =
512{
513/* black, white, red, cyan */
514/* purple, green, blue, yellow */
515/* orange, brown, light red, dark gray, */
516/* medium gray, light green, light blue, light gray */
517/* taken from the vice emulator */
518   0x00, 0x00, 0x00,  0xfd, 0xfe, 0xfc,  0xbe, 0x1a, 0x24,  0x30, 0xe6, 0xc6,
519   0xb4, 0x1a, 0xe2,  0x1f, 0xd2, 0x1e,  0x21, 0x1b, 0xae,  0xdf, 0xf6, 0x0a,
520   0xb8, 0x41, 0x04,  0x6a, 0x33, 0x04,  0xfe, 0x4a, 0x57,  0x42, 0x45, 0x40,
521   0x70, 0x74, 0x6f,  0x59, 0xfe, 0x59,  0x5f, 0x53, 0xfe,  0xa4, 0xa7, 0xa2
522};
523
524/* permutation for c64/vic6567 conversion to vdc8563
525 0 --> 0 black
526 1 --> 0xf white
527 2 --> 8 red
528 3 --> 7 cyan
529 4 --> 0xb violett
530 5 --> 4 green
531 6 --> 2 blue
532 7 --> 0xd yellow
533 8 --> 0xa orange
534 9 --> 0xc brown
535 0xa --> 9 light red
536 0xb --> 6 dark gray
537 0xc --> 1 gray
538 0xd --> 5 light green
539 0xe --> 3 light blue
540 0xf --> 0xf light gray
541 */
542
543/* c128
544 commodore assignment!?
545 black gray orange yellow dardgrey vio red lgreen
546 lred lgray brown blue white green cyan lblue
547*/
548const unsigned char vdc8563_palette[] =
549{
550#if 0
551   0x00, 0x00, 0x00, /* black */
552   0x70, 0x74, 0x6f, /* gray */
553   0x21, 0x1b, 0xae, /* blue */
554   0x5f, 0x53, 0xfe, /* light blue */
555   0x1f, 0xd2, 0x1e, /* green */
556   0x59, 0xfe, 0x59, /* light green */
557   0x42, 0x45, 0x40, /* dark gray */
558   0x30, 0xe6, 0xc6, /* cyan */
559   0xbe, 0x1a, 0x24, /* red */
560   0xfe, 0x4a, 0x57, /* light red */
561   0xb8, 0x41, 0x04, /* orange */
562   0xb4, 0x1a, 0xe2, /* purple */
563   0x6a, 0x33, 0x04, /* brown */
564   0xdf, 0xf6, 0x0a, /* yellow */
565   0xa4, 0xa7, 0xa2, /* light gray */
566   0xfd, 0xfe, 0xfc /* white */
567#else
568   /* vice */
569   0x00, 0x00, 0x00, /* black */
570   0x20, 0x20, 0x20, /* gray */
571   0x00, 0x00, 0x80, /* blue */
572   0x00, 0x00, 0xff, /* light blue */
573   0x00, 0x80, 0x00, /* green */
574   0x00, 0xff, 0x00, /* light green */
575   0x00, 0x80, 0x80, /* cyan */
576   0x00, 0xff, 0xff, /* light cyan */
577   0x80, 0x00, 0x00, /* red */
578   0xff, 0x00, 0x00, /* light red */
579   0x80, 0x00, 0x80, /* purble */
580   0xff, 0x00, 0xff, /* light purble */
581   0x80, 0x80, 0x00, /* brown */
582   0xff, 0xff, 0x00, /* yellow */
583   0xc0, 0xc0, 0xc0, /* light gray */
584   0xff, 0xff, 0xff  /* white */
585#endif
586};
587
588static PALETTE_INIT( c128 )
589{
590   int i;
591
592   for (i = 0; i < sizeof(vic2_palette) / 3; i++)
593   {
594      palette_set_color_rgb(machine, i, vic2_palette[i * 3], vic2_palette[i * 3 + 1], vic2_palette[i * 3 + 2]);
595   }
596
597   for (i = 0; i < sizeof(vdc8563_palette) / 3; i++)
598   {
599      palette_set_color_rgb(machine, i + sizeof(vic2_palette) / 3, vdc8563_palette[i * 3], vdc8563_palette[i * 3 + 1], vdc8563_palette[i * 3 + 2]);
600   }
601}
602
603static const gfx_layout c128_charlayout =
604{
605   8,16,
606   512,                                    /* 256 characters */
607   1,                      /* 1 bits per pixel */
608   { 0 },                  /* no bitplanes; 1 bit per pixel */
609   /* x offsets */
610   { 0,1,2,3,4,5,6,7 },
611   /* y offsets */
612   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
613     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8
614   },
615   8*16
616};
617
618static const gfx_layout c128graphic_charlayout =
619{
620   8,1,
621   256,                                    /* 256 characters */
622   1,                      /* 1 bits per pixel */
623   { 0 },                  /* no bitplanes; 1 bit per pixel */
624   /* x offsets */
625   { 0,1,2,3,4,5,6,7 },
626   /* y offsets */
627   { 0 },
628   8
629};
630
631static GFXDECODE_START( c128 )
632   GFXDECODE_ENTRY( "gfx1", 0x0000, c128_charlayout, 0, 0x100 )
633   GFXDECODE_ENTRY( "gfx2", 0x0000, c128graphic_charlayout, 0, 0x100 )
634GFXDECODE_END
635
636
637
638/*************************************
639 *
640508 *  Sound definitions
641509 *
642510 *************************************/
r17712r17713
669537   DEVCB_NULL,               /* write_indexed_func */
670538   DEVCB_HANDLER(c128_m6510_port_read),   /* port_read_func */
671539   DEVCB_HANDLER(c128_m6510_port_write),   /* port_write_func */
672   0x00,
673   0x00
540   0x07,
541   0x20
674542};
675543
676544static CBM_IEC_INTERFACE( cbm_iec_intf )
r17712r17713
708576   return ioport("CTRLSEL")->read() & 0x08;
709577}
710578
711static const vic2_interface c128_vic2_ntsc_intf = {
712   "screen",
713   "maincpu",
714   VIC8564,
715   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_x_cb),
716   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_y_cb),
717   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_button_cb),
718   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read),
719   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read_color),
720   DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt),
721   DEVCB_DRIVER_MEMBER(c128_state, vic_rdy_cb)
722};
579static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, c128_state )
580   AM_RANGE(0x0000, 0x3fff) AM_READ(vic_dma_read)
581ADDRESS_MAP_END
723582
724static const vic2_interface c128_vic2_pal_intf = {
583static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, c128_state )
584   AM_RANGE(0x000, 0x3ff) AM_READ(vic_dma_read_color)
585ADDRESS_MAP_END
586
587static MOS8564_INTERFACE( vic_intf )
588{
725589   "screen",
726590   "maincpu",
727   VIC8566,
591   DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt),
592   DEVCB_NULL,
728593   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_x_cb),
729594   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_y_cb),
730595   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_button_cb),
731   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read),
732   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read_color),
733   DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt),
734596   DEVCB_DRIVER_MEMBER(c128_state, vic_rdy_cb)
735597};
736598
737static const vdc8563_interface c128_vdc8563_intf = {
738   "screen",
739   0
599static MC6845_UPDATE_ROW( vdc_update_row )
600{
601    mos8563_device *mos8563 = static_cast<mos8563_device *>(device);
602
603    mos8563->update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, param);
604}
605
606static const mc6845_interface vdc_intf =
607{
608   "screen80",
609   8,
610   NULL,
611   vdc_update_row,
612   NULL,
613   DEVCB_NULL,
614   DEVCB_NULL,
615   DEVCB_NULL,
616   DEVCB_NULL,
617   NULL
740618};
741619
620static ADDRESS_MAP_START( vdc_videoram_map, AS_0, 8, c128_state )
621   AM_RANGE(0x0000, 0xffff) AM_RAM
622ADDRESS_MAP_END
623
742624/*************************************
743625
744626 *
r17712r17713
764646   MCFG_MACHINE_RESET( c128 )
765647
766648   /* video hardware */
767   MCFG_SCREEN_ADD("screen", RASTER)
768   MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE)
769   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
770   MCFG_SCREEN_SIZE(VIC6567_COLUMNS * 2, VIC6567_LINES)
771   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1)
772   MCFG_SCREEN_UPDATE_STATIC( c128 )
649   MCFG_MOS8564_ADD("vic2e", "screen", VIC6567_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
650   MCFG_MOS8563_ADD("vdc8563", "screen80", 2000000, vdc_intf, vdc_videoram_map)
773651
774   MCFG_GFXDECODE( c128 )
775   MCFG_PALETTE_LENGTH((ARRAY_LENGTH(vic2_palette) + ARRAY_LENGTH(vdc8563_palette)) / 3 )
776   MCFG_PALETTE_INIT( c128 )
777
778   MCFG_VIC2_ADD("vic2e", c128_vic2_ntsc_intf)
779   MCFG_VDC8563_ADD("vdc8563", c128_vdc8563_intf)
780
781652   /* sound hardware */
782653   MCFG_SPEAKER_STANDARD_MONO("mono")
783654   MCFG_SOUND_ADD("sid6581", SID6581, VIC6567_CLOCK)
r17712r17713
827698   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
828699MACHINE_CONFIG_END
829700
830static MACHINE_CONFIG_DERIVED( c128pal, c128 )
831   MCFG_CPU_MODIFY("maincpu")
832   MCFG_CPU_CLOCK( VIC6569_CLOCK)
833   MCFG_CPU_MODIFY("m8502")
834   MCFG_CPU_CLOCK( VIC6569_CLOCK)
701static MACHINE_CONFIG_START( c128pal, c128_state )
702   /* basic machine hardware */
703   MCFG_CPU_ADD("maincpu", Z80, VIC6569_CLOCK)
704   MCFG_CPU_PROGRAM_MAP( c128_z80_mem)
705   MCFG_CPU_IO_MAP( c128_z80_io)
706   MCFG_CPU_VBLANK_INT("screen", c128_frame_interrupt)
707   //MCFG_CPU_PERIODIC_INT(vic2_raster_irq, VIC6569_HRETRACERATE)
708
709   MCFG_CPU_ADD("m8502", M8502, VIC6569_CLOCK)
710   MCFG_CPU_PROGRAM_MAP( c128_mem)
835711   MCFG_CPU_CONFIG( c128_m8502_interface )
712   MCFG_CPU_VBLANK_INT("screen", c128_frame_interrupt)
713   // MCFG_CPU_PERIODIC_INT(vic2_raster_irq, VIC6569_HRETRACERATE)
836714
837   MCFG_SCREEN_MODIFY("screen")
838   MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE)
839   MCFG_SCREEN_SIZE(VIC6569_COLUMNS * 2, VIC6569_LINES)
840   MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1)
715   MCFG_MACHINE_START( c128 )
716   MCFG_MACHINE_RESET( c128 )
841717
842   MCFG_DEVICE_REMOVE("vic2e")
843   MCFG_VIC2_ADD("vic2e", c128_vic2_pal_intf)
718   /* video hardware */
719   MCFG_MOS8566_ADD("vic2e", "screen", VIC6569_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
720   MCFG_MOS8563_ADD("vdc8563", "screen80", 2000000, vdc_intf, vdc_videoram_map)
844721
845722   /* sound hardware */
846   MCFG_SOUND_REPLACE("sid6581", SID6581, VIC6569_CLOCK)
723   MCFG_SPEAKER_STANDARD_MONO("mono")
724   MCFG_SOUND_ADD("sid6581", SID6581, VIC6569_CLOCK)
847725   MCFG_SOUND_CONFIG(c128_sound_interface)
726   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
727   MCFG_SOUND_ADD("dac", DAC, 0)
728   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
848729
730   /* quickload */
731   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
732
733   /* cassette */
734   MCFG_CASSETTE_ADD( CASSETTE_TAG, cbm_cassette_interface )
735
849736   /* cia */
850   MCFG_DEVICE_REMOVE("cia_0")
851   MCFG_DEVICE_REMOVE("cia_1")
852   MCFG_MOS6526R1_ADD("cia_0", VIC6569_CLOCK, c128_pal_cia0)
853   MCFG_MOS6526R1_ADD("cia_1", VIC6569_CLOCK, c128_pal_cia1)
737   MCFG_MOS6526R1_ADD("cia_0", VIC6569_CLOCK, c128_ntsc_cia0)
738   MCFG_MOS6526R1_ADD("cia_1", VIC6569_CLOCK, c128_ntsc_cia1)
739
740   MCFG_FRAGMENT_ADD(c64_cartslot)
741   MCFG_SOFTWARE_LIST_ADD("c64_disk_list", "c64_flop")
742   MCFG_SOFTWARE_LIST_ADD("c128_disk_list", "c128_flop")
854743MACHINE_CONFIG_END
855744
856745static MACHINE_CONFIG_DERIVED( c128dpal, c128pal )
857746MACHINE_CONFIG_END
858747
859static MACHINE_CONFIG_DERIVED( c128dcrp, c128dcr )
860   MCFG_CPU_MODIFY("maincpu")
861   MCFG_CPU_CLOCK( VIC6569_CLOCK)
862   MCFG_CPU_MODIFY("m8502")
863   MCFG_CPU_CLOCK( VIC6569_CLOCK)
864   MCFG_CPU_CONFIG( c128_m8502_interface )
865
866   MCFG_SCREEN_MODIFY("screen")
867   MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE)
868   MCFG_SCREEN_SIZE(VIC6569_COLUMNS * 2, VIC6569_LINES)
869   MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1)
870
871   MCFG_DEVICE_REMOVE("vic2e")
872   MCFG_VIC2_ADD("vic2e", c128_vic2_pal_intf)
873
874   /* sound hardware */
875   MCFG_SOUND_REPLACE("sid6581", SID6581, VIC6569_CLOCK)
876   MCFG_SOUND_CONFIG(c128_sound_interface)
877
878   /* cia */
879   MCFG_DEVICE_REMOVE("cia_0")
880   MCFG_DEVICE_REMOVE("cia_1")
881   MCFG_MOS6526R1_ADD("cia_0", VIC6569_CLOCK, c128_pal_cia0)
882   MCFG_MOS6526R1_ADD("cia_1", VIC6569_CLOCK, c128_pal_cia1)
748static MACHINE_CONFIG_DERIVED( c128dcrp, c128pal )
749   MCFG_CBM_IEC_BUS_ADD(cbm_iec_intf)
750   MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, NULL, NULL)
751   MCFG_CBM_IEC_SLOT_ADD("iec8", 8, c128dcr_iec_devices, "c1571cr", NULL)
752   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL)
753   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
754   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
883755MACHINE_CONFIG_END
884756
885757

Previous 199869 Revisions Next


© 1997-2024 The MAME Team