Previous 199869 Revisions Next

r20985 Tuesday 12th February, 2013 at 15:21:24 UTC by Curt Coder
Modernized the MOS6526, MOS6560, MOS7360, MOS6581, CBM IEC, and IEEE-488 devices. [Curt Coder]
[src/emu/machine]mos6526.c mos6526.h
[src/emu/sound]mos6560.c mos6560.h mos6581.c* mos6581.h* mos7360.c* mos7360.h* sid.h sid6581.c sid6581.h sidvoice.c sidvoice.h sound.mak
[src/mame/drivers]attckufo.c
[src/mess]mess.mak
[src/mess/audio]mos7360.c mos7360.h
[src/mess/drivers]c128.c c64.c c65.c cbm2.c osborne1.c pet2001.c plus4.c primo.c sage2.c tek405x.c vic10.c vic20.c victor9k.c vixen.c
[src/mess/includes]c128.h c64.h cbm2.h plus4.h vic10.h vic20.h
[src/mess/machine]c1571.c c1571.h c1581.c c1581.h c64_ieee488.c c64_legacy.c c65.c cbmiec.c cbmiec.h cbmipt.h ieee488.c ieee488.h interpod.c isa_ssi2001.c isa_ssi2001.h plus4_sid.c plus4_sid.h vic1112.c
[src/mess/video]mos6566.c mos6566.h

trunk/src/mame/drivers/attckufo.c
r20984r20985
6969
7070   DECLARE_READ8_MEMBER( vic_videoram_r );
7171   DECLARE_READ8_MEMBER( vic_colorram_r );
72   INTERRUPT_GEN_MEMBER(attckufo_raster_interrupt);
7372};
7473
7574READ8_MEMBER(attckufo_state::attckufo_io_r)
r20984r20985
148147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
149148INPUT_PORTS_END
150149
151
152INTERRUPT_GEN_MEMBER(attckufo_state::attckufo_raster_interrupt)
153{
154   m_mos6560->raster_interrupt_gen();
155}
156
157static MOS6560_INTERFACE( vic_intf )
158{
159   "screen",
160   DEVCB_NULL,
161   DEVCB_NULL
162};
163
164
165150static MACHINE_CONFIG_START( attckufo, attckufo_state )
166151   /* basic machine hardware */
167152   MCFG_CPU_ADD("maincpu", M6502, 14318181/14)
168153   MCFG_CPU_PROGRAM_MAP(cpu_map)
169   MCFG_CPU_PERIODIC_INT_DRIVER(attckufo_state, attckufo_raster_interrupt,  MOS656X_HRETRACERATE)
170154
171155   /* video hardware */
172   MCFG_MOS656X_ATTACK_UFO_ADD("mos6560", "screen", 14318181/14, vic_intf, vic_videoram_map, vic_colorram_map)
156   MCFG_MOS656X_ATTACK_UFO_ADD("mos6560", "screen", 14318181/14, vic_videoram_map, vic_colorram_map)
173157MACHINE_CONFIG_END
174158
175159ROM_START( attckufo )
trunk/src/emu/sound/sid6581.c
r20984r20985
1/***************************************************************************
2
3    sid6581.c
4
5    MAME/MESS interface for SID6581 and SID8580 chips
6
7***************************************************************************/
8
9#include "emu.h"
10#include "sid6581.h"
11#include "sid.h"
12
13
14
15static SID6581_t *get_sid(device_t *device)
16{
17   assert(device != NULL);
18   assert((device->type() == SID6581) || (device->type() == SID8580));
19   return (SID6581_t *) downcast<sid6581_device *>(device)->token();
20}
21
22
23
24static STREAM_UPDATE( sid_update )
25{
26   SID6581_t *sid = (SID6581_t *) param;
27   sidEmuFillBuffer(sid, outputs[0], samples);
28}
29
30
31
32static void sid_start(device_t *device, SIDTYPE sidtype)
33{
34   SID6581_t *sid = get_sid(device);
35   const sid6581_interface *iface = (const sid6581_interface*) device->static_config();
36   assert(iface);
37
38   // resolve callbacks
39   sid->in_potx_func.resolve(iface->in_potx_cb, *device);
40   sid->in_poty_func.resolve(iface->in_poty_cb, *device);
41
42   sid->device = device;
43   sid->mixer_channel = device->machine().sound().stream_alloc(*device, 0, 1,  device->machine().sample_rate(), (void *) sid, sid_update);
44   sid->PCMfreq = device->machine().sample_rate();
45   sid->clock = device->clock();
46   sid->type = sidtype;
47
48   sid6581_init(sid);
49   sidInitWaveformTables(sidtype);
50}
51
52
53
54static DEVICE_RESET( sid )
55{
56   SID6581_t *sid = get_sid(device);
57   sidEmuReset(sid);
58}
59
60
61
62static DEVICE_START( sid6581 )
63{
64   sid_start(device, MOS6581);
65}
66
67
68
69static DEVICE_START( sid8580 )
70{
71   sid_start(device, MOS8580);
72}
73
74
75
76READ8_MEMBER( sid6581_device::read )
77{
78   return sid6581_port_r(machine(), get_sid(this), offset);
79}
80
81
82WRITE8_MEMBER( sid6581_device::write )
83{
84   sid6581_port_w(get_sid(this), offset, data);
85}
86
87const device_type SID6581 = &device_creator<sid6581_device>;
88
89sid6581_device::sid6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
90   : device_t(mconfig, SID6581, "SID6581", tag, owner, clock),
91      device_sound_interface(mconfig, *this)
92{
93   m_token = global_alloc_clear(SID6581_t);
94}
95sid6581_device::sid6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
96   : device_t(mconfig, type, name, tag, owner, clock),
97      device_sound_interface(mconfig, *this)
98{
99   m_token = global_alloc_clear(SID6581_t);
100}
101
102//-------------------------------------------------
103//  device_config_complete - perform any
104//  operations now that the configuration is
105//  complete
106//-------------------------------------------------
107
108void sid6581_device::device_config_complete()
109{
110}
111
112//-------------------------------------------------
113//  device_start - device-specific startup
114//-------------------------------------------------
115
116void sid6581_device::device_start()
117{
118   DEVICE_START_NAME( sid6581 )(this);
119}
120
121//-------------------------------------------------
122//  device_reset - device-specific reset
123//-------------------------------------------------
124
125void sid6581_device::device_reset()
126{
127   DEVICE_RESET_NAME( sid )(this);
128}
129
130//-------------------------------------------------
131//  sound_stream_update - handle a stream update
132//-------------------------------------------------
133
134void sid6581_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
135{
136   // should never get here
137   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
138}
139
140
141const device_type SID8580 = &device_creator<sid8580_device>;
142
143sid8580_device::sid8580_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
144   : sid6581_device(mconfig, SID8580, "SID8580", tag, owner, clock)
145{
146}
147
148//-------------------------------------------------
149//  device_start - device-specific startup
150//-------------------------------------------------
151
152void sid8580_device::device_start()
153{
154   DEVICE_START_NAME( sid8580 )(this);
155}
156
157//-------------------------------------------------
158//  sound_stream_update - handle a stream update
159//-------------------------------------------------
160
161void sid8580_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
162{
163   // should never get here
164   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
165}
trunk/src/emu/sound/sid6581.h
r20984r20985
1/***************************************************************************
2
3    sid6581.h
4
5    MAME/MESS interface for SID6581 and SID8580 chips
6
7***************************************************************************/
8
9#pragma once
10
11#ifndef __SID6581_H__
12#define __SID6581_H__
13
14#include "devlegcy.h"
15
16
17enum SIDTYPE
18{
19   MOS6581,
20   MOS8580
21};
22
23#define MOS6581_INTERFACE(name) \
24   const sid6581_interface (name) =
25
26struct sid6581_interface
27{
28   devcb_read8 in_potx_cb;
29   devcb_read8 in_poty_cb;
30};
31
32struct SID6581_t;
33
34class sid6581_device : public device_t,
35                  public device_sound_interface
36{
37public:
38   sid6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
39   sid6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
40   ~sid6581_device() { global_free(m_token); }
41
42   // access to legacy token
43   void *token() const { assert(m_token != NULL); return m_token; }
44
45   DECLARE_READ8_MEMBER( read );
46   DECLARE_WRITE8_MEMBER( write );
47
48protected:
49   // device-level overrides
50   virtual void device_config_complete();
51   virtual void device_start();
52   virtual void device_reset();
53
54   // sound stream update overrides
55   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
56private:
57   // internal state
58   SID6581_t *m_token;
59};
60
61extern const device_type SID6581;
62
63class sid8580_device : public sid6581_device
64{
65public:
66   sid8580_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
67protected:
68   // device-level overrides
69   virtual void device_start();
70
71   // sound stream update overrides
72   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
73};
74
75extern const device_type SID8580;
76
77
78#endif /* __SID6581_H__ */
trunk/src/emu/sound/mos7360.c
r0r20985
1/**********************************************************************
2
3    MOS 7360/8360 Text Edit Device (TED) emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "emu.h"
11#include "mos7360.h"
12
13
14
15//**************************************************************************
16//  MACROS / CONSTANTS
17//**************************************************************************
18
19#define LOG 0
20
21
22#define VERBOSE_LEVEL 0
23#define DBG_LOG(N,M,A) \
24   do { \
25      if(VERBOSE_LEVEL >= N) \
26      { \
27         if( M ) \
28            logerror("%11.6f: %-24s", machine().time().as_double(), (char*) M ); \
29         logerror A; \
30      } \
31   } while(0)
32
33
34#define VREFRESHINLINES 28
35
36#define TIMER1HELPER (m_reg[0] | (m_reg[1] << 8))
37#define TIMER2HELPER (m_reg[2] | (m_reg[3] << 8))
38#define TIMER3HELPER (m_reg[4] | (m_reg[5] << 8))
39#define TIMER1 (TIMER1HELPER ? TIMER1HELPER : 0x10000)
40#define TIMER2 (TIMER2HELPER ? TIMER2HELPER : 0x10000)
41#define TIMER3 (TIMER3HELPER ? TIMER3HELPER : 0x10000)
42
43#define TED7360_YPOS            40
44#define RASTERLINE_2_C16(a)    ((a + m_lines - TED7360_YPOS - 5) % m_lines)
45#define C16_2_RASTERLINE(a)    ((a + TED7360_YPOS + 5) % m_lines)
46#define XPOS 8
47#define YPOS 8
48
49#define SCREENON               (m_reg[6] & 0x10)
50#define TEST                   (m_reg[6] & 0x80)
51#define VERTICALPOS            (m_reg[6] & 0x07)
52#define HORICONTALPOS          (m_reg[7] & 0x07)
53#define ECMON                  (m_reg[6] & 0x40)
54#define HIRESON                (m_reg[6] & 0x20)
55#define MULTICOLORON           (m_reg[7] & 0x10)
56#define REVERSEON              (!(m_reg[7] & 0x80))
57
58/* hardware inverts character when bit 7 set (character taken &0x7f) */
59/* instead of fetching character with higher number! */
60#define LINES25     (m_reg[6] & 0x08)     /* else 24 Lines */
61#define LINES       (LINES25 ? 25 : 24)
62#define YSIZE       (LINES * 8)
63#define COLUMNS40   (m_reg[7] & 0x08)     /* else 38 Columns */
64#define COLUMNS     (COLUMNS40 ? 40 : 38)
65#define XSIZE       (COLUMNS * 8)
66
67#define INROM       (m_reg[0x12] & 0x04)
68#define CHARGENADDR (REVERSEON && !HIRESON && !MULTICOLORON ? ((m_reg[0x13] & 0xfc) << 8) : ((m_reg[0x13] & 0xf8) << 8))
69#define BITMAPADDR  ((m_reg[0x12] & 0x38) << 10)
70#define VIDEOADDR   ((m_reg[0x14] & 0xf8) << 8)
71
72#define RASTERLINE  (((m_reg[0xa] & 0x01) << 8) | m_reg[0xb])
73#define CURSOR1POS  (m_reg[0xd] | ((m_reg[0xc] & 0x03) << 8))
74#define CURSOR2POS  (m_reg[0x1b] | ((m_reg[0x1a] & 0x03) << 8))
75#define CURSORRATE  ((m_reg[0x1f] & 0x7c) >> 2)
76
77#define BACKGROUNDCOLOR (m_reg[0x15] & 0x7f)
78#define FOREGROUNDCOLOR (m_reg[0x16] & 0x7f)
79#define MULTICOLOR1     (m_reg[0x17] & 0x7f)
80#define MULTICOLOR2     (m_reg[0x18] & 0x7f)
81#define FRAMECOLOR      (m_reg[0x19] & 0x7f)
82
83#define TED7360_CLOCK        (m_clock / 4)
84#define TED7360_VRETRACERATE ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_VRETRACERATE : TED7360NTSC_VRETRACERATE)
85#define TED7360_LINES        ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_LINES : TED7360NTSC_LINES)
86
87static const rgb_t PALETTE[] =
88{
89/* black, white, red, cyan */
90/* purple, green, blue, yellow */
91/* orange, light orange, pink, light cyan, */
92/* light violett, light green, light blue, light yellow */
93/* these 16 colors are 8 times here in different luminance (dark..light) */
94/* taken from digitized tv screenshot */
95   MAKE_RGB(0x06, 0x01, 0x03), MAKE_RGB(0x2b, 0x2b, 0x2b), MAKE_RGB(0x67, 0x0e, 0x0f), MAKE_RGB(0x00, 0x3f, 0x42),
96   MAKE_RGB(0x57, 0x00, 0x6d), MAKE_RGB(0x00, 0x4e, 0x00), MAKE_RGB(0x19, 0x1c, 0x94), MAKE_RGB(0x38, 0x38, 0x00),
97   MAKE_RGB(0x56, 0x20, 0x00), MAKE_RGB(0x4b, 0x28, 0x00), MAKE_RGB(0x16, 0x48, 0x00), MAKE_RGB(0x69, 0x07, 0x2f),
98   MAKE_RGB(0x00, 0x46, 0x26), MAKE_RGB(0x06, 0x2a, 0x80), MAKE_RGB(0x2a, 0x14, 0x9b), MAKE_RGB(0x0b, 0x49, 0x00),
99
100   MAKE_RGB(0x00, 0x03, 0x02), MAKE_RGB(0x3d, 0x3d, 0x3d), MAKE_RGB(0x75, 0x1e, 0x20), MAKE_RGB(0x00, 0x50, 0x4f),
101   MAKE_RGB(0x6a, 0x10, 0x78), MAKE_RGB(0x04, 0x5c, 0x00), MAKE_RGB(0x2a, 0x2a, 0xa3), MAKE_RGB(0x4c, 0x47, 0x00),
102   MAKE_RGB(0x69, 0x2f, 0x00), MAKE_RGB(0x59, 0x38, 0x00), MAKE_RGB(0x26, 0x56, 0x00), MAKE_RGB(0x75, 0x15, 0x41),
103   MAKE_RGB(0x00, 0x58, 0x3d), MAKE_RGB(0x15, 0x3d, 0x8f), MAKE_RGB(0x39, 0x22, 0xae), MAKE_RGB(0x19, 0x59, 0x00),
104
105   MAKE_RGB(0x00, 0x03, 0x04), MAKE_RGB(0x42, 0x42, 0x42), MAKE_RGB(0x7b, 0x28, 0x20), MAKE_RGB(0x02, 0x56, 0x59),
106   MAKE_RGB(0x6f, 0x1a, 0x82), MAKE_RGB(0x0a, 0x65, 0x09), MAKE_RGB(0x30, 0x34, 0xa7), MAKE_RGB(0x50, 0x51, 0x00),
107   MAKE_RGB(0x6e, 0x36, 0x00), MAKE_RGB(0x65, 0x40, 0x00), MAKE_RGB(0x2c, 0x5c, 0x00), MAKE_RGB(0x7d, 0x1e, 0x45),
108   MAKE_RGB(0x01, 0x61, 0x45), MAKE_RGB(0x1c, 0x45, 0x99), MAKE_RGB(0x42, 0x2d, 0xad), MAKE_RGB(0x1d, 0x62, 0x00),
109
110   MAKE_RGB(0x05, 0x00, 0x02), MAKE_RGB(0x56, 0x55, 0x5a), MAKE_RGB(0x90, 0x3c, 0x3b), MAKE_RGB(0x17, 0x6d, 0x72),
111   MAKE_RGB(0x87, 0x2d, 0x99), MAKE_RGB(0x1f, 0x7b, 0x15), MAKE_RGB(0x46, 0x49, 0xc1), MAKE_RGB(0x66, 0x63, 0x00),
112   MAKE_RGB(0x84, 0x4c, 0x0d), MAKE_RGB(0x73, 0x55, 0x00), MAKE_RGB(0x40, 0x72, 0x00), MAKE_RGB(0x91, 0x33, 0x5e),
113   MAKE_RGB(0x19, 0x74, 0x5c), MAKE_RGB(0x32, 0x59, 0xae), MAKE_RGB(0x59, 0x3f, 0xc3), MAKE_RGB(0x32, 0x76, 0x00),
114
115   MAKE_RGB(0x02, 0x01, 0x06), MAKE_RGB(0x84, 0x7e, 0x85), MAKE_RGB(0xbb, 0x67, 0x68), MAKE_RGB(0x45, 0x96, 0x96),
116   MAKE_RGB(0xaf, 0x58, 0xc3), MAKE_RGB(0x4a, 0xa7, 0x3e), MAKE_RGB(0x73, 0x73, 0xec), MAKE_RGB(0x92, 0x8d, 0x11),
117   MAKE_RGB(0xaf, 0x78, 0x32), MAKE_RGB(0xa1, 0x80, 0x20), MAKE_RGB(0x6c, 0x9e, 0x12), MAKE_RGB(0xba, 0x5f, 0x89),
118   MAKE_RGB(0x46, 0x9f, 0x83), MAKE_RGB(0x61, 0x85, 0xdd), MAKE_RGB(0x84, 0x6c, 0xef), MAKE_RGB(0x5d, 0xa3, 0x29),
119
120   MAKE_RGB(0x02, 0x00, 0x0a), MAKE_RGB(0xb2, 0xac, 0xb3), MAKE_RGB(0xe9, 0x92, 0x92), MAKE_RGB(0x6c, 0xc3, 0xc1),
121   MAKE_RGB(0xd9, 0x86, 0xf0), MAKE_RGB(0x79, 0xd1, 0x76), MAKE_RGB(0x9d, 0xa1, 0xff), MAKE_RGB(0xbd, 0xbe, 0x40),
122   MAKE_RGB(0xdc, 0xa2, 0x61), MAKE_RGB(0xd1, 0xa9, 0x4c), MAKE_RGB(0x93, 0xc8, 0x3d), MAKE_RGB(0xe9, 0x8a, 0xb1),
123   MAKE_RGB(0x6f, 0xcd, 0xab), MAKE_RGB(0x8a, 0xb4, 0xff), MAKE_RGB(0xb2, 0x9a, 0xff), MAKE_RGB(0x88, 0xcb, 0x59),
124
125   MAKE_RGB(0x02, 0x00, 0x0a), MAKE_RGB(0xc7, 0xca, 0xc9), MAKE_RGB(0xff, 0xac, 0xac), MAKE_RGB(0x85, 0xd8, 0xe0),
126   MAKE_RGB(0xf3, 0x9c, 0xff), MAKE_RGB(0x92, 0xea, 0x8a), MAKE_RGB(0xb7, 0xba, 0xff), MAKE_RGB(0xd6, 0xd3, 0x5b),
127   MAKE_RGB(0xf3, 0xbe, 0x79), MAKE_RGB(0xe6, 0xc5, 0x65), MAKE_RGB(0xb0, 0xe0, 0x57), MAKE_RGB(0xff, 0xa4, 0xcf),
128   MAKE_RGB(0x89, 0xe5, 0xc8), MAKE_RGB(0xa4, 0xca, 0xff), MAKE_RGB(0xca, 0xb3, 0xff), MAKE_RGB(0xa2, 0xe5, 0x7a),
129
130   MAKE_RGB(0x01, 0x01, 0x01), MAKE_RGB(0xff, 0xff, 0xff), MAKE_RGB(0xff, 0xf6, 0xf2), MAKE_RGB(0xd1, 0xff, 0xff),
131   MAKE_RGB(0xff, 0xe9, 0xff), MAKE_RGB(0xdb, 0xff, 0xd3), MAKE_RGB(0xfd, 0xff, 0xff), MAKE_RGB(0xff, 0xff, 0xa3),
132   MAKE_RGB(0xff, 0xff, 0xc1), MAKE_RGB(0xff, 0xff, 0xb2), MAKE_RGB(0xfc, 0xff, 0xa2), MAKE_RGB(0xff, 0xee, 0xff),
133   MAKE_RGB(0xd1, 0xff, 0xff), MAKE_RGB(0xeb, 0xff, 0xff), MAKE_RGB(0xff, 0xf8, 0xff), MAKE_RGB(0xed, 0xff, 0xbc)
134};
135
136
137#define NOISE_BUFFER_SIZE_SEC 5
138
139#define TONE_ON         (!(m_reg[0x11] & 0x80))     /* or tone update!? */
140#define TONE1_ON        ((m_reg[0x11] & 0x10))
141#define TONE1_VALUE     (m_reg[0x0e] | ((m_reg[0x12] & 3) << 8))
142#define TONE2_ON        ((m_reg[0x11] & 0x20))
143#define TONE2_VALUE     (m_reg[0x0f] | ((m_reg[0x10] & 3) << 8))
144#define VOLUME          (m_reg[0x11] & 0x0f)
145#define NOISE_ON        (m_reg[0x11] & 0x40)
146
147/*
148 * pal 111860.781
149 * ntsc 111840.45
150 */
151#define TONE_FREQUENCY(reg)         ((TED7360_CLOCK >> 3) / (1024 - reg))
152#define TONE_FREQUENCY_MIN          (TONE_FREQUENCY(0))
153#define NOISE_FREQUENCY             (TED7360_CLOCK / 8 / (1024 - TONE2_VALUE))
154#define NOISE_FREQUENCY_MAX         (TED7360_CLOCK / 8)
155
156
157//**************************************************************************
158//  GLOBAL VARIABLES
159//**************************************************************************
160
161// device type definition
162const device_type MOS7360 = &device_creator<mos7360_device>;
163
164
165// default address maps
166static ADDRESS_MAP_START( mos7360_videoram_map, AS_0, 8, mos7360_device )
167   AM_RANGE(0x0000, 0xffff) AM_RAM
168ADDRESS_MAP_END
169
170
171//-------------------------------------------------
172//  memory_space_config - return a description of
173//  any address spaces owned by this device
174//-------------------------------------------------
175
176const address_space_config *mos7360_device::memory_space_config(address_spacenum spacenum) const
177{
178   switch (spacenum)
179   {
180      case AS_0: return &m_videoram_space_config;
181      default: return NULL;
182   }
183}
184
185
186
187//**************************************************************************
188//  INLINE HELPERS
189//**************************************************************************
190
191inline void mos7360_device::set_interrupt(int mask)
192{
193   /* kernel itself polls for timer 2 shot (interrupt disabled!) when cassette loading */
194   m_reg[9] |= mask;
195   if ((m_reg[0xa] & m_reg[9] & 0x5e))
196   {
197      if (!(m_reg[9] & 0x80))
198      {
199         //DBG_LOG(1, "ted7360", ("irq start %.2x\n", mask));
200         m_reg[9] |= 0x80;
201         m_write_irq(ASSERT_LINE);
202      }
203   }
204   m_reg[9] |= mask;
205}
206
207inline void mos7360_device::clear_interrupt(int mask)
208{
209   m_reg[9] &= ~mask;
210   if ((m_reg[9] & 0x80) && !(m_reg[9] & m_reg[0xa] & 0x5e))
211   {
212      DBG_LOG(1, "ted7360", ("irq end %.2x\n", mask));
213      m_reg[9] &= ~0x80;
214      m_write_irq(CLEAR_LINE);
215   }
216}
217
218inline int mos7360_device::rastercolumn()
219{
220   return (int) ((machine().time().as_double() - m_rastertime) * TED7360_VRETRACERATE * m_lines * 57 * 8 + 0.5);
221}
222
223inline UINT8 mos7360_device::read_ram(offs_t offset)
224{
225   int rom = m_rom;
226   m_rom = 0;
227
228   m_last_data = space(AS_0).read_byte(offset);
229
230   m_rom = rom;
231
232   return m_last_data;
233}
234
235inline UINT8 mos7360_device::read_rom(offs_t offset)
236{
237   int rom = m_rom;
238   m_rom = 1;
239
240   m_last_data = space(AS_0).read_byte(offset);
241
242   m_rom = rom;
243
244   return m_last_data;
245}
246
247
248
249//**************************************************************************
250//  LIVE DEVICE
251//**************************************************************************
252
253//-------------------------------------------------
254//  mos7360_device - constructor
255//-------------------------------------------------
256
257mos7360_device::mos7360_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
258   : device_t(mconfig, MOS7360, "MOS7360", tag, owner, clock),
259      device_memory_interface(mconfig, *this),
260      device_sound_interface(mconfig, *this),
261      m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mos7360_videoram_map)),
262      m_write_irq(*this),
263      m_read_k(*this),
264      m_stream(NULL)
265{
266}
267
268
269//-------------------------------------------------
270//  device_start - device-specific startup
271//-------------------------------------------------
272
273void mos7360_device::device_start()
274{
275   // get the screen device
276   m_screen = machine().device<screen_device>(m_screen_tag);
277   assert(m_screen != NULL);
278
279   // get the CPU device
280   m_cpu = machine().device<cpu_device>(m_cpu_tag);
281   assert(m_cpu != NULL);
282
283   // resolve callbacks
284   m_write_irq.resolve_safe();
285   m_read_k.resolve_safe(0xff);
286
287   // allocate timers
288   m_timer1 = timer_alloc(TIMER_ID_1);
289   m_timer2 = timer_alloc(TIMER_ID_2);
290   m_timer3 = timer_alloc(TIMER_ID_3);
291   m_line_timer = timer_alloc(TIMER_LINE);
292   m_line_timer->adjust(m_screen->scan_period(), 0, m_screen->scan_period());
293   m_frame_timer = timer_alloc(TIMER_FRAME);
294   m_frame_timer->adjust(m_screen->frame_period(), 0, m_screen->frame_period());
295
296   // allocate screen bitmap
297   m_screen->register_screen_bitmap(m_bitmap);
298
299   // create sound stream
300   m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
301
302   // buffer for fastest played sample for 5 second so we have enough data for min 5 second
303   m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
304   m_noise = auto_alloc_array(machine(), UINT8, m_noisesize);
305
306   {
307      int noiseshift = 0x7ffff8;
308      UINT8 data;
309
310      for (int i = 0; i < m_noisesize; i++)
311      {
312         data = 0;
313         if (noiseshift & 0x400000)
314            data |= 0x80;
315         if (noiseshift & 0x100000)
316            data |= 0x40;
317         if (noiseshift & 0x010000)
318            data |= 0x20;
319         if (noiseshift & 0x002000)
320            data |= 0x10;
321         if (noiseshift & 0x000800)
322            data |= 0x08;
323         if (noiseshift & 0x000080)
324            data |= 0x04;
325         if (noiseshift & 0x000010)
326            data |= 0x02;
327         if (noiseshift & 0x000004)
328            data |= 0x01;
329         m_noise[i] = data;
330         if (((noiseshift & 0x400000) == 0) != ((noiseshift & 0x002000) == 0))
331            noiseshift = (noiseshift << 1) | 1;
332         else
333            noiseshift <<= 1;
334      }
335   }
336
337   // register for state saving
338   //save_item(NAME());
339}
340
341
342//-------------------------------------------------
343//  device_reset - device-specific reset
344//-------------------------------------------------
345
346void mos7360_device::device_reset()
347{
348   memset(m_reg, 0, ARRAY_LENGTH(m_reg));
349
350   m_rom = 1;  // FIXME: at start should be RAM or ROM? old c16 code set it to ROM at init: is it correct?
351
352   m_lines = TED7360_LINES;
353   m_chargenaddr = m_bitmapaddr = m_videoaddr = 0;
354   m_timer1_active = m_timer2_active = m_timer3_active = 0;
355   m_cursor1 = 0;
356
357   m_rasterline = 0;
358   m_lastline = 0;
359
360   m_rastertime = 0.0;
361
362   m_frame_count = 0;
363
364   m_x_begin = 0;
365   m_x_end = 0;
366   m_y_begin = 0;
367   m_y_end = 0;
368
369   memset(m_c16_bitmap, 0, ARRAY_LENGTH(m_c16_bitmap));
370   memset(m_bitmapmulti, 0, ARRAY_LENGTH(m_bitmapmulti));
371   memset(m_mono, 0, ARRAY_LENGTH(m_mono));
372   memset(m_monoinversed, 0, ARRAY_LENGTH(m_monoinversed));
373   memset(m_multi, 0, ARRAY_LENGTH(m_multi));
374   memset(m_ecmcolor, 0, ARRAY_LENGTH(m_ecmcolor));
375   memset(m_colors, 0, ARRAY_LENGTH(m_colors));
376
377   m_tone1pos = 0;
378   m_tone2pos = 0;
379   m_tone1samples = 1;
380   m_tone2samples = 1;
381   m_noisepos = 0;
382   m_noisesamples = 1;
383}
384
385
386//-------------------------------------------------
387//  device_timer - handler timer events
388//-------------------------------------------------
389
390void mos7360_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
391{
392   switch (id)
393   {
394   case TIMER_ID_1:
395      // proved by digisound of several intros like eoroidpro
396      m_timer1->adjust(clocks_to_attotime(TIMER1), 1);
397      m_timer1_active = 1;
398      set_interrupt(0x08);
399      break;
400
401   case TIMER_ID_2:
402      m_timer2->adjust(clocks_to_attotime(0x10000), 2);
403      m_timer2_active = 1;
404      set_interrupt(0x10);
405      break;
406
407   case TIMER_ID_3:
408      m_timer3->adjust(clocks_to_attotime(0x10000), 3);
409      m_timer3_active = 1;
410      set_interrupt(0x40);
411      break;
412   
413   case TIMER_LINE:
414      raster_interrupt_gen();
415      break;
416
417   case TIMER_FRAME:
418      frame_interrupt_gen();
419      break;
420   }
421}
422
423
424//-------------------------------------------------
425//  sound_stream_update - handle update requests for
426//  our sound stream
427//-------------------------------------------------
428
429void mos7360_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
430{
431   int i, v, a;
432   stream_sample_t *buffer = outputs[0];
433
434   for (i = 0; i < samples; i++)
435   {
436      v = 0;
437
438      if (TONE1_ON)
439      {
440         if (m_tone1pos <= m_tone1samples / 2 || !TONE_ON)
441            v += 0x2ff; // depends on the volume between sound and noise
442
443         m_tone1pos++;
444
445         if (m_tone1pos > m_tone1samples)
446            m_tone1pos = 0;
447      }
448
449      if (TONE2_ON || NOISE_ON )
450      {
451         if (TONE2_ON)
452         {                          /*higher priority ?! */
453            if (m_tone2pos <= m_tone2samples / 2 || !TONE_ON)
454               v += 0x2ff;
455
456            m_tone2pos++;
457
458            if (m_tone2pos > m_tone2samples)
459               m_tone2pos = 0;
460         }
461         else
462         {
463            v += m_noise[(int) ((double) m_noisepos * m_noisesize / m_noisesamples)];
464            m_noisepos++;
465
466            if ((double) m_noisepos / m_noisesamples >= 1.0)
467               m_noisepos = 0;
468         }
469      }
470
471      a = VOLUME;
472      if (a > 8)
473         a = 8;
474
475      v = v * a;
476
477      buffer[i] = v;
478   }
479}
480
481
482void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int xoff, UINT16 *color)
483{
484   int y, code;
485
486   for (y = ybegin; y <= yend; y++)
487   {
488      if (INROM)
489         code = read_rom(m_chargenaddr + ch * 8 + y);
490      else
491         code = read_ram(m_chargenaddr + ch * 8 + y);
492
493      m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE[color[code >> 7]];
494      m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[color[(code >> 6) & 1]];
495      m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE[color[(code >> 5) & 1]];
496      m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[color[(code >> 4) & 1]];
497      m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE[color[(code >> 3) & 1]];
498      m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[color[(code >> 2) & 1]];
499      m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE[color[(code >> 1) & 1]];
500      m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[color[code & 1]];
501   }
502}
503
504void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff)
505{
506   int y, code;
507
508   for (y = ybegin; y <= yend; y++)
509   {
510      if (INROM)
511         code = read_rom(m_chargenaddr + ch * 8 + y);
512      else
513         code = read_ram(m_chargenaddr + ch * 8 + y);
514
515      m_bitmap.pix32(y + yoff, 0 + xoff) =
516         m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_multi[code >> 6]];
517      m_bitmap.pix32(y + yoff, 2 + xoff) =
518         m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_multi[(code >> 4) & 3]];
519      m_bitmap.pix32(y + yoff, 4 + xoff) =
520         m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_multi[(code >> 2) & 3]];
521      m_bitmap.pix32(y + yoff, 6 + xoff) =
522         m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_multi[code & 3]];
523   }
524}
525
526void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff)
527{
528   int y, code;
529
530   for (y = ybegin; y <= yend; y++)
531   {
532      code = read_ram(m_bitmapaddr + ch * 8 + y);
533
534      m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE[m_c16_bitmap[code >> 7]];
535      m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_c16_bitmap[(code >> 6) & 1]];
536      m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE[m_c16_bitmap[(code >> 5) & 1]];
537      m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_c16_bitmap[(code >> 4) & 1]];
538      m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE[m_c16_bitmap[(code >> 3) & 1]];
539      m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_c16_bitmap[(code >> 2) & 1]];
540      m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE[m_c16_bitmap[(code >> 1) & 1]];
541      m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_c16_bitmap[code & 1]];
542   }
543}
544
545void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff)
546{
547   int y, code;
548
549   for (y = ybegin; y <= yend; y++)
550   {
551      code = read_ram(m_bitmapaddr + ch * 8 + y);
552
553      m_bitmap.pix32(y + yoff, 0 + xoff) =
554         m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_bitmapmulti[code >> 6]];
555      m_bitmap.pix32(y + yoff, 2 + xoff) =
556         m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_bitmapmulti[(code >> 4) & 3]];
557      m_bitmap.pix32(y + yoff, 4 + xoff) =
558         m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_bitmapmulti[(code >> 2) & 3]];
559      m_bitmap.pix32(y + yoff, 6 + xoff) =
560         m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_bitmapmulti[code & 3]];
561   }
562}
563
564void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int color)
565{
566   int y;
567
568   for (y = ybegin; y <= yend; y++)
569   {
570      for (int x = 0; x < 8; x++)
571      {
572         m_bitmap.pix32(y + yoff, x + xoff) = PALETTE[color];
573      }
574   }
575}
576
577void mos7360_device::drawlines(int first, int last)
578{
579   int line, vline, end;
580   int attr, ch, c1, c2, ecm;
581   int offs, yoff, xoff, ybegin, yend, xbegin, xend;
582   int i;
583
584   m_lastline = last;
585
586   /* top part of display not rastered */
587   first -= TED7360_YPOS;
588   last -= TED7360_YPOS;
589   if ((first >= last) || (last <= 0))
590      return;
591   if (first < 0)
592      first = 0;
593
594   if (!SCREENON)
595   {
596      for (line = first; (line < last) && (line < m_bitmap.height()); line++)
597      {
598         for (int x = 0; x < m_bitmap.width(); x++)
599         {
600            m_bitmap.pix32(line, x) = PALETTE[0];
601         }
602      }
603      return;
604   }
605
606   if (COLUMNS40)
607      xbegin = XPOS, xend = xbegin + 320;
608   else
609      xbegin = XPOS + 7, xend = xbegin + 304;
610
611   if (last < m_y_begin)
612      end = last;
613   else
614      end = m_y_begin + YPOS;
615   {
616      for (line = first; line < end; line++)
617      {
618         for (int x = 0; x < m_bitmap.width(); x++)
619         {
620            m_bitmap.pix32(line, x) = PALETTE[FRAMECOLOR];
621         }
622      }
623   }
624   if (LINES25)
625      vline = line - m_y_begin - YPOS;
626   else
627      vline = line - m_y_begin - YPOS + 8 - VERTICALPOS;
628
629   if (last < m_y_end + YPOS)
630      end = last;
631   else
632      end = m_y_end + YPOS;
633
634   for (; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin)
635   {
636      offs = (vline >> 3) * 40;
637      ybegin = vline & 7;
638      yoff = line - ybegin;
639      yend = (yoff + 7 < end) ? 7 : (end - yoff - 1);
640      /* rendering 39 characters */
641      /* left and right borders are overwritten later */
642
643      for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++)
644      {
645         if (HIRESON)
646         {
647            ch = read_ram((m_videoaddr | 0x400) + offs);
648            attr = read_ram(m_videoaddr + offs);
649            c1 = ((ch >> 4) & 0xf) | (attr << 4);
650            c2 = (ch & 0xf) | (attr & 0x70);
651            m_bitmapmulti[1] = m_c16_bitmap[1] = c1 & 0x7f;
652            m_bitmapmulti[2] = m_c16_bitmap[0] = c2 & 0x7f;
653            if (MULTICOLORON)
654            {
655               draw_bitmap_multi(ybegin, yend, offs, yoff, xoff);
656            }
657            else
658            {
659               draw_bitmap(ybegin, yend, offs, yoff, xoff);
660            }
661         }
662         else
663         {
664            ch = read_ram((m_videoaddr | 0x400) + offs);
665            attr = read_ram(m_videoaddr + offs);
666            // levente harsfalvi's docu says cursor off in ecm and multicolor
667            if (ECMON)
668            {
669               // hardware reverse off
670               ecm = ch >> 6;
671               m_ecmcolor[0] = m_colors[ecm];
672               m_ecmcolor[1] = attr & 0x7f;
673               draw_character(ybegin, yend, ch & ~0xc0, yoff, xoff, m_ecmcolor);
674            }
675            else if (MULTICOLORON)
676            {
677               // hardware reverse off
678               if (attr & 8)
679               {
680                  m_multi[3] = attr & 0x77;
681                  draw_character_multi(ybegin, yend, ch, yoff, xoff);
682               }
683               else
684               {
685                  m_mono[1] = attr & 0x7f;
686                  draw_character(ybegin, yend, ch, yoff, xoff, m_mono);
687               }
688            }
689            else if (m_cursor1 && (offs == CURSOR1POS))
690            {
691               draw_cursor(ybegin, yend, yoff, xoff, attr & 0x7f);
692            }
693            else if (REVERSEON && (ch & 0x80))
694            {
695               m_monoinversed[0] = attr & 0x7f;
696               if (m_cursor1 && (attr & 0x80))
697                  draw_cursor(ybegin, yend, yoff, xoff, m_monoinversed[0]);
698               else
699                  draw_character(ybegin, yend, ch & ~0x80, yoff, xoff, m_monoinversed);
700            }
701            else
702            {
703               m_mono[1] = attr & 0x7f;
704               if (m_cursor1 && (attr & 0x80))
705                  draw_cursor(ybegin, yend, yoff, xoff, m_mono[0]);
706               else
707                  draw_character(ybegin, yend, ch, yoff, xoff, m_mono);
708            }
709         }
710      }
711
712      for (i = ybegin; i <= yend; i++)
713      {
714         for (int x = 0; x < xbegin; x++)
715         {
716            m_bitmap.pix32(yoff + i, x) = PALETTE[FRAMECOLOR];
717         }
718
719         for (int x = xend; x < m_bitmap.width(); x++)
720         {
721            m_bitmap.pix32(yoff + i, x) = PALETTE[FRAMECOLOR];
722         }
723      }
724   }
725
726   if (last < m_bitmap.height())
727      end = last;
728   else
729      end = m_bitmap.height();
730
731   for (; line < end; line++)
732   {
733      for (int x = 0; x < m_bitmap.width(); x++)
734      {
735         m_bitmap.pix32(line, x) = PALETTE[FRAMECOLOR];
736      }
737   }
738}
739
740void mos7360_device::soundport_w(int offset, int data)
741{
742   // int old = m_reg[offset & 0x1f];
743   m_stream->update();
744
745   switch (offset)
746   {
747   case 0x0e:
748   case 0x12:
749      if (offset == 0x12)
750         m_reg[offset & 0x1f] = (m_reg[offset & 0x1f] & ~3) | (data & 3);
751      else
752         m_reg[offset & 0x1f] = data;
753
754      m_tone1samples = machine().sample_rate() / TONE_FREQUENCY (TONE1_VALUE);
755      DBG_LOG(1, "ted7360", ("tone1 %d %d sample:%d\n", TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), m_tone1samples));
756      break;
757
758   case 0xf:
759   case 0x10:
760      m_reg[offset & 0x1f] = data;
761
762      m_tone2samples = machine().sample_rate() / TONE_FREQUENCY (TONE2_VALUE);
763      DBG_LOG (1, "ted7360", ("tone2 %d %d sample:%d\n", TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), m_tone2samples));
764
765      m_noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * machine().sample_rate() * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY);
766      DBG_LOG (1, "ted7360", ("noise %d sample:%d\n", NOISE_FREQUENCY, m_noisesamples));
767
768      if (!NOISE_ON || ((double) m_noisepos / m_noisesamples >= 1.0))
769         m_noisepos = 0;
770      break;
771
772   case 0x11:
773      m_reg[offset & 0x1f] = data;
774      DBG_LOG(1, "ted7360", ("%s volume %d, %s %s %s\n", TONE_ON?"on":"off",
775                  VOLUME, TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", NOISE_ON?"noise":""));
776
777      if (!TONE_ON||!TONE1_ON) m_tone1pos = 0;
778      if (!TONE_ON||!TONE2_ON) m_tone2pos = 0;
779      if (!TONE_ON||!NOISE_ON) m_noisepos = 0;
780      break;
781   }
782}
783
784
785//-------------------------------------------------
786//  read - register read
787//-------------------------------------------------
788
789UINT8 mos7360_device::read(address_space &space, offs_t offset, int &cs0, int &cs1)
790{
791   UINT8 val = m_last_data;
792
793   cs0 = cs0_r(offset);
794   cs1 = cs1_r(offset);
795
796   switch (offset)
797   {
798   case 0xff00:
799      val = attotime_to_clocks(m_timer1->remaining()) & 0xff;
800      break;
801   case 0xff01:
802      val = attotime_to_clocks(m_timer1->remaining()) >> 8;
803      break;
804   case 0xff02:
805      val = attotime_to_clocks(m_timer2->remaining()) & 0xff;
806      break;
807   case 0xff03:
808      val = attotime_to_clocks(m_timer2->remaining()) >> 8;
809      break;
810   case 0xff04:
811      val = attotime_to_clocks(m_timer3->remaining()) & 0xff;
812      break;
813   case 0xff05:
814      val = attotime_to_clocks(m_timer3->remaining()) >> 8;
815      break;
816   case 0xff07:
817      val = (m_reg[offset & 0x1f] & ~0x40);
818      if (m_clock == TED7360NTSC_CLOCK)
819         val |= 0x40;
820      break;
821   case 0xff13:
822      val = m_reg[offset & 0x1f] & ~1;
823      if (m_rom)
824         val |= 1;
825      break;
826   case 0xff1c:                         /*rasterline */
827      drawlines(m_lastline, m_rasterline);
828      val = ((RASTERLINE_2_C16(m_rasterline) & 0x100) >> 8) | 0xfe;   /* expected by matrix */
829      break;
830   case 0xff1d:                         /*rasterline */
831      drawlines(m_lastline, m_rasterline);
832      val = RASTERLINE_2_C16(m_rasterline) & 0xff;
833      break;
834   case 0xff1e:                         /*rastercolumn */
835      val = rastercolumn() / 2;   /* pengo >=0x99 */
836      break;
837   case 0xff1f:
838      val = ((m_rasterline & 7) << 4) | (m_reg[offset & 0x1f] & 0x0f);
839      DBG_LOG(1, "port_w", ("read from cursorblink %.2x\n", val));
840      break;
841   case 0xff06:
842   case 0xff08:
843   case 0xff09:
844   case 0xff0a:
845   case 0xff0b:
846   case 0xff0c:
847   case 0xff0d:
848   case 0xff0e:
849   case 0xff0f:
850   case 0xff10:
851   case 0xff11:
852   case 0xff12:
853   case 0xff14:
854   case 0xff15:
855   case 0xff16:
856   case 0xff17:
857   case 0xff18:
858   case 0xff19:
859   case 0xff1a:
860   case 0xff1b:
861      val = m_reg[offset & 0x1f];
862      break;
863   }
864
865   return val;
866}
867
868
869//-------------------------------------------------
870//  write - register write
871//-------------------------------------------------
872
873void mos7360_device::write(address_space &space, offs_t offset, UINT8 data, int &cs0, int &cs1)
874{
875   int old;
876
877   cs0 = cs0_r(offset);
878   cs1 = cs1_r(offset);
879
880   switch (offset)
881   {
882   case 0xff0e:
883   case 0xff0f:
884   case 0xff10:
885   case 0xff11:
886   case 0xff12:
887      soundport_w(offset & 0x1f, data);
888      break;
889   }
890
891   switch (offset)
892   {
893   case 0xff00:                        /* stop timer 1 */
894      m_reg[offset & 0x1f] = data;
895
896      if (m_timer1_active)
897      {
898         m_reg[1] = attotime_to_clocks(m_timer1->remaining()) >> 8;
899         m_timer1->reset();
900         m_timer1_active = 0;
901      }
902      break;
903   case 0xff01:                        /* start timer 1 */
904      m_reg[offset & 0x1f] = data;
905      m_timer1->adjust(clocks_to_attotime(TIMER1), 1);
906      m_timer1_active = 1;
907      break;
908   case 0xff02:                        /* stop timer 2 */
909      m_reg[offset & 0x1f] = data;
910      if (m_timer2_active)
911      {
912         m_reg[3] = attotime_to_clocks(m_timer2->remaining()) >> 8;
913         m_timer2->reset();
914         m_timer2_active = 0;
915      }
916      break;
917   case 0xff03:                        /* start timer 2 */
918      m_reg[offset & 0x1f] = data;
919      m_timer2->adjust(clocks_to_attotime(TIMER2), 2);
920      m_timer2_active = 1;
921      break;
922   case 0xff04:                        /* stop timer 3 */
923      m_reg[offset & 0x1f] = data;
924      if (m_timer3_active)
925      {
926         m_reg[5] = attotime_to_clocks(m_timer3->remaining()) >> 8;
927         m_timer3->reset();
928         m_timer3_active = 0;
929      }
930      break;
931   case 0xff05:                        /* start timer 3 */
932      m_reg[offset & 0x1f] = data;
933      m_timer3->adjust(clocks_to_attotime(TIMER3), 3);
934      m_timer3_active = 1;
935      break;
936   case 0xff06:
937      if (m_reg[offset & 0x1f] != data)
938      {
939         drawlines(m_lastline, m_rasterline);
940         m_reg[offset & 0x1f] = data;
941         if (LINES25)
942         {
943            m_y_begin = 0;
944            m_y_end = m_y_begin + 200;
945         }
946         else
947         {
948            m_y_begin = 4;
949            m_y_end = m_y_begin + 192;
950         }
951         m_chargenaddr = CHARGENADDR;
952      }
953      break;
954   case 0xff07:
955      if (m_reg[offset & 0x1f] != data)
956      {
957         drawlines(m_lastline, m_rasterline);
958         m_reg[offset & 0x1f] = data;
959         if (COLUMNS40)
960         {
961            m_x_begin = 0;
962            m_x_end = m_x_begin + 320;
963         }
964         else
965         {
966            m_x_begin = HORICONTALPOS;
967            m_x_end = m_x_begin + 320;
968         }
969         DBG_LOG(3, "port_w", ("%s %s\n", data & 0x40 ? "ntsc" : "pal", data & 0x20 ? "hori freeze" : ""));
970         m_chargenaddr = CHARGENADDR;
971      }
972      break;
973   case 0xff08:
974      m_reg[offset & 0x1f] = m_read_k(data);
975      break;
976   case 0xff09:
977      if (data & 0x08)
978         clear_interrupt(8);
979      if (data & 0x10)
980         clear_interrupt(0x10);
981      if (data & 0x40)
982         clear_interrupt(0x40);
983      if (data & 0x02)
984         clear_interrupt(2);
985      break;
986   case 0xff0a:
987      old = data;
988      m_reg[offset & 0x1f] = data | 0xa0;
989#if 0
990      m_reg[9] = (m_reg[9] & 0xa1) | (m_reg[9] & data & 0x5e);
991      if (m_reg[9] & 0x80)
992         clear_interrupt(0);
993#endif
994      if ((data ^ old) & 1)
995      {
996         /* DBG_LOG(1,"set rasterline hi",("soll:%d\n",RASTERLINE)); */
997      }
998      break;
999   case 0xff0b:
1000      if (data != m_reg[offset & 0x1f])
1001      {
1002         drawlines(m_lastline, m_rasterline);
1003         m_reg[offset & 0x1f] = data;
1004         /*  DBG_LOG(1,"set rasterline lo",("soll:%d\n",RASTERLINE)); */
1005      }
1006      break;
1007   case 0xff0c:
1008   case 0xff0d:
1009      if (m_reg[offset & 0x1f] != data)
1010      {
1011         drawlines(m_lastline, m_rasterline);
1012         m_reg[offset & 0x1f] = data;
1013      }
1014      break;
1015   case 0xff12:
1016      if (m_reg[offset & 0x1f] != data)
1017      {
1018         drawlines(m_lastline, m_rasterline);
1019         m_reg[offset & 0x1f] = data;
1020         m_bitmapaddr = BITMAPADDR;
1021         m_chargenaddr = CHARGENADDR;
1022         DBG_LOG(3, "port_w", ("bitmap %.4x %s\n",  BITMAPADDR, INROM ? "rom" : "ram"));
1023      }
1024      break;
1025   case 0xff13:
1026      if (m_reg[offset & 0x1f] != data)
1027      {
1028         drawlines(m_lastline, m_rasterline);
1029         m_reg[offset & 0x1f] = data;
1030         m_chargenaddr = CHARGENADDR;
1031         DBG_LOG(3, "port_w", ("chargen %.4x %s %d\n", CHARGENADDR, data & 2 ? "" : "doubleclock", data & 1));
1032      }
1033      break;
1034   case 0xff14:
1035      if (m_reg[offset & 0x1f] != data)
1036      {
1037         drawlines(m_lastline, m_rasterline);
1038         m_reg[offset & 0x1f] = data;
1039         m_videoaddr = VIDEOADDR;
1040         DBG_LOG(3, "port_w", ("videoram %.4x\n", VIDEOADDR));
1041      }
1042      break;
1043   case 0xff15:                         /* backgroundcolor */
1044      if (m_reg[offset & 0x1f] != data)
1045      {
1046         drawlines(m_lastline, m_rasterline);
1047         m_reg[offset & 0x1f] = data;
1048         m_monoinversed[1] = m_mono[0] = m_bitmapmulti[0] = m_multi[0] = m_colors[0] = BACKGROUNDCOLOR;
1049      }
1050      break;
1051   case 0xff16:                         /* foregroundcolor */
1052      if (m_reg[offset & 0x1f] != data)
1053      {
1054         drawlines(m_lastline, m_rasterline);
1055         m_reg[offset & 0x1f] = data;
1056         m_bitmapmulti[3] = m_multi[1] = m_colors[1] = FOREGROUNDCOLOR;
1057      }
1058      break;
1059   case 0xff17:                         /* multicolor 1 */
1060      if (m_reg[offset & 0x1f] != data)
1061      {
1062         drawlines(m_lastline, m_rasterline);
1063         m_reg[offset & 0x1f] = data;
1064         m_multi[2] = m_colors[2] = MULTICOLOR1;
1065      }
1066      break;
1067   case 0xff18:                         /* multicolor 2 */
1068      if (m_reg[offset & 0x1f] != data)
1069      {
1070         drawlines(m_lastline, m_rasterline);
1071         m_reg[offset & 0x1f] = data;
1072         m_colors[3] = MULTICOLOR2;
1073      }
1074      break;
1075   case 0xff19:                         /* framecolor */
1076      if (m_reg[offset & 0x1f] != data)
1077      {
1078         drawlines(m_lastline, m_rasterline);
1079         m_reg[offset & 0x1f] = data;
1080         m_colors[4] = FRAMECOLOR;
1081      }
1082      break;
1083   case 0xff1c:
1084      m_reg[offset & 0x1f] = data;          /*? */
1085      DBG_LOG(1, "port_w", ("write to rasterline high %.2x\n",
1086                              data));
1087      break;
1088   case 0xff1f:
1089      m_reg[offset & 0x1f] = data;
1090      DBG_LOG(1, "port_w", ("write to cursorblink %.2x\n", data));
1091      break;
1092   case 0xff3e:
1093      m_rom = 1;
1094      break;
1095   case 0xff3f:
1096      m_rom = 0;
1097      break;
1098   case 0xff1a:
1099   case 0xff1b:
1100   case 0xff1d:
1101   case 0xff1e:
1102      m_reg[offset & 0x1f] = data;
1103      break;
1104   }
1105}
1106
1107
1108//-------------------------------------------------
1109//  update_screen - update screen
1110//-------------------------------------------------
1111
1112UINT32 mos7360_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
1113{
1114   copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
1115
1116   return 0;
1117}
1118
1119void mos7360_device::frame_interrupt_gen()
1120{
1121   if ((m_reg[0x1f] & 0xf) >= 0x0f)
1122   {
1123      /*  if (m_frame_count >= CURSORRATE) */
1124      m_cursor1 ^= 1;
1125      m_reg[0x1f] &= ~0xf;
1126      m_frame_count = 0;
1127   }
1128   else
1129      m_reg[0x1f]++;
1130}
1131
1132void mos7360_device::raster_interrupt_gen()
1133{
1134   m_rasterline++;
1135   m_rastertime = machine().time().as_double();
1136   if (m_rasterline >= m_lines)
1137   {
1138      m_rasterline = 0;
1139      drawlines(m_lastline, TED7360_LINES);
1140      m_lastline = 0;
1141   }
1142
1143   if (m_rasterline == C16_2_RASTERLINE(RASTERLINE))
1144   {
1145      drawlines(m_lastline, m_rasterline);
1146      set_interrupt(2);
1147   }
1148}
1149
1150
1151//-------------------------------------------------
1152//  cs0_r - chip select 0 read
1153//-------------------------------------------------
1154
1155int mos7360_device::cs0_r(offs_t offset)
1156{
1157   if (m_rom && offset >= 0x8000 && offset < 0xc000)
1158   {
1159      return 0;
1160   }
1161
1162   return 1;
1163}
1164
1165
1166//-------------------------------------------------
1167//  cs1_r - chip select 1 read
1168//-------------------------------------------------
1169
1170int mos7360_device::cs1_r(offs_t offset)
1171{
1172   if (m_rom && ((offset >= 0xc000 && offset < 0xfd00) || (offset >= 0xff20)))
1173   {
1174      return 0;
1175   }
1176
1177   return 1;
1178}
Property changes on: trunk/src/emu/sound/mos7360.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/sound/mos7360.h
r0r20985
1/***************************************************************************
2
3    MOS 7360/8360 Text Edit Device (TED) emulation
4
5    Copyright the MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8****************************************************************************
9                            _____   _____
10                   DB6   1 |*    \_/     | 40  Vcc
11                   DB5   2 |             | 39  DB7
12                   DB4   3 |             | 38  DB8
13                   DB3   4 |             | 37  DB9
14                   DB2   5 |             | 36  DB10
15                   DB1   6 |             | 35  DB11
16                   DB0   7 |             | 34  A13
17                  _IRQ   8 |             | 33  A12
18                    LP   9 |             | 32  A11
19                   _CS  10 |   MOS7360   | 31  A10
20                   R/W  11 |             | 30  A9
21                    BA  12 |             | 29  A8
22                   Vdd  13 |             | 28  A7
23                 COLOR  14 |             | 27  A6
24                 S/LUM  15 |             | 26  A5
25                   AEC  16 |             | 25  A4
26                   PH0  17 |             | 24  A3
27                  PHIN  18 |             | 23  A2
28                 PHCOL  19 |             | 22  A1
29                   Vss  20 |_____________| 21  A0
30
31***************************************************************************/
32
33#pragma once
34
35#ifndef __MOS7360__
36#define __MOS7360__
37
38#include "emu.h"
39
40
41
42/***************************************************************************
43    DEVICE CONFIGURATION MACROS
44***************************************************************************/
45
46#define MCFG_MOS7360_ADD(_tag, _screen_tag, _cpu_tag, _clock, _videoram_map, _irq, _k) \
47   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
48   MCFG_SCREEN_REFRESH_RATE(TED7360PAL_VRETRACERATE) \
49   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \
50   MCFG_SCREEN_SIZE(336, 216) \
51   MCFG_SCREEN_VISIBLE_AREA(0, 336 - 1, 0, 216 - 1) \
52   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos7360_device, screen_update) \
53   MCFG_DEVICE_ADD(_tag, MOS7360, _clock) \
54   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
55   downcast<mos7360_device *>(device)->set_callbacks(_screen_tag, _cpu_tag, DEVCB2_##_irq, DEVCB2_##_k);
56
57
58
59//**************************************************************************
60//  MACROS / CONSTANTS
61//**************************************************************************
62
63#define TED7360NTSC_VRETRACERATE 60
64#define TED7360PAL_VRETRACERATE 50
65#define TED7360_HRETRACERATE 15625
66
67/* the following values depend on the VIC clock,
68 * but to achieve TV-frequency the clock must have a fix frequency */
69#define TED7360_HSIZE   320
70#define TED7360_VSIZE   200
71
72/* of course you clock select an other clock, but for accurate */
73/* video timing (these are used in c16/c116/plus4) */
74#define TED7360NTSC_CLOCK   (14318180/4)
75#define TED7360PAL_CLOCK    (17734470/5)
76
77/* pal 50 Hz vertical screen refresh, screen consists of 312 lines
78 * ntsc 60 Hz vertical screen refresh, screen consists of 262 lines */
79#define TED7360NTSC_LINES 261
80#define TED7360PAL_LINES 312
81
82
83
84/***************************************************************************
85    TYPE DEFINITIONS
86***************************************************************************/
87
88// ======================> mos7360_device
89
90class mos7360_device :  public device_t,
91                  public device_memory_interface,
92                  public device_sound_interface
93{
94public:
95   // construction/destruction
96   //mos7360_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
97   mos7360_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
98
99   template<class _irq, class _k> void set_callbacks(const char *screen_tag, const char *cpu_tag, _irq irq, _k k) {
100      m_screen_tag = screen_tag;
101      m_cpu_tag = cpu_tag;
102      m_write_irq.set_callback(irq);
103      m_read_k.set_callback(k);
104   }
105
106   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
107
108   UINT8 read(address_space &space, offs_t offset, int &cs0, int &cs1);
109   void write(address_space &space, offs_t offset, UINT8 data, int &cs0, int &cs1);
110
111   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
112
113protected:
114   enum
115   {
116      TYPE_7360
117   };
118
119   enum
120   {
121      TIMER_ID_1,
122      TIMER_ID_2,
123      TIMER_ID_3,
124      TIMER_LINE,
125      TIMER_FRAME
126   };
127
128   // device-level overrides
129   virtual void device_start();
130   virtual void device_reset();
131   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
132
133   // device_sound_interface callbacks
134   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
135
136   inline void set_interrupt(int mask);
137   inline void clear_interrupt(int mask);
138   inline int rastercolumn();
139   inline UINT8 read_ram(offs_t offset);
140   inline UINT8 read_rom(offs_t offset);
141
142   void draw_character(int ybegin, int yend, int ch, int yoff, int xoff, UINT16 *color);
143   void draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff);
144   void draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff);
145   void draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff);
146   void draw_cursor(int ybegin, int yend, int yoff, int xoff, int color);
147   void drawlines(int first, int last);
148   void soundport_w(int offset, int data);
149   void frame_interrupt_gen();
150   void raster_interrupt_gen();
151   int cs0_r(offs_t offset);
152   int cs1_r(offs_t offset);
153
154   const address_space_config      m_videoram_space_config;
155
156   devcb2_write_line   m_write_irq;
157   devcb2_read8        m_read_k;
158
159   const char *m_screen_tag;
160   const char *m_cpu_tag;
161   screen_device *m_screen;            // screen which sets bitmap properties
162   cpu_device *m_cpu;
163   sound_stream *m_stream;
164
165   UINT8 m_reg[0x20];
166   UINT8 m_last_data;
167
168   bitmap_rgb32 m_bitmap;
169
170   int m_rom;
171
172   int m_frame_count;
173
174   int m_lines;
175   int m_timer1_active, m_timer2_active, m_timer3_active;
176   emu_timer *m_timer1, *m_timer2, *m_timer3;
177   int m_cursor1;
178
179   int m_chargenaddr, m_bitmapaddr, m_videoaddr;
180
181   int m_x_begin, m_x_end;
182   int m_y_begin, m_y_end;
183
184   UINT16 m_c16_bitmap[2], m_bitmapmulti[4], m_mono[2], m_monoinversed[2], m_multi[4], m_ecmcolor[2], m_colors[5];
185
186   int m_rasterline, m_lastline;
187   double m_rastertime;
188
189   /* sound part */
190   UINT8 *m_noise;
191   int m_tone1pos, m_tone2pos,
192   m_tone1samples, m_tone2samples,
193   m_noisesize,          /* number of samples */
194   m_noisepos,         /* pos of tone */
195   m_noisesamples;   /* count of samples to give out per tone */
196
197   int m_variant;
198
199   emu_timer *m_line_timer;
200   emu_timer *m_frame_timer;
201};
202
203
204// device type definition
205extern const device_type MOS7360;
206
207
208
209#endif
Property changes on: trunk/src/emu/sound/mos7360.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/sound/sidvoice.c
r20984r20985
708708   }
709709}
710710
711void sidInitWaveformTables(SIDTYPE type)
711void sidInitWaveformTables(int type)
712712{
713713   int i,j;
714714   UINT16 k;
r20984r20985
732732   for ( i = 0; i < 4096; i++ )
733733      squareTable[k++] = 0; //255;
734734
735   if ( type==MOS8580 )
735   if ( type==mos6581_device::TYPE_8580 )
736736   {
737737      waveform30 = waveform30_8580;
738738      waveform50 = waveform50_8580;
r20984r20985
747747      waveform70 = waveform70_6581;  /* really audible? */
748748   }
749749
750   if ( type==MOS8580 )
750   if ( type==mos6581_device::TYPE_8580 )
751751   {
752752      sidModeNormalTable[3] = sidMode30;
753753      sidModeNormalTable[6] = sidMode60;
trunk/src/emu/sound/sidvoice.h
r20984r20985
88  approximation of the sid6581 chip
99  this part is for 1 (of the 3) voices of a chip
1010*/
11#include "sound/sid6581.h"
11#include "sound/mos6581.h"
1212
1313struct sw_storage
1414{
r20984r20985
105105void sidEmuSet2(sidOperator* pVoice);
106106INT8 sidWaveCalcNormal(sidOperator* pVoice);
107107
108void sidInitWaveformTables(SIDTYPE type);
108void sidInitWaveformTables(int type);
109109void sidInitMixerEngine(running_machine &machine);
110110
111111#if 0
trunk/src/emu/sound/mos6560.c
r20984r20985
435435      val = m_reg[offset];
436436      break;
437437   case 8:                        /* poti 1 */
438      val = m_read_potx(0);
439      break;
438440   case 9:                        /* poti 2 */
439      val = (!m_paddle_cb->isnull()) ? m_paddle_cb[offset - 8](0) : m_reg[offset];
441      val = m_read_poty(0);
440442      break;
441443   default:
442444      val = m_reg[offset];
r20984r20985
684686   AM_RANGE(0x000, 0x3ff) AM_RAM
685687ADDRESS_MAP_END
686688
687mos6560_device::mos6560_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
689mos6560_device::mos6560_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
688690   : device_t(mconfig, type, name, tag, owner, clock),
689691      device_memory_interface(mconfig, *this),
690692      device_sound_interface(mconfig, *this),
693      m_variant(variant),
691694      m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(mos6560_videoram_map)),
692      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6560_colorram_map))
695      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6560_colorram_map)),
696      m_read_potx(*this),
697      m_read_poty(*this)
693698{
694699}
695700
r20984r20985
699704      device_sound_interface(mconfig, *this),
700705      m_variant(TYPE_6560),
701706      m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(mos6560_videoram_map)),
702      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6560_colorram_map))
707      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6560_colorram_map)),
708      m_read_potx(*this),
709      m_read_poty(*this)
703710{
704711}
705712
706713mos6561_device::mos6561_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
707   :mos6560_device(mconfig, MOS6561, "MOS6561", tag, owner, clock) { m_variant = TYPE_6561; }
714   :mos6560_device(mconfig, MOS6561, "MOS6561", tag, owner, clock, TYPE_6561) { }
708715
709716mos656x_attack_ufo_device::mos656x_attack_ufo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
710   :mos6560_device(mconfig, MOS656X_ATTACK_UFO, "MOS656X", tag, owner, clock) { m_variant = TYPE_ATTACK_UFO; }
717   :mos6560_device(mconfig, MOS656X_ATTACK_UFO, "MOS656X", tag, owner, clock, TYPE_ATTACK_UFO) { }
711718
712//-------------------------------------------------
713//  device_config_complete - perform any
714//  operations now that the configuration is
715//  complete
716//-------------------------------------------------
717719
718void mos6560_device::device_config_complete()
719{
720   // inherit a copy of the static data
721   const mos6560_interface *intf = reinterpret_cast<const mos6560_interface *>(static_config());
722   if (intf != NULL)
723      *static_cast<mos6560_interface *>(this) = *intf;
724
725   // or initialize to defaults if none provided
726   else
727   {
728      // TODO
729   }
730}
731
732
733720//-------------------------------------------------
734721//  memory_space_config - return a description of
735722//  any address spaces owned by this device
r20984r20985
745732   }
746733}
747734
735
748736//-------------------------------------------------
749737//  device_start - device-specific startup
750738//-------------------------------------------------
r20984r20985
753741{
754742   m_screen = machine().device<screen_device>(m_screen_tag);
755743   m_screen->register_screen_bitmap(m_bitmap);
744   assert(m_screen);
756745
757746   // resolve callbacks
758   m_paddle_cb[0].resolve(m_potx_cb, *this);
759   m_paddle_cb[1].resolve(m_poty_cb, *this);
747   m_read_potx.resolve_safe(0xff);
748   m_read_poty.resolve_safe(0xff);
760749
761750   switch (m_variant)
762751   {
r20984r20985
766755      m_total_lines = MOS6560_LINES;
767756      m_total_vretracerate = MOS6560_VRETRACERATE;
768757      break;
758
769759   case TYPE_ATTACK_UFO:
770760      m_total_xsize = 23 * 8;
771761      m_total_ysize = 22 * 8;
772762      m_total_lines = MOS6560_LINES;
773763      m_total_vretracerate = MOS6560_VRETRACERATE;
774764      break;
765
775766   case TYPE_6561:
776767      m_total_xsize = MOS6561_XSIZE;
777768      m_total_ysize = MOS6561_YSIZE;
r20984r20985
780771      break;
781772   }
782773
774   // allocate timers
775   m_line_timer = timer_alloc(TIMER_LINE);
776   m_line_timer->adjust(m_screen->scan_period(), 0, m_screen->scan_period());
777
778   // initialize sound
783779   sound_start();
784780
781   // state saving
785782   save_item(NAME(m_lightpenreadtime));
786783   save_item(NAME(m_rasterline));
787784   save_item(NAME(m_lastline));
r20984r20985
821818   save_item(NAME(m_noisesamples));
822819}
823820
821
824822//-------------------------------------------------
825823//  device_reset - device-specific reset
826824//-------------------------------------------------
r20984r20985
872870   m_noisesamples = 1;
873871}
874872
873
875874//-------------------------------------------------
875//  device_timer - handler timer events
876//-------------------------------------------------
877
878void mos6560_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
879{
880   switch (id)
881   {
882   case TIMER_LINE:
883      raster_interrupt_gen();
884      break;
885   }
886}
887
888//-------------------------------------------------
876889//  sound_stream_update - handle a stream update
877890//-------------------------------------------------
878891
trunk/src/emu/sound/mos6560.h
r20984r20985
4343// DEVICE CONFIGURATION MACROS
4444//***************************************************************************
4545
46#define MCFG_MOS6560_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
46#define MCFG_MOS6560_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _potx, _poty) \
4747   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
4848   MCFG_SCREEN_REFRESH_RATE(MOS6560_VRETRACERATE) \
4949   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \
r20984r20985
5151   MCFG_SCREEN_VISIBLE_AREA(MOS6560_MAME_XPOS, MOS6560_MAME_XPOS + MOS6560_MAME_XSIZE - 1, MOS6560_MAME_YPOS, MOS6560_MAME_YPOS + MOS6560_MAME_YSIZE - 1) \
5252   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
5353   MCFG_SOUND_ADD(_tag, MOS6560, _clock) \
54   MCFG_DEVICE_CONFIG(_config) \
54   downcast<mos6560_device *>(device)->set_callbacks(_screen_tag, DEVCB2_##_potx, DEVCB2_##_poty); \
5555   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
5656   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map)
5757
58#define MCFG_MOS6561_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
58#define MCFG_MOS6561_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _potx, _poty) \
5959   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
6060   MCFG_SCREEN_REFRESH_RATE(MOS6561_VRETRACERATE) \
6161   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \
r20984r20985
6363   MCFG_SCREEN_VISIBLE_AREA(MOS6561_MAME_XPOS, MOS6561_MAME_XPOS + MOS6561_MAME_XSIZE - 1, MOS6561_MAME_YPOS, MOS6561_MAME_YPOS + MOS6561_MAME_YSIZE - 1) \
6464   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
6565   MCFG_SOUND_ADD(_tag, MOS6561, _clock) \
66   MCFG_DEVICE_CONFIG(_config) \
66   downcast<mos6560_device *>(device)->set_callbacks(_screen_tag, DEVCB2_##_potx, DEVCB2_##_poty); \
6767   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
6868   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map)
6969
70#define MCFG_MOS656X_ATTACK_UFO_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
70#define MCFG_MOS656X_ATTACK_UFO_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map) \
7171   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
7272   MCFG_SCREEN_REFRESH_RATE(MOS6560_VRETRACERATE) \
7373   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \
r20984r20985
7575   MCFG_SCREEN_VISIBLE_AREA(0, 23*8 - 1, 0, 22*8 - 1) \
7676   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
7777   MCFG_SOUND_ADD(_tag, MOS656X_ATTACK_UFO, _clock) \
78   MCFG_DEVICE_CONFIG(_config) \
78   downcast<mos6560_device *>(device)->set_callbacks(_screen_tag, DEVCB2_NULL, DEVCB2_NULL); \
7979   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
8080   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map)
8181
8282
83#define MOS6560_INTERFACE(_name) \
84   const mos6560_interface (_name) =
8583
86
87
8884//**************************************************************************
8985//  MACROS / CONSTANTS
9086//**************************************************************************
r20984r20985
126122//  TYPE DEFINITIONS
127123//***************************************************************************
128124
129// ======================> mos6560_interface
130
131struct mos6560_interface
132{
133   const char      *m_screen_tag;
134
135   devcb_read8     m_potx_cb;
136   devcb_read8     m_poty_cb;
137};
138
139
140125// ======================> mos6560_device
141126
142127class mos6560_device : public device_t,
143128                  public device_memory_interface,
144                  public device_sound_interface,
145                  public mos6560_interface
129                  public device_sound_interface
146130{
147131public:
148   mos6560_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
132   mos6560_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
149133   mos6560_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
150134
135   template<class _potx, class _poty> void set_callbacks(const char *screen_tag, _potx potx, _poty poty) {
136      m_screen_tag = screen_tag;
137      m_read_potx.set_callback(potx);
138      m_read_poty.set_callback(poty);
139   }
140
151141   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
152142
153143   DECLARE_READ8_MEMBER( read );
r20984r20985
158148   DECLARE_WRITE_LINE_MEMBER( lp_w );
159149
160150   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
161   void raster_interrupt_gen();
162151
163152protected:
164153   enum
r20984r20985
168157      TYPE_ATTACK_UFO     // NTSC-M, less features
169158   };
170159
160   enum
161   {
162      TIMER_LINE
163   };
164
171165   // device-level overrides
172   virtual void device_config_complete();
173166   virtual void device_start();
174167   virtual void device_reset();
168   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
175169
176170   // sound stream update overrides
177171   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
r20984r20985
184178   void drawlines( int first, int last );
185179   void soundport_w( int offset, int data );
186180   void sound_start();
181   void raster_interrupt_gen();
187182
188183   int  m_variant;
189184
190185   const address_space_config      m_videoram_space_config;
191186   const address_space_config      m_colorram_space_config;
192187
188   devcb2_read8   m_read_potx;
189   devcb2_read8   m_read_poty;
190
191   const char *m_screen_tag;
193192   screen_device *m_screen;
194193
195194   UINT8 m_reg[16];
r20984r20985
216215   /* DMA */
217216   UINT8 m_last_data;
218217
219   /* paddles */
220   devcb_resolved_read8    m_paddle_cb[2];
221
222218   /* sound part */
223219   int m_tone1pos, m_tone2pos, m_tone3pos,
224220   m_tonesize, m_tone1samples, m_tone2samples, m_tone3samples,
r20984r20985
229225   sound_stream *m_channel;
230226   INT16 *m_tone;
231227   INT8 *m_noise;
228
229   emu_timer *m_line_timer;
232230};
233231
234232
trunk/src/emu/sound/mos6581.c
r0r20985
1/**********************************************************************
2
3    MOS 6581/8580 Sound Interface Device emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "mos6581.h"
11#include "sid.h"
12
13
14
15//**************************************************************************
16//  MACROS / CONSTANTS
17//**************************************************************************
18
19#define LOG 0
20
21
22
23//**************************************************************************
24//  DEVICE DEFINITIONS
25//**************************************************************************
26
27// device type definition
28const device_type MOS6581 = &device_creator<mos6581_device>;
29const device_type MOS8580 = &device_creator<mos8580_device>;
30
31
32
33//**************************************************************************
34//  LIVE DEVICE
35//**************************************************************************
36
37//-------------------------------------------------
38//  mos6581_device - constructor
39//-------------------------------------------------
40
41mos6581_device::mos6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
42   : device_t(mconfig, type, name, tag, owner, clock),
43      device_sound_interface(mconfig, *this),
44      m_read_potx(*this),
45      m_read_poty(*this),
46      m_stream(NULL),
47      m_variant(variant)
48{
49   m_token = global_alloc_clear(SID6581_t);
50}
51
52mos6581_device::mos6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
53   : device_t(mconfig, MOS6581, "MOS6581", tag, owner, clock),
54      device_sound_interface(mconfig, *this),
55      m_read_potx(*this),
56      m_read_poty(*this),
57      m_stream(NULL),
58      m_variant(TYPE_6581)
59{
60   m_token = global_alloc_clear(SID6581_t);
61}
62
63
64//-------------------------------------------------
65//  mos8580_device - constructor
66//-------------------------------------------------
67
68mos8580_device::mos8580_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
69   : mos6581_device(mconfig, MOS8580, "MOS8580", tag, owner, clock, TYPE_8580)
70{
71}
72
73
74//-------------------------------------------------
75//  device_start - device-specific startup
76//-------------------------------------------------
77
78void mos6581_device::device_start()
79{
80   // resolve callbacks
81   m_read_potx.resolve_safe(0xff);
82   m_read_poty.resolve_safe(0xff);
83
84   // create sound stream
85   m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
86
87   // initialize SID engine
88   m_token->device = this;
89   m_token->mixer_channel = m_stream;
90   m_token->PCMfreq = machine().sample_rate();
91   m_token->clock = clock();
92   m_token->type = m_variant;
93
94   sid6581_init(m_token);
95   sidInitWaveformTables(m_variant);
96}
97
98
99//-------------------------------------------------
100//  device_reset - device-specific reset
101//-------------------------------------------------
102
103void mos6581_device::device_reset()
104{
105   sidEmuReset(m_token);
106}
107
108
109//-------------------------------------------------
110//  sound_stream_update - handle update requests for
111//  our sound stream
112//-------------------------------------------------
113
114void mos6581_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
115{
116   sidEmuFillBuffer(m_token, outputs[0], samples);
117}
118
119
120//-------------------------------------------------
121//  read -
122//-------------------------------------------------
123
124READ8_MEMBER( mos6581_device::read )
125{
126   return sid6581_port_r(machine(), m_token, offset);
127}
128
129
130//-------------------------------------------------
131//  write -
132//-------------------------------------------------
133
134WRITE8_MEMBER( mos6581_device::write )
135{
136   sid6581_port_w(m_token, offset, data);
137}
Property changes on: trunk/src/emu/sound/mos6581.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/sound/mos6581.h
r0r20985
1/**********************************************************************
2
3    MOS 6581/8580 Sound Interface Device emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                 CAP1A   1 |*    \_/     | 28  Vdd
11                 CAP1B   2 |             | 27  AUDIO OUT
12                 CAP2A   3 |             | 26  EXT IN
13                 CAP2B   4 |             | 25  Vcc
14                  _RES   5 |             | 24  POTX
15                  phi2   6 |             | 23  POTY
16                  R/_W   7 |   MOS6581   | 22  D7
17                   _CS   8 |   MOS8580   | 21  D6
18                    A0   9 |             | 20  D5
19                    A1  10 |             | 19  D4
20                    A2  11 |             | 18  D3
21                    A3  12 |             | 17  D2
22                    A4  13 |             | 16  D1
23                   GND  14 |_____________| 15  D0
24
25**********************************************************************/
26
27#pragma once
28
29#ifndef __MOS6581__
30#define __MOS6581__
31
32#include "emu.h"
33
34
35
36//**************************************************************************
37//  INTERFACE CONFIGURATION MACROS
38//**************************************************************************
39
40#define MCFG_MOS6581_POTXY_CALLBACKS(_potx, _poty) \
41   downcast<mos6581_device *>(device)->set_callbacks(DEVCB2_##_potx, DEVCB2_##_poty);
42
43
44
45//**************************************************************************
46//  TYPE DEFINITIONS
47//**************************************************************************
48
49// ======================> mos6581_device
50
51struct SID6581_t;
52
53class mos6581_device : public device_t,
54                  public device_sound_interface
55{
56public:
57   mos6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
58   mos6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
59
60   template<class _potx, class _poty> void set_callbacks(_potx potx, _poty poty) {
61      m_read_potx.set_callback(potx);
62      m_read_poty.set_callback(poty);
63   }
64
65   DECLARE_READ8_MEMBER( read );
66   DECLARE_WRITE8_MEMBER( write );
67
68   enum
69   {
70      TYPE_6581,
71      TYPE_8580
72   };
73
74protected:
75   // device-level overrides
76   virtual void device_start();
77   virtual void device_reset();
78
79   // device_sound_interface overrides
80   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
81
82private:
83   devcb2_read8  m_read_potx;
84   devcb2_read8  m_read_poty;
85
86   sound_stream *m_stream;
87
88   int m_variant;
89
90   SID6581_t *m_token;
91};
92
93
94// ======================> mos8580_device
95
96class mos8580_device : public mos6581_device
97{
98public:
99   mos8580_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
100};
101
102
103// device type definition
104extern const device_type MOS6581;
105extern const device_type MOS8580;
106
107
108#endif
Property changes on: trunk/src/emu/sound/mos6581.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/sound/sid.h
r20984r20985
88  this part is for one chip,
99*/
1010
11#include "sound/sid6581.h"
1211#include "sidvoice.h"
1312
1413/* private area */
r20984r20985
2019   devcb_resolved_read8 in_potx_func;
2120   devcb_resolved_read8 in_poty_func;
2221
23   SIDTYPE type;
22   int type;
2423   UINT32 clock;
2524
2625   UINT16 PCMfreq; // samplerate of the current systems soundcard/DAC
trunk/src/emu/sound/sound.mak
r20984r20985
324324
325325
326326#-------------------------------------------------
327# MOS 7360 TED
328#-------------------------------------------------
329
330ifneq ($(filter MOS7360,$(SOUNDS)),)
331SOUNDOBJS += $(SOUNDOBJ)/mos7360.o
332endif
333
334
335
336#-------------------------------------------------
327337# Namco custom sound chips
328338#-------------------------------------------------
329339
r20984r20985
511521#-------------------------------------------------
512522
513523ifneq ($(filter SID6581,$(SOUNDS)),)
514SOUNDOBJS += $(SOUNDOBJ)/sid6581.o $(SOUNDOBJ)/sid.o $(SOUNDOBJ)/sidenvel.o $(SOUNDOBJ)/sidvoice.o
524SOUNDOBJS += $(SOUNDOBJ)/mos6581.o $(SOUNDOBJ)/sid.o $(SOUNDOBJ)/sidenvel.o $(SOUNDOBJ)/sidvoice.o
515525endif
516526
517527ifneq ($(filter SID8580,$(SOUNDS)),)
518SOUNDOBJS += $(SOUNDOBJ)/sid6581.o $(SOUNDOBJ)/sid.o $(SOUNDOBJ)/sidenvel.o $(SOUNDOBJ)/sidvoice.o
528SOUNDOBJS += $(SOUNDOBJ)/mos6581.o $(SOUNDOBJ)/sid.o $(SOUNDOBJ)/sidenvel.o $(SOUNDOBJ)/sidvoice.o
519529endif
520530
521531
trunk/src/emu/machine/mos6526.c
r20984r20985
118118const device_type MOS5710 = &device_creator<mos5710_device>;
119119
120120
121//-------------------------------------------------
122//  static_set_tod_clock -
123//-------------------------------------------------
124121
125void mos6526_device::static_set_tod_clock(device_t &device, int tod_clock)
126{
127   mos6526_device &cia = dynamic_cast<mos6526_device &>(device);
128
129   cia.m_tod_clock = tod_clock;
130}
131
132
133//-------------------------------------------------
134//  device_config_complete - perform any
135//  operations now that the configuration is
136//  complete
137//-------------------------------------------------
138
139void mos6526_device::device_config_complete()
140{
141   // inherit a copy of the static data
142   const mos6526_interface *intf = reinterpret_cast<const mos6526_interface *>(static_config());
143   if (intf != NULL)
144      *static_cast<mos6526_interface *>(this) = *intf;
145
146   // or initialize to defaults if none provided
147   else
148   {
149      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
150      memset(&m_out_pc_cb, 0, sizeof(m_out_pc_cb));
151      memset(&m_out_cnt_cb, 0, sizeof(m_out_cnt_cb));
152      memset(&m_out_sp_cb, 0, sizeof(m_out_sp_cb));
153      memset(&m_in_pa_cb, 0, sizeof(m_in_pa_cb));
154      memset(&m_out_pa_cb, 0, sizeof(m_out_pa_cb));
155      memset(&m_in_pb_cb, 0, sizeof(m_in_pb_cb));
156      memset(&m_out_pb_cb, 0, sizeof(m_out_pb_cb));
157   }
158}
159
160
161
162122//**************************************************************************
163123//  INLINE HELPERS
164124//**************************************************************************
r20984r20985
174134   if (m_pa != pa)
175135   {
176136      m_pa = pa;
177      m_out_pa_func(0, pa);
137      m_write_pa((offs_t)0, pa);
178138   }
179139}
180140
r20984r20985
205165
206166   if (m_pb != pb)
207167   {
208      m_out_pb_func(0, pb);
168      m_write_pb((offs_t)0, pb);
209169      m_pb = pb;
210170   }
211171}
r20984r20985
438398            }
439399
440400            m_sp = BIT(m_shift, 7);
441            m_out_sp_func(m_sp);
401            m_write_sp(m_sp);
442402
443403            m_shift <<= 1;
444404            m_bits++;
r20984r20985
457417         }
458418
459419         m_cnt = !m_cnt;
460         m_out_cnt_func(m_cnt);
420         m_write_cnt(m_cnt);
461421      }
462422   }
463423}
r20984r20985
505465{
506466   if (!m_irq && m_ir1)
507467   {
508      m_out_irq_func(ASSERT_LINE);
468      m_write_irq(ASSERT_LINE);
509469      m_irq = true;
510470   }
511471
r20984r20985
602562   if (!m_pc)
603563   {
604564      m_pc = 1;
605      m_out_pc_func(m_pc);
565      m_write_pc(m_pc);
606566   }
607567
608568   serial_input();
r20984r20985
634594   : device_t(mconfig, type, name, tag, owner, clock),
635595      device_execute_interface(mconfig, *this),
636596      m_icount(0),
637      m_variant(variant)
597      m_variant(variant),
598      m_write_irq(*this),
599      m_write_pc(*this),
600      m_write_cnt(*this),
601      m_write_sp(*this),
602      m_read_pa(*this),
603      m_write_pa(*this),
604      m_read_pb(*this),
605      m_write_pb(*this)
638606{
639607}
640608
r20984r20985
642610   : device_t(mconfig, MOS6526, "MOS6526", tag, owner, clock),
643611      device_execute_interface(mconfig, *this),
644612      m_icount(0),
645      m_variant(TYPE_6526)
613      m_variant(TYPE_6526),
614      m_write_irq(*this),
615      m_write_pc(*this),
616      m_write_cnt(*this),
617      m_write_sp(*this),
618      m_read_pa(*this),
619      m_write_pa(*this),
620      m_read_pb(*this),
621      m_write_pb(*this)
646622{ }
647623
648624mos6526a_device::mos6526a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r20984r20985
665641   m_icountptr = &m_icount;
666642
667643   // resolve callbacks
668   m_out_irq_func.resolve(m_out_irq_cb, *this);
669   m_out_pc_func.resolve(m_out_pc_cb, *this);
670   m_out_cnt_func.resolve(m_out_cnt_cb, *this);
671   m_out_sp_func.resolve(m_out_sp_cb, *this);
672   m_in_pa_func.resolve(m_in_pa_cb, *this);
673   m_out_pa_func.resolve(m_out_pa_cb, *this);
674   m_in_pb_func.resolve(m_in_pb_cb, *this);
675   m_out_pb_func.resolve(m_out_pb_cb, *this);
644   m_write_irq.resolve_safe();
645   m_write_pc.resolve_safe();
646   m_write_cnt.resolve_safe();
647   m_write_sp.resolve_safe();
648   m_read_pa.resolve_safe(0xff);
649   m_write_pa.resolve_safe();
650   m_read_pb.resolve_safe(0xff);
651   m_write_pb.resolve_safe();
676652
677653   // allocate timer
678654   if (m_tod_clock > 0)
r20984r20985
782758   m_tod_stopped = true;
783759   m_tod_latched = false;
784760
785   m_out_irq_func(CLEAR_LINE);
786   m_out_pc_func(m_pc);
787   m_out_sp_func(m_sp);
788   m_out_cnt_func(m_cnt);
761   m_write_irq(CLEAR_LINE);
762   m_write_pc(m_pc);
763   m_write_sp(m_sp);
764   m_write_cnt(m_cnt);
789765}
790766
791767
r20984r20985
833809   switch (offset)
834810   {
835811   case PRA:
836      data = (m_in_pa_func(0) & ~m_ddra) | (m_pra & m_ddra);
812      data = (m_read_pa(0) & ~m_ddra) | (m_pra & m_ddra);
837813      break;
838814
839815   case PRB:
840      data = (m_in_pb_func(0) & ~m_ddrb) | (m_prb & m_ddrb);
816      data = (m_read_pb(0) & ~m_ddrb) | (m_prb & m_ddrb);
841817
842818      if (CRA_PBON)
843819      {
r20984r20985
856832      }
857833
858834      m_pc = 0;
859      m_out_pc_func(m_pc);
835      m_write_pc(m_pc);
860836      break;
861837
862838   case DDRA:
r20984r20985
920896      m_ir1 = 0;
921897      m_icr = 0;
922898      m_irq = false;
923      m_out_irq_func(CLEAR_LINE);
899      m_write_irq(CLEAR_LINE);
924900      break;
925901
926902   case CRA:
r20984r20985
980956      update_pb();
981957
982958      m_pc = 0;
983      m_out_pc_func(m_pc);
959      m_write_pc(m_pc);
984960      break;
985961
986962   case DDRA:
trunk/src/emu/machine/mos6526.h
r20984r20985
6969//  INTERFACE CONFIGURATION MACROS
7070//**************************************************************************
7171
72#define MCFG_MOS6526_ADD(_tag, _clock, _tod_clock, _config) \
72#define MCFG_MOS6526_ADD(_tag, _clock, _tod_clock, _irq) \
7373   MCFG_DEVICE_ADD(_tag, MOS6526, _clock) \
74   MCFG_DEVICE_CONFIG(_config) \
75   mos6526_device::static_set_tod_clock(*device, _tod_clock);
74   downcast<mos6526_device *>(device)->set_callbacks(_tod_clock, DEVCB2_##_irq);
7675
77#define MCFG_MOS6526A_ADD(_tag, _clock, _tod_clock, _config) \
76#define MCFG_MOS6526A_ADD(_tag, _clock, _tod_clock, _irq) \
7877   MCFG_DEVICE_ADD(_tag, MOS6526A, _clock) \
79   MCFG_DEVICE_CONFIG(_config) \
80   mos6526_device::static_set_tod_clock(*device, _tod_clock);
78   downcast<mos6526_device *>(device)->set_callbacks(_tod_clock, DEVCB2_##_irq);
8179
82#define MCFG_MOS8520_ADD(_tag, _clock, _tod_clock, _config) \
80#define MCFG_MOS8520_ADD(_tag, _clock, _tod_clock, _irq) \
8381   MCFG_DEVICE_ADD(_tag, MOS8520, _clock) \
84   MCFG_DEVICE_CONFIG(_config) \
85   mos6526_device::static_set_tod_clock(*device, _tod_clock);
82   downcast<mos6526_device *>(device)->set_callbacks(_tod_clock, DEVCB2_##_irq);
8683
87#define MCFG_MOS5710_ADD(_tag, _clock, _tod_clock, _config) \
84#define MCFG_MOS5710_ADD(_tag, _clock, _tod_clock, _irq) \
8885   MCFG_DEVICE_ADD(_tag, MOS5710, _clock) \
89   MCFG_DEVICE_CONFIG(_config) \
90   mos6526_device::static_set_tod_clock(*device, _tod_clock);
86   downcast<mos6526_device *>(device)->set_callbacks(_tod_clock, DEVCB2_##_irq);
9187
9288
93#define MOS6526_INTERFACE(name) \
94   const mos6526_interface (name)=
89#define MCFG_MOS6526_SERIAL_CALLBACKS(_cnt, _sp) \
90   downcast<mos6526_device *>(device)->set_serial_callbacks(DEVCB2_##_cnt, DEVCB2_##_sp);
9591
96#define MOS8520_INTERFACE(name) \
97   const mos6526_interface (name)=
92#define MCFG_MOS6526_PORT_A_CALLBACKS(_read, _write) \
93   downcast<mos6526_device *>(device)->set_port_a_callbacks(DEVCB2_##_read, DEVCB2_##_write);
9894
95#define MCFG_MOS6526_PORT_B_CALLBACKS(_read, _write, _pc) \
96   downcast<mos6526_device *>(device)->set_port_b_callbacks(DEVCB2_##_read, DEVCB2_##_write, DEVCB2_##_pc);
9997
10098
99
101100//**************************************************************************
102101//  TYPE DEFINITIONS
103102//**************************************************************************
104103
105// ======================> mos6526_interface
106
107struct mos6526_interface
108{
109   devcb_write_line    m_out_irq_cb;
110   devcb_write_line    m_out_pc_cb;
111   devcb_write_line    m_out_cnt_cb;
112   devcb_write_line    m_out_sp_cb;
113
114   devcb_read8         m_in_pa_cb;
115   devcb_write8        m_out_pa_cb;
116
117   devcb_read8         m_in_pb_cb;
118   devcb_write8        m_out_pb_cb;
119};
120
121
122104// ======================> mos6526_device
123105
124106class mos6526_device :  public device_t,
125                  public device_execute_interface,
126                  public mos6526_interface
107                  public device_execute_interface
127108{
128109public:
129110   // construction/destruction
130111   mos6526_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
131112   mos6526_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
132113
133   // inline configuration
134   static void static_set_tod_clock(device_t &device, int tod_clock);
114   template<class _irq> void set_callbacks(int tod_clock, _irq irq) {
115      m_tod_clock = tod_clock;
116      m_write_irq.set_callback(irq);
117   }
135118
119   template<class _cnt, class _sp> void set_serial_callbacks(_cnt cnt, _sp sp) {
120      m_write_cnt.set_callback(cnt);
121      m_write_sp.set_callback(sp);
122   }
123
124   template<class _read, class _write> void set_port_a_callbacks(_read rd, _write wr) {
125      m_read_pa.set_callback(rd);
126      m_write_pa.set_callback(wr);
127   }
128
129   template<class _read, class _write, class _pc> void set_port_b_callbacks(_read rd, _write wr, _pc pc) {
130      m_read_pb.set_callback(rd);
131      m_write_pb.set_callback(wr);
132      m_write_pc.set_callback(pc);
133   }
134
136135   DECLARE_READ8_MEMBER( read );
137136   DECLARE_WRITE8_MEMBER( write );
138137
r20984r20985
157156   };
158157
159158   // device-level overrides
160   virtual void device_config_complete();
161159   virtual void device_start();
162160   virtual void device_reset();
163161   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
r20984r20985
183181   inline void write_tod(int offset, UINT8 data);
184182   inline void synchronize();
185183
186   devcb_resolved_write_line   m_out_irq_func;
187   devcb_resolved_write_line   m_out_pc_func;
188   devcb_resolved_write_line   m_out_cnt_func;
189   devcb_resolved_write_line   m_out_sp_func;
190   devcb_resolved_read8        m_in_pa_func;
191   devcb_resolved_write8       m_out_pa_func;
192   devcb_resolved_read8        m_in_pb_func;
193   devcb_resolved_write8       m_out_pb_func;
184   devcb2_write_line   m_write_irq;
185   devcb2_write_line   m_write_pc;
186   devcb2_write_line   m_write_cnt;
187   devcb2_write_line   m_write_sp;
188   devcb2_read8        m_read_pa;
189   devcb2_write8       m_write_pa;
190   devcb2_read8        m_read_pb;
191   devcb2_write8       m_write_pb;
194192
195193   // interrupts
196194   bool m_irq;
trunk/src/mess/audio/mos7360.c
r20984r20985
1/**********************************************************************
2
3    MOS 7360/8360 Text Edit Device (TED) emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "emu.h"
11#include "mos7360.h"
12
13
14
15//**************************************************************************
16//  MACROS / CONSTANTS
17//**************************************************************************
18
19#define LOG 0
20
21
22#define VERBOSE_LEVEL 0
23#define DBG_LOG(N,M,A) \
24   do { \
25      if(VERBOSE_LEVEL >= N) \
26      { \
27         if( M ) \
28            logerror("%11.6f: %-24s", machine().time().as_double(), (char*) M ); \
29         logerror A; \
30      } \
31   } while(0)
32
33
34#define VREFRESHINLINES 28
35
36#define TIMER1HELPER (m_reg[0] | (m_reg[1] << 8))
37#define TIMER2HELPER (m_reg[2] | (m_reg[3] << 8))
38#define TIMER3HELPER (m_reg[4] | (m_reg[5] << 8))
39#define TIMER1 (TIMER1HELPER ? TIMER1HELPER : 0x10000)
40#define TIMER2 (TIMER2HELPER ? TIMER2HELPER : 0x10000)
41#define TIMER3 (TIMER3HELPER ? TIMER3HELPER : 0x10000)
42
43#define TED7360_YPOS            40
44#define RASTERLINE_2_C16(a)    ((a + m_lines - TED7360_YPOS - 5) % m_lines)
45#define C16_2_RASTERLINE(a)    ((a + TED7360_YPOS + 5) % m_lines)
46#define XPOS 8
47#define YPOS 8
48
49#define SCREENON               (m_reg[6] & 0x10)
50#define TEST                   (m_reg[6] & 0x80)
51#define VERTICALPOS            (m_reg[6] & 0x07)
52#define HORICONTALPOS          (m_reg[7] & 0x07)
53#define ECMON                  (m_reg[6] & 0x40)
54#define HIRESON                (m_reg[6] & 0x20)
55#define MULTICOLORON           (m_reg[7] & 0x10)
56#define REVERSEON              (!(m_reg[7] & 0x80))
57
58/* hardware inverts character when bit 7 set (character taken &0x7f) */
59/* instead of fetching character with higher number! */
60#define LINES25     (m_reg[6] & 0x08)     /* else 24 Lines */
61#define LINES       (LINES25 ? 25 : 24)
62#define YSIZE       (LINES * 8)
63#define COLUMNS40   (m_reg[7] & 0x08)     /* else 38 Columns */
64#define COLUMNS     (COLUMNS40 ? 40 : 38)
65#define XSIZE       (COLUMNS * 8)
66
67#define INROM       (m_reg[0x12] & 0x04)
68#define CHARGENADDR (REVERSEON && !HIRESON && !MULTICOLORON ? ((m_reg[0x13] & 0xfc) << 8) : ((m_reg[0x13] & 0xf8) << 8))
69#define BITMAPADDR  ((m_reg[0x12] & 0x38) << 10)
70#define VIDEOADDR   ((m_reg[0x14] & 0xf8) << 8)
71
72#define RASTERLINE  (((m_reg[0xa] & 0x01) << 8) | m_reg[0xb])
73#define CURSOR1POS  (m_reg[0xd] | ((m_reg[0xc] & 0x03) << 8))
74#define CURSOR2POS  (m_reg[0x1b] | ((m_reg[0x1a] & 0x03) << 8))
75#define CURSORRATE  ((m_reg[0x1f] & 0x7c) >> 2)
76
77#define BACKGROUNDCOLOR (m_reg[0x15] & 0x7f)
78#define FOREGROUNDCOLOR (m_reg[0x16] & 0x7f)
79#define MULTICOLOR1     (m_reg[0x17] & 0x7f)
80#define MULTICOLOR2     (m_reg[0x18] & 0x7f)
81#define FRAMECOLOR      (m_reg[0x19] & 0x7f)
82
83#define TED7360_CLOCK        (m_clock / 4)
84#define TED7360_VRETRACERATE ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_VRETRACERATE : TED7360NTSC_VRETRACERATE)
85#define TED7360_LINES        ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_LINES : TED7360NTSC_LINES)
86
87static attotime TEDTIME_IN_CYCLES(int cycles)
88{
89   double d = (double)(cycles) / clock();
90   return attotime::from_double(d);
91}
92
93static int TEDTIME_TO_CYCLES(attotime t)
94{
95   double d = t.as_double();
96   return (int)(d * clock());
97}
98
99static const rgb_t PALETTE[] =
100{
101/* black, white, red, cyan */
102/* purple, green, blue, yellow */
103/* orange, light orange, pink, light cyan, */
104/* light violett, light green, light blue, light yellow */
105/* these 16 colors are 8 times here in different luminance (dark..light) */
106/* taken from digitized tv screenshot */
107   MAKE_RGB(0x06, 0x01, 0x03), MAKE_RGB(0x2b, 0x2b, 0x2b), MAKE_RGB(0x67, 0x0e, 0x0f), MAKE_RGB(0x00, 0x3f, 0x42),
108   MAKE_RGB(0x57, 0x00, 0x6d), MAKE_RGB(0x00, 0x4e, 0x00), MAKE_RGB(0x19, 0x1c, 0x94), MAKE_RGB(0x38, 0x38, 0x00),
109   MAKE_RGB(0x56, 0x20, 0x00), MAKE_RGB(0x4b, 0x28, 0x00), MAKE_RGB(0x16, 0x48, 0x00), MAKE_RGB(0x69, 0x07, 0x2f),
110   MAKE_RGB(0x00, 0x46, 0x26), MAKE_RGB(0x06, 0x2a, 0x80), MAKE_RGB(0x2a, 0x14, 0x9b), MAKE_RGB(0x0b, 0x49, 0x00),
111
112   MAKE_RGB(0x00, 0x03, 0x02), MAKE_RGB(0x3d, 0x3d, 0x3d), MAKE_RGB(0x75, 0x1e, 0x20), MAKE_RGB(0x00, 0x50, 0x4f),
113   MAKE_RGB(0x6a, 0x10, 0x78), MAKE_RGB(0x04, 0x5c, 0x00), MAKE_RGB(0x2a, 0x2a, 0xa3), MAKE_RGB(0x4c, 0x47, 0x00),
114   MAKE_RGB(0x69, 0x2f, 0x00), MAKE_RGB(0x59, 0x38, 0x00), MAKE_RGB(0x26, 0x56, 0x00), MAKE_RGB(0x75, 0x15, 0x41),
115   MAKE_RGB(0x00, 0x58, 0x3d), MAKE_RGB(0x15, 0x3d, 0x8f), MAKE_RGB(0x39, 0x22, 0xae), MAKE_RGB(0x19, 0x59, 0x00),
116
117   MAKE_RGB(0x00, 0x03, 0x04), MAKE_RGB(0x42, 0x42, 0x42), MAKE_RGB(0x7b, 0x28, 0x20), MAKE_RGB(0x02, 0x56, 0x59),
118   MAKE_RGB(0x6f, 0x1a, 0x82), MAKE_RGB(0x0a, 0x65, 0x09), MAKE_RGB(0x30, 0x34, 0xa7), MAKE_RGB(0x50, 0x51, 0x00),
119   MAKE_RGB(0x6e, 0x36, 0x00), MAKE_RGB(0x65, 0x40, 0x00), MAKE_RGB(0x2c, 0x5c, 0x00), MAKE_RGB(0x7d, 0x1e, 0x45),
120   MAKE_RGB(0x01, 0x61, 0x45), MAKE_RGB(0x1c, 0x45, 0x99), MAKE_RGB(0x42, 0x2d, 0xad), MAKE_RGB(0x1d, 0x62, 0x00),
121
122   MAKE_RGB(0x05, 0x00, 0x02), MAKE_RGB(0x56, 0x55, 0x5a), MAKE_RGB(0x90, 0x3c, 0x3b), MAKE_RGB(0x17, 0x6d, 0x72),
123   MAKE_RGB(0x87, 0x2d, 0x99), MAKE_RGB(0x1f, 0x7b, 0x15), MAKE_RGB(0x46, 0x49, 0xc1), MAKE_RGB(0x66, 0x63, 0x00),
124   MAKE_RGB(0x84, 0x4c, 0x0d), MAKE_RGB(0x73, 0x55, 0x00), MAKE_RGB(0x40, 0x72, 0x00), MAKE_RGB(0x91, 0x33, 0x5e),
125   MAKE_RGB(0x19, 0x74, 0x5c), MAKE_RGB(0x32, 0x59, 0xae), MAKE_RGB(0x59, 0x3f, 0xc3), MAKE_RGB(0x32, 0x76, 0x00),
126
127   MAKE_RGB(0x02, 0x01, 0x06), MAKE_RGB(0x84, 0x7e, 0x85), MAKE_RGB(0xbb, 0x67, 0x68), MAKE_RGB(0x45, 0x96, 0x96),
128   MAKE_RGB(0xaf, 0x58, 0xc3), MAKE_RGB(0x4a, 0xa7, 0x3e), MAKE_RGB(0x73, 0x73, 0xec), MAKE_RGB(0x92, 0x8d, 0x11),
129   MAKE_RGB(0xaf, 0x78, 0x32), MAKE_RGB(0xa1, 0x80, 0x20), MAKE_RGB(0x6c, 0x9e, 0x12), MAKE_RGB(0xba, 0x5f, 0x89),
130   MAKE_RGB(0x46, 0x9f, 0x83), MAKE_RGB(0x61, 0x85, 0xdd), MAKE_RGB(0x84, 0x6c, 0xef), MAKE_RGB(0x5d, 0xa3, 0x29),
131
132   MAKE_RGB(0x02, 0x00, 0x0a), MAKE_RGB(0xb2, 0xac, 0xb3), MAKE_RGB(0xe9, 0x92, 0x92), MAKE_RGB(0x6c, 0xc3, 0xc1),
133   MAKE_RGB(0xd9, 0x86, 0xf0), MAKE_RGB(0x79, 0xd1, 0x76), MAKE_RGB(0x9d, 0xa1, 0xff), MAKE_RGB(0xbd, 0xbe, 0x40),
134   MAKE_RGB(0xdc, 0xa2, 0x61), MAKE_RGB(0xd1, 0xa9, 0x4c), MAKE_RGB(0x93, 0xc8, 0x3d), MAKE_RGB(0xe9, 0x8a, 0xb1),
135   MAKE_RGB(0x6f, 0xcd, 0xab), MAKE_RGB(0x8a, 0xb4, 0xff), MAKE_RGB(0xb2, 0x9a, 0xff), MAKE_RGB(0x88, 0xcb, 0x59),
136
137   MAKE_RGB(0x02, 0x00, 0x0a), MAKE_RGB(0xc7, 0xca, 0xc9), MAKE_RGB(0xff, 0xac, 0xac), MAKE_RGB(0x85, 0xd8, 0xe0),
138   MAKE_RGB(0xf3, 0x9c, 0xff), MAKE_RGB(0x92, 0xea, 0x8a), MAKE_RGB(0xb7, 0xba, 0xff), MAKE_RGB(0xd6, 0xd3, 0x5b),
139   MAKE_RGB(0xf3, 0xbe, 0x79), MAKE_RGB(0xe6, 0xc5, 0x65), MAKE_RGB(0xb0, 0xe0, 0x57), MAKE_RGB(0xff, 0xa4, 0xcf),
140   MAKE_RGB(0x89, 0xe5, 0xc8), MAKE_RGB(0xa4, 0xca, 0xff), MAKE_RGB(0xca, 0xb3, 0xff), MAKE_RGB(0xa2, 0xe5, 0x7a),
141
142   MAKE_RGB(0x01, 0x01, 0x01), MAKE_RGB(0xff, 0xff, 0xff), MAKE_RGB(0xff, 0xf6, 0xf2), MAKE_RGB(0xd1, 0xff, 0xff),
143   MAKE_RGB(0xff, 0xe9, 0xff), MAKE_RGB(0xdb, 0xff, 0xd3), MAKE_RGB(0xfd, 0xff, 0xff), MAKE_RGB(0xff, 0xff, 0xa3),
144   MAKE_RGB(0xff, 0xff, 0xc1), MAKE_RGB(0xff, 0xff, 0xb2), MAKE_RGB(0xfc, 0xff, 0xa2), MAKE_RGB(0xff, 0xee, 0xff),
145   MAKE_RGB(0xd1, 0xff, 0xff), MAKE_RGB(0xeb, 0xff, 0xff), MAKE_RGB(0xff, 0xf8, 0xff), MAKE_RGB(0xed, 0xff, 0xbc)
146};
147
148
149#define NOISE_BUFFER_SIZE_SEC 5
150
151#define TONE_ON         (!(m_reg[0x11] & 0x80))     /* or tone update!? */
152#define TONE1_ON        ((m_reg[0x11] & 0x10))
153#define TONE1_VALUE     (m_reg[0x0e] | ((m_reg[0x12] & 3) << 8))
154#define TONE2_ON        ((m_reg[0x11] & 0x20))
155#define TONE2_VALUE     (m_reg[0x0f] | ((m_reg[0x10] & 3) << 8))
156#define VOLUME          (m_reg[0x11] & 0x0f)
157#define NOISE_ON        (m_reg[0x11] & 0x40)
158
159/*
160 * pal 111860.781
161 * ntsc 111840.45
162 */
163#define TONE_FREQUENCY(reg)         ((TED7360_CLOCK >> 3) / (1024 - reg))
164#define TONE_FREQUENCY_MIN          (TONE_FREQUENCY(0))
165#define NOISE_FREQUENCY             (TED7360_CLOCK / 8 / (1024 - TONE2_VALUE))
166#define NOISE_FREQUENCY_MAX         (TED7360_CLOCK / 8)
167
168
169//**************************************************************************
170//  GLOBAL VARIABLES
171//**************************************************************************
172
173// device type definition
174const device_type MOS7360 = &device_creator<mos7360_device>;
175
176
177// default address maps
178static ADDRESS_MAP_START( mos7360_videoram_map, AS_0, 8, mos7360_device )
179   AM_RANGE(0x0000, 0xffff) AM_RAM
180ADDRESS_MAP_END
181
182
183//-------------------------------------------------
184//  memory_space_config - return a description of
185//  any address spaces owned by this device
186//-------------------------------------------------
187
188const address_space_config *mos7360_device::memory_space_config(address_spacenum spacenum) const
189{
190   switch (spacenum)
191   {
192      case AS_0: return &m_videoram_space_config;
193      default: return NULL;
194   }
195}
196
197
198
199//**************************************************************************
200//  INLINE HELPERS
201//**************************************************************************
202
203inline void mos7360_device::set_interrupt(int mask)
204{
205   /* kernel itself polls for timer 2 shot (interrupt disabled!) when cassette loading */
206   m_reg[9] |= mask;
207   if ((m_reg[0xa] & m_reg[9] & 0x5e))
208   {
209      if (!(m_reg[9] & 0x80))
210      {
211         //DBG_LOG(1, "ted7360", ("irq start %.2x\n", mask));
212         m_reg[9] |= 0x80;
213         m_out_irq_func(ASSERT_LINE);
214      }
215   }
216   m_reg[9] |= mask;
217}
218
219inline void mos7360_device::clear_interrupt(int mask)
220{
221   m_reg[9] &= ~mask;
222   if ((m_reg[9] & 0x80) && !(m_reg[9] & m_reg[0xa] & 0x5e))
223   {
224      DBG_LOG(1, "ted7360", ("irq end %.2x\n", mask));
225      m_reg[9] &= ~0x80;
226      m_out_irq_func(CLEAR_LINE);
227   }
228}
229
230inline int mos7360_device::rastercolumn()
231{
232   return (int) ((machine().time().as_double() - m_rastertime) * TED7360_VRETRACERATE * m_lines * 57 * 8 + 0.5);
233}
234
235inline UINT8 mos7360_device::read_ram(offs_t offset)
236{
237   int rom = m_rom;
238   m_rom = 0;
239
240   m_last_data = space(AS_0).read_byte(offset);
241
242   m_rom = rom;
243
244   return m_last_data;
245}
246
247inline UINT8 mos7360_device::read_rom(offs_t offset)
248{
249   int rom = m_rom;
250   m_rom = 1;
251
252   m_last_data = space(AS_0).read_byte(offset);
253
254   m_rom = rom;
255
256   return m_last_data;
257}
258
259
260
261//**************************************************************************
262//  LIVE DEVICE
263//**************************************************************************
264
265//-------------------------------------------------
266//  mos7360_device - constructor
267//-------------------------------------------------
268
269mos7360_device::mos7360_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
270   : device_t(mconfig, MOS7360, "MOS7360", tag, owner, clock),
271      device_memory_interface(mconfig, *this),
272      device_sound_interface(mconfig, *this),
273      m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mos7360_videoram_map)),
274      m_stream(NULL)
275{
276}
277
278
279//-------------------------------------------------
280//  device_config_complete - perform any
281//  operations now that the configuration is
282//  complete
283//-------------------------------------------------
284
285void mos7360_device::device_config_complete()
286{
287   // inherit a copy of the static data
288   const mos7360_interface *intf = reinterpret_cast<const mos7360_interface *>(static_config());
289   if (intf != NULL)
290      *static_cast<mos7360_interface *>(this) = *intf;
291
292   // or initialize to defaults if none provided
293   else
294   {
295      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
296      memset(&m_in_k_cb, 0, sizeof(m_in_k_cb));
297   }
298}
299
300
301//-------------------------------------------------
302//  device_start - device-specific startup
303//-------------------------------------------------
304
305void mos7360_device::device_start()
306{
307   // get the screen device
308   m_screen = machine().device<screen_device>(m_screen_tag);
309   assert(m_screen != NULL);
310
311   // get the CPU device
312   m_cpu = machine().device<cpu_device>(m_cpu_tag);
313   assert(m_cpu != NULL);
314
315   // resolve callbacks
316   m_out_irq_func.resolve(m_out_irq_cb, *this);
317   m_in_k_func.resolve(m_in_k_cb, *this);
318
319   // allocate timers
320   m_timer1 = timer_alloc(TIMER_ID_1);
321   m_timer2 = timer_alloc(TIMER_ID_2);
322   m_timer3 = timer_alloc(TIMER_ID_3);
323
324   // allocate screen bitmap
325   m_screen->register_screen_bitmap(m_bitmap);
326
327   // create sound stream
328   m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate());
329
330   // buffer for fastest played sample for 5 second so we have enough data for min 5 second
331   m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
332   m_noise = auto_alloc_array(machine(), UINT8, m_noisesize);
333
334   {
335      int noiseshift = 0x7ffff8;
336      UINT8 data;
337
338      for (int i = 0; i < m_noisesize; i++)
339      {
340         data = 0;
341         if (noiseshift & 0x400000)
342            data |= 0x80;
343         if (noiseshift & 0x100000)
344            data |= 0x40;
345         if (noiseshift & 0x010000)
346            data |= 0x20;
347         if (noiseshift & 0x002000)
348            data |= 0x10;
349         if (noiseshift & 0x000800)
350            data |= 0x08;
351         if (noiseshift & 0x000080)
352            data |= 0x04;
353         if (noiseshift & 0x000010)
354            data |= 0x02;
355         if (noiseshift & 0x000004)
356            data |= 0x01;
357         m_noise[i] = data;
358         if (((noiseshift & 0x400000) == 0) != ((noiseshift & 0x002000) == 0))
359            noiseshift = (noiseshift << 1) | 1;
360         else
361            noiseshift <<= 1;
362      }
363   }
364
365   // register for state saving
366   //save_item(NAME());
367}
368
369
370//-------------------------------------------------
371//  device_reset - device-specific reset
372//-------------------------------------------------
373
374void mos7360_device::device_reset()
375{
376   memset(m_reg, 0, ARRAY_LENGTH(m_reg));
377
378   m_rom = 1;  // FIXME: at start should be RAM or ROM? old c16 code set it to ROM at init: is it correct?
379
380   m_lines = TED7360_LINES;
381   m_chargenaddr = m_bitmapaddr = m_videoaddr = 0;
382   m_timer1_active = m_timer2_active = m_timer3_active = 0;
383   m_cursor1 = 0;
384
385   m_rasterline = 0;
386   m_lastline = 0;
387
388   m_rastertime = 0.0;
389
390   m_frame_count = 0;
391
392   m_x_begin = 0;
393   m_x_end = 0;
394   m_y_begin = 0;
395   m_y_end = 0;
396
397   memset(m_c16_bitmap, 0, ARRAY_LENGTH(m_c16_bitmap));
398   memset(m_bitmapmulti, 0, ARRAY_LENGTH(m_bitmapmulti));
399   memset(m_mono, 0, ARRAY_LENGTH(m_mono));
400   memset(m_monoinversed, 0, ARRAY_LENGTH(m_monoinversed));
401   memset(m_multi, 0, ARRAY_LENGTH(m_multi));
402   memset(m_ecmcolor, 0, ARRAY_LENGTH(m_ecmcolor));
403   memset(m_colors, 0, ARRAY_LENGTH(m_colors));
404
405   m_tone1pos = 0;
406   m_tone2pos = 0;
407   m_tone1samples = 1;
408   m_tone2samples = 1;
409   m_noisepos = 0;
410   m_noisesamples = 1;
411}
412
413
414//-------------------------------------------------
415//  device_timer - handler timer events
416//-------------------------------------------------
417
418void mos7360_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
419{
420   switch (id)
421   {
422   case TIMER_ID_1:
423      // proved by digisound of several intros like eoroidpro
424      m_timer1->adjust(TEDTIME_IN_CYCLES(TIMER1), 1);
425      m_timer1_active = 1;
426      set_interrupt(0x08);
427      break;
428
429   case TIMER_ID_2:
430      m_timer2->adjust(TEDTIME_IN_CYCLES(0x10000), 2);
431      m_timer2_active = 1;
432      set_interrupt(0x10);
433      break;
434
435   case TIMER_ID_3:
436      m_timer3->adjust(TEDTIME_IN_CYCLES(0x10000), 3);
437      m_timer3_active = 1;
438      set_interrupt(0x40);
439      break;
440   }
441}
442
443
444//-------------------------------------------------
445//  sound_stream_update - handle update requests for
446//  our sound stream
447//-------------------------------------------------
448
449void mos7360_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
450{
451   int i, v, a;
452   stream_sample_t *buffer = outputs[0];
453
454   for (i = 0; i < samples; i++)
455   {
456      v = 0;
457
458      if (TONE1_ON)
459      {
460         if (m_tone1pos <= m_tone1samples / 2 || !TONE_ON)
461            v += 0x2ff; // depends on the volume between sound and noise
462
463         m_tone1pos++;
464
465         if (m_tone1pos > m_tone1samples)
466            m_tone1pos = 0;
467      }
468
469      if (TONE2_ON || NOISE_ON )
470      {
471         if (TONE2_ON)
472         {                          /*higher priority ?! */
473            if (m_tone2pos <= m_tone2samples / 2 || !TONE_ON)
474               v += 0x2ff;
475
476            m_tone2pos++;
477
478            if (m_tone2pos > m_tone2samples)
479               m_tone2pos = 0;
480         }
481         else
482         {
483            v += m_noise[(int) ((double) m_noisepos * m_noisesize / m_noisesamples)];
484            m_noisepos++;
485
486            if ((double) m_noisepos / m_noisesamples >= 1.0)
487               m_noisepos = 0;
488         }
489      }
490
491      a = VOLUME;
492      if (a > 8)
493         a = 8;
494
495      v = v * a;
496
497      buffer[i] = v;
498   }
499}
500
501
502void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int xoff, UINT16 *color)
503{
504   int y, code;
505
506   for (y = ybegin; y <= yend; y++)
507   {
508      if (INROM)
509         code = read_rom(m_chargenaddr + ch * 8 + y);
510      else
511         code = read_ram(m_chargenaddr + ch * 8 + y);
512
513      m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE[color[code >> 7]];
514      m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[color[(code >> 6) & 1]];
515      m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE[color[(code >> 5) & 1]];
516      m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[color[(code >> 4) & 1]];
517      m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE[color[(code >> 3) & 1]];
518      m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[color[(code >> 2) & 1]];
519      m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE[color[(code >> 1) & 1]];
520      m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[color[code & 1]];
521   }
522}
523
524void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff)
525{
526   int y, code;
527
528   for (y = ybegin; y <= yend; y++)
529   {
530      if (INROM)
531         code = read_rom(m_chargenaddr + ch * 8 + y);
532      else
533         code = read_ram(m_chargenaddr + ch * 8 + y);
534
535      m_bitmap.pix32(y + yoff, 0 + xoff) =
536         m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_multi[code >> 6]];
537      m_bitmap.pix32(y + yoff, 2 + xoff) =
538         m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_multi[(code >> 4) & 3]];
539      m_bitmap.pix32(y + yoff, 4 + xoff) =
540         m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_multi[(code >> 2) & 3]];
541      m_bitmap.pix32(y + yoff, 6 + xoff) =
542         m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_multi[code & 3]];
543   }
544}
545
546void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff)
547{
548   int y, code;
549
550   for (y = ybegin; y <= yend; y++)
551   {
552      code = read_ram(m_bitmapaddr + ch * 8 + y);
553
554      m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE[m_c16_bitmap[code >> 7]];
555      m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_c16_bitmap[(code >> 6) & 1]];
556      m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE[m_c16_bitmap[(code >> 5) & 1]];
557      m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_c16_bitmap[(code >> 4) & 1]];
558      m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE[m_c16_bitmap[(code >> 3) & 1]];
559      m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_c16_bitmap[(code >> 2) & 1]];
560      m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE[m_c16_bitmap[(code >> 1) & 1]];
561      m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_c16_bitmap[code & 1]];
562   }
563}
564
565void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff)
566{
567   int y, code;
568
569   for (y = ybegin; y <= yend; y++)
570   {
571      code = read_ram(m_bitmapaddr + ch * 8 + y);
572
573      m_bitmap.pix32(y + yoff, 0 + xoff) =
574         m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_bitmapmulti[code >> 6]];
575      m_bitmap.pix32(y + yoff, 2 + xoff) =
576         m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_bitmapmulti[(code >> 4) & 3]];
577      m_bitmap.pix32(y + yoff, 4 + xoff) =
578         m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_bitmapmulti[(code >> 2) & 3]];
579      m_bitmap.pix32(y + yoff, 6 + xoff) =
580         m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_bitmapmulti[code & 3]];
581   }
582}
583
584void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int color)
585{
586   int y;
587
588   for (y = ybegin; y <= yend; y++)
589   {
590      for (int x = 0; x < 8; x++)
591      {
592         m_bitmap.pix32(y + yoff, x + xoff) = PALETTE[color];
593      }
594   }
595}
596
597void mos7360_device::drawlines(int first, int last)
598{
599   int line, vline, end;
600   int attr, ch, c1, c2, ecm;
601   int offs, yoff, xoff, ybegin, yend, xbegin, xend;
602   int i;
603
604   m_lastline = last;
605
606   /* top part of display not rastered */
607   first -= TED7360_YPOS;
608   last -= TED7360_YPOS;
609   if ((first >= last) || (last <= 0))
610      return;
611   if (first < 0)
612      first = 0;
613
614   if (!SCREENON)
615   {
616      for (line = first; (line < last) && (line < m_bitmap.height()); line++)
617      {
618         for (int x = 0; x < m_bitmap.width(); x++)
619         {
620            m_bitmap.pix32(line, x) = PALETTE[0];
621         }
622      }
623      return;
624   }
625
626   if (COLUMNS40)
627      xbegin = XPOS, xend = xbegin + 320;
628   else
629      xbegin = XPOS + 7, xend = xbegin + 304;
630
631   if (last < m_y_begin)
632      end = last;
633   else
634      end = m_y_begin + YPOS;
635   {
636      for (line = first; line < end; line++)
637      {
638         for (int x = 0; x < m_bitmap.width(); x++)
639         {
640            m_bitmap.pix32(line, x) = PALETTE[FRAMECOLOR];
641         }
642      }
643   }
644   if (LINES25)
645      vline = line - m_y_begin - YPOS;
646   else
647      vline = line - m_y_begin - YPOS + 8 - VERTICALPOS;
648
649   if (last < m_y_end + YPOS)
650      end = last;
651   else
652      end = m_y_end + YPOS;
653
654   for (; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin)
655   {
656      offs = (vline >> 3) * 40;
657      ybegin = vline & 7;
658      yoff = line - ybegin;
659      yend = (yoff + 7 < end) ? 7 : (end - yoff - 1);
660      /* rendering 39 characters */
661      /* left and right borders are overwritten later */
662
663      for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++)
664      {
665         if (HIRESON)
666         {
667            ch = read_ram((m_videoaddr | 0x400) + offs);
668            attr = read_ram(m_videoaddr + offs);
669            c1 = ((ch >> 4) & 0xf) | (attr << 4);
670            c2 = (ch & 0xf) | (attr & 0x70);
671            m_bitmapmulti[1] = m_c16_bitmap[1] = c1 & 0x7f;
672            m_bitmapmulti[2] = m_c16_bitmap[0] = c2 & 0x7f;
673            if (MULTICOLORON)
674            {
675               draw_bitmap_multi(ybegin, yend, offs, yoff, xoff);
676            }
677            else
678            {
679               draw_bitmap(ybegin, yend, offs, yoff, xoff);
680            }
681         }
682         else
683         {
684            ch = read_ram((m_videoaddr | 0x400) + offs);
685            attr = read_ram(m_videoaddr + offs);
686            // levente harsfalvi's docu says cursor off in ecm and multicolor
687            if (ECMON)
688            {
689               // hardware reverse off
690               ecm = ch >> 6;
691               m_ecmcolor[0] = m_colors[ecm];
692               m_ecmcolor[1] = attr & 0x7f;
693               draw_character(ybegin, yend, ch & ~0xc0, yoff, xoff, m_ecmcolor);
694            }
695            else if (MULTICOLORON)
696            {
697               // hardware reverse off
698               if (attr & 8)
699               {
700                  m_multi[3] = attr & 0x77;
701                  draw_character_multi(ybegin, yend, ch, yoff, xoff);
702               }
703               else
704               {
705                  m_mono[1] = attr & 0x7f;
706                  draw_character(ybegin, yend, ch, yoff, xoff, m_mono);
707               }
708            }
709            else if (m_cursor1 && (offs == CURSOR1POS))
710            {
711               draw_cursor(ybegin, yend, yoff, xoff, attr & 0x7f);
712            }
713            else if (REVERSEON && (ch & 0x80))
714            {
715               m_monoinversed[0] = attr & 0x7f;
716               if (m_cursor1 && (attr & 0x80))
717                  draw_cursor(ybegin, yend, yoff, xoff, m_monoinversed[0]);
718               else
719                  draw_character(ybegin, yend, ch & ~0x80, yoff, xoff, m_monoinversed);
720            }
721            else
722            {
723               m_mono[1] = attr & 0x7f;
724               if (m_cursor1 && (attr & 0x80))
725                  draw_cursor(ybegin, yend, yoff, xoff, m_mono[0]);
726               else
727                  draw_character(ybegin, yend, ch, yoff, xoff, m_mono);
728            }
729         }
730      }
731
732      for (i = ybegin; i <= yend; i++)
733      {
734         for (int x = 0; x < xbegin; x++)
735         {
736            m_bitmap.pix32(yoff + i, x) = PALETTE[FRAMECOLOR];
737         }
738
739         for (int x = xend; x < m_bitmap.width(); x++)
740         {
741            m_bitmap.pix32(yoff + i, x) = PALETTE[FRAMECOLOR];
742         }
743      }
744   }
745
746   if (last < m_bitmap.height())
747      end = last;
748   else
749      end = m_bitmap.height();
750
751   for (; line < end; line++)
752   {
753      for (int x = 0; x < m_bitmap.width(); x++)
754      {
755         m_bitmap.pix32(line, x) = PALETTE[FRAMECOLOR];
756      }
757   }
758}
759
760void mos7360_device::soundport_w(int offset, int data)
761{
762   // int old = m_reg[offset];
763   m_stream->update();
764
765   switch (offset)
766   {
767   case 0x0e:
768   case 0x12:
769      if (offset == 0x12)
770         m_reg[offset] = (m_reg[offset] & ~3) | (data & 3);
771      else
772         m_reg[offset] = data;
773
774      m_tone1samples = machine().sample_rate() / TONE_FREQUENCY (TONE1_VALUE);
775      DBG_LOG(1, "ted7360", ("tone1 %d %d sample:%d\n", TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), m_tone1samples));
776      break;
777
778   case 0xf:
779   case 0x10:
780      m_reg[offset] = data;
781
782      m_tone2samples = machine().sample_rate() / TONE_FREQUENCY (TONE2_VALUE);
783      DBG_LOG (1, "ted7360", ("tone2 %d %d sample:%d\n", TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), m_tone2samples));
784
785      m_noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * machine().sample_rate() * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY);
786      DBG_LOG (1, "ted7360", ("noise %d sample:%d\n", NOISE_FREQUENCY, m_noisesamples));
787
788      if (!NOISE_ON || ((double) m_noisepos / m_noisesamples >= 1.0))
789         m_noisepos = 0;
790      break;
791
792   case 0x11:
793      m_reg[offset] = data;
794      DBG_LOG(1, "ted7360", ("%s volume %d, %s %s %s\n", TONE_ON?"on":"off",
795                  VOLUME, TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", NOISE_ON?"noise":""));
796
797      if (!TONE_ON||!TONE1_ON) m_tone1pos = 0;
798      if (!TONE_ON||!TONE2_ON) m_tone2pos = 0;
799      if (!TONE_ON||!NOISE_ON) m_noisepos = 0;
800      break;
801   }
802}
803
804
805//-------------------------------------------------
806//  read - register read
807//-------------------------------------------------
808
809READ8_MEMBER( mos7360_device::read )
810{
811   int val = 0;
812
813   switch (offset)
814   {
815   case 0:
816      if (m_timer1)
817         val = TEDTIME_TO_CYCLES(m_timer1->remaining()) & 0xff;
818      else
819         val = m_reg[offset];
820      break;
821   case 1:
822      if (m_timer1)
823         val = TEDTIME_TO_CYCLES(m_timer1->remaining()) >> 8;
824      else
825         val = m_reg[offset];
826      break;
827   case 2:
828      if (m_timer2)
829         val = TEDTIME_TO_CYCLES(m_timer2->remaining()) & 0xff;
830      else
831         val = m_reg[offset];
832      break;
833   case 3:
834      if (m_timer2)
835         val = TEDTIME_TO_CYCLES(m_timer2->remaining()) >> 8;
836      else
837         val = m_reg[offset];
838      break;
839   case 4:
840      if (m_timer3)
841         val = TEDTIME_TO_CYCLES(m_timer3->remaining()) & 0xff;
842      else
843         val = m_reg[offset];
844      break;
845   case 5:
846      if (m_timer3)
847         val = TEDTIME_TO_CYCLES(m_timer3->remaining()) >> 8;
848      else
849         val = m_reg[offset];
850      break;
851   case 7:
852      val = (m_reg[offset] & ~0x40);
853      if (m_clock == TED7360NTSC_CLOCK)
854         val |= 0x40;
855      break;
856   case 9:
857      val = m_reg[offset] | 1;
858      break;
859   case 0xa:
860      val = m_reg[offset];
861      break;
862   case 0xb:
863      val = m_reg[offset];
864      break;
865   case 0x0c:
866      val = m_reg[offset] |= 0xfc;
867      break;
868   case 0x13:
869      val = m_reg[offset] & ~1;
870      if (m_rom)
871         val |= 1;
872      break;
873   case 0x1c:                         /*rasterline */
874      drawlines(m_lastline, m_rasterline);
875      val = ((RASTERLINE_2_C16(m_rasterline) & 0x100) >> 8) | 0xfe;   /* expected by matrix */
876      break;
877   case 0x1d:                         /*rasterline */
878      drawlines(m_lastline, m_rasterline);
879      val = RASTERLINE_2_C16(m_rasterline) & 0xff;
880      break;
881   case 0x1e:                         /*rastercolumn */
882      val = rastercolumn() / 2;   /* pengo >=0x99 */
883      break;
884   case 0x1f:
885      val = ((m_rasterline & 7) << 4) | (m_reg[offset] & 0x0f);
886      DBG_LOG(1, "port_w", ("read from cursorblink %.2x\n", val));
887      break;
888   default:
889      val = m_reg[offset];
890      break;
891   }
892
893   if ((offset != 8) && (offset >= 6) && (offset != 0x1c) && (offset != 0x1d) && (offset != 9) && ((offset < 0x15) || (offset > 0x19)))
894   {
895      DBG_LOG(1, "port_r", ("%.2x:%.2x\n", offset, val));
896   }
897
898   return val;
899}
900
901
902//-------------------------------------------------
903//  write - register write
904//-------------------------------------------------
905
906WRITE8_MEMBER( mos7360_device::write )
907{
908   int old;
909
910   if ((offset != 8) && ((offset < 0x15) || (offset > 0x19)))
911   {
912      DBG_LOG(1, "port_w", ("%.2x:%.2x\n", offset, data));
913   }
914
915   switch (offset)
916   {
917   case 0xe:
918   case 0xf:
919   case 0x10:
920   case 0x11:
921   case 0x12:
922      soundport_w(offset, data);
923      break;
924   }
925   switch (offset)
926   {
927   case 0:                        /* stop timer 1 */
928      m_reg[offset] = data;
929
930      if (m_timer1_active)
931      {
932         m_reg[1] = TEDTIME_TO_CYCLES(m_timer1->remaining()) >> 8;
933         m_timer1->reset();
934         m_timer1_active = 0;
935      }
936      break;
937   case 1:                        /* start timer 1 */
938      m_reg[offset] = data;
939      m_timer1->adjust(TEDTIME_IN_CYCLES(TIMER1), 1);
940      m_timer1_active = 1;
941      break;
942   case 2:                        /* stop timer 2 */
943      m_reg[offset] = data;
944      if (m_timer2_active)
945      {
946         m_reg[3] = TEDTIME_TO_CYCLES(m_timer2->remaining()) >> 8;
947         m_timer2->reset();
948         m_timer2_active = 0;
949      }
950      break;
951   case 3:                        /* start timer 2 */
952      m_reg[offset] = data;
953      m_timer2->adjust(TEDTIME_IN_CYCLES(TIMER2), 2);
954      m_timer2_active = 1;
955      break;
956   case 4:                        /* stop timer 3 */
957      m_reg[offset] = data;
958      if (m_timer3_active)
959      {
960         m_reg[5] = TEDTIME_TO_CYCLES(m_timer3->remaining()) >> 8;
961         m_timer3->reset();
962         m_timer3_active = 0;
963      }
964      break;
965   case 5:                        /* start timer 3 */
966      m_reg[offset] = data;
967      m_timer3->adjust(TEDTIME_IN_CYCLES(TIMER3), 3);
968      m_timer3_active = 1;
969      break;
970   case 6:
971      if (m_reg[offset] != data)
972      {
973         drawlines(m_lastline, m_rasterline);
974         m_reg[offset] = data;
975         if (LINES25)
976         {
977            m_y_begin = 0;
978            m_y_end = m_y_begin + 200;
979         }
980         else
981         {
982            m_y_begin = 4;
983            m_y_end = m_y_begin + 192;
984         }
985         m_chargenaddr = CHARGENADDR;
986      }
987      break;
988   case 7:
989      if (m_reg[offset] != data)
990      {
991         drawlines(m_lastline, m_rasterline);
992         m_reg[offset] = data;
993         if (COLUMNS40)
994         {
995            m_x_begin = 0;
996            m_x_end = m_x_begin + 320;
997         }
998         else
999         {
1000            m_x_begin = HORICONTALPOS;
1001            m_x_end = m_x_begin + 320;
1002         }
1003         DBG_LOG(3, "port_w", ("%s %s\n", data & 0x40 ? "ntsc" : "pal", data & 0x20 ? "hori freeze" : ""));
1004         m_chargenaddr = CHARGENADDR;
1005      }
1006      break;
1007   case 8:
1008      m_reg[offset] = m_in_k_func(data);
1009      break;
1010   case 9:
1011      if (data & 0x08)
1012         clear_interrupt(8);
1013      if (data & 0x10)
1014         clear_interrupt(0x10);
1015      if (data & 0x40)
1016         clear_interrupt(0x40);
1017      if (data & 0x02)
1018         clear_interrupt(2);
1019      break;
1020   case 0xa:
1021      old = data;
1022      m_reg[offset] = data | 0xa0;
1023#if 0
1024      m_reg[9] = (m_reg[9] & 0xa1) | (m_reg[9] & data & 0x5e);
1025      if (m_reg[9] & 0x80)
1026         clear_interrupt(0);
1027#endif
1028      if ((data ^ old) & 1)
1029      {
1030         /* DBG_LOG(1,"set rasterline hi",("soll:%d\n",RASTERLINE)); */
1031      }
1032      break;
1033   case 0xb:
1034      if (data != m_reg[offset])
1035      {
1036         drawlines(m_lastline, m_rasterline);
1037         m_reg[offset] = data;
1038         /*  DBG_LOG(1,"set rasterline lo",("soll:%d\n",RASTERLINE)); */
1039      }
1040      break;
1041   case 0xc:
1042   case 0xd:
1043      if (m_reg[offset] != data)
1044      {
1045         drawlines(m_lastline, m_rasterline);
1046         m_reg[offset] = data;
1047      }
1048      break;
1049   case 0x12:
1050      if (m_reg[offset] != data)
1051      {
1052         drawlines(m_lastline, m_rasterline);
1053         m_reg[offset] = data;
1054         m_bitmapaddr = BITMAPADDR;
1055         m_chargenaddr = CHARGENADDR;
1056         DBG_LOG(3, "port_w", ("bitmap %.4x %s\n",  BITMAPADDR, INROM ? "rom" : "ram"));
1057      }
1058      break;
1059   case 0x13:
1060      if (m_reg[offset] != data)
1061      {
1062         drawlines(m_lastline, m_rasterline);
1063         m_reg[offset] = data;
1064         m_chargenaddr = CHARGENADDR;
1065         DBG_LOG(3, "port_w", ("chargen %.4x %s %d\n", CHARGENADDR, data & 2 ? "" : "doubleclock", data & 1));
1066      }
1067      break;
1068   case 0x14:
1069      if (m_reg[offset] != data)
1070      {
1071         drawlines(m_lastline, m_rasterline);
1072         m_reg[offset] = data;
1073         m_videoaddr = VIDEOADDR;
1074         DBG_LOG(3, "port_w", ("videoram %.4x\n", VIDEOADDR));
1075      }
1076      break;
1077   case 0x15:                         /* backgroundcolor */
1078      if (m_reg[offset] != data)
1079      {
1080         drawlines(m_lastline, m_rasterline);
1081         m_reg[offset] = data;
1082         m_monoinversed[1] = m_mono[0] = m_bitmapmulti[0] = m_multi[0] = m_colors[0] = BACKGROUNDCOLOR;
1083      }
1084      break;
1085   case 0x16:                         /* foregroundcolor */
1086      if (m_reg[offset] != data)
1087      {
1088         drawlines(m_lastline, m_rasterline);
1089         m_reg[offset] = data;
1090         m_bitmapmulti[3] = m_multi[1] = m_colors[1] = FOREGROUNDCOLOR;
1091      }
1092      break;
1093   case 0x17:                         /* multicolor 1 */
1094      if (m_reg[offset] != data)
1095      {
1096         drawlines(m_lastline, m_rasterline);
1097         m_reg[offset] = data;
1098         m_multi[2] = m_colors[2] = MULTICOLOR1;
1099      }
1100      break;
1101   case 0x18:                         /* multicolor 2 */
1102      if (m_reg[offset] != data)
1103      {
1104         drawlines(m_lastline, m_rasterline);
1105         m_reg[offset] = data;
1106         m_colors[3] = MULTICOLOR2;
1107      }
1108      break;
1109   case 0x19:                         /* framecolor */
1110      if (m_reg[offset] != data)
1111      {
1112         drawlines(m_lastline, m_rasterline);
1113         m_reg[offset] = data;
1114         m_colors[4] = FRAMECOLOR;
1115      }
1116      break;
1117   case 0x1c:
1118      m_reg[offset] = data;          /*? */
1119      DBG_LOG(1, "port_w", ("write to rasterline high %.2x\n",
1120                              data));
1121      break;
1122   case 0x1f:
1123      m_reg[offset] = data;
1124      DBG_LOG(1, "port_w", ("write to cursorblink %.2x\n", data));
1125      break;
1126   default:
1127      m_reg[offset] = data;
1128      break;
1129   }
1130}
1131
1132
1133//-------------------------------------------------
1134//  update_screen - update screen
1135//-------------------------------------------------
1136
1137UINT32 mos7360_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
1138{
1139   copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
1140
1141   return 0;
1142}
1143
1144WRITE_LINE_MEMBER( mos7360_device::rom_switch_w )
1145{
1146   m_rom = state;
1147}
1148
1149READ_LINE_MEMBER( mos7360_device::rom_switch_r )
1150{
1151   return m_rom;
1152}
1153
1154void mos7360_device::frame_interrupt_gen()
1155{
1156   if ((m_reg[0x1f] & 0xf) >= 0x0f)
1157   {
1158      /*  if (m_frame_count >= CURSORRATE) */
1159      m_cursor1 ^= 1;
1160      m_reg[0x1f] &= ~0xf;
1161      m_frame_count = 0;
1162   }
1163   else
1164      m_reg[0x1f]++;
1165}
1166
1167void mos7360_device::raster_interrupt_gen()
1168{
1169   m_rasterline++;
1170   m_rastertime = machine().time().as_double();
1171   if (m_rasterline >= m_lines)
1172   {
1173      m_rasterline = 0;
1174      drawlines(m_lastline, TED7360_LINES);
1175      m_lastline = 0;
1176   }
1177
1178   if (m_rasterline == C16_2_RASTERLINE(RASTERLINE))
1179   {
1180      drawlines(m_lastline, m_rasterline);
1181      set_interrupt(2);
1182   }
1183}
1184
1185
1186//-------------------------------------------------
1187//  bus_r - data bus read
1188//-------------------------------------------------
1189
1190UINT8 mos7360_device::bus_r()
1191{
1192   return m_last_data;
1193}
1194
1195
1196//-------------------------------------------------
1197//  cs0_r - chip select 0 read
1198//-------------------------------------------------
1199
1200int mos7360_device::cs0_r(offs_t offset)
1201{
1202   if (m_rom && offset >= 0x8000 && offset < 0xc000)
1203   {
1204      return 0;
1205   }
1206
1207   return 1;
1208}
1209
1210
1211//-------------------------------------------------
1212//  cs0_r - chip select 1 read
1213//-------------------------------------------------
1214
1215int mos7360_device::cs1_r(offs_t offset)
1216{
1217   if (m_rom && ((offset >= 0xc000 && offset < 0xfd00) || (offset >= 0xff20)))
1218   {
1219      return 0;
1220   }
1221
1222   return 1;
1223}
trunk/src/mess/audio/mos7360.h
r20984r20985
1/***************************************************************************
2
3    MOS 7360/8360 Text Edit Device (TED) emulation
4
5    Copyright the MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8****************************************************************************
9                            _____   _____
10                   DB6   1 |*    \_/     | 40  Vcc
11                   DB5   2 |             | 39  DB7
12                   DB4   3 |             | 38  DB8
13                   DB3   4 |             | 37  DB9
14                   DB2   5 |             | 36  DB10
15                   DB1   6 |             | 35  DB11
16                   DB0   7 |             | 34  A13
17                  _IRQ   8 |             | 33  A12
18                    LP   9 |             | 32  A11
19                   _CS  10 |   MOS7360   | 31  A10
20                   R/W  11 |             | 30  A9
21                    BA  12 |             | 29  A8
22                   Vdd  13 |             | 28  A7
23                 COLOR  14 |             | 27  A6
24                 S/LUM  15 |             | 26  A5
25                   AEC  16 |             | 25  A4
26                   PH0  17 |             | 24  A3
27                  PHIN  18 |             | 23  A2
28                 PHCOL  19 |             | 22  A1
29                   Vss  20 |_____________| 21  A0
30
31***************************************************************************/
32
33#pragma once
34
35#ifndef __MOS7360__
36#define __MOS7360__
37
38#include "emu.h"
39
40
41
42/***************************************************************************
43    DEVICE CONFIGURATION MACROS
44***************************************************************************/
45
46#define MCFG_MOS7360_ADD(_tag, _screen_tag, _clock, _config, _videoram_map) \
47   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
48   MCFG_SCREEN_REFRESH_RATE(TED7360PAL_VRETRACERATE) \
49   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \
50   MCFG_SCREEN_SIZE(336, 216) \
51   MCFG_SCREEN_VISIBLE_AREA(0, 336 - 1, 0, 216 - 1) \
52   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos7360_device, screen_update) \
53   MCFG_DEVICE_ADD(_tag, MOS7360, _clock) \
54   MCFG_DEVICE_CONFIG(_config) \
55   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map)
56
57
58#define MOS7360_INTERFACE(_name) \
59   const mos7360_interface (_name) =
60
61
62
63//**************************************************************************
64//  MACROS / CONSTANTS
65//**************************************************************************
66
67#define TED7360NTSC_VRETRACERATE 60
68#define TED7360PAL_VRETRACERATE 50
69#define TED7360_HRETRACERATE 15625
70
71/* the following values depend on the VIC clock,
72 * but to achieve TV-frequency the clock must have a fix frequency */
73#define TED7360_HSIZE   320
74#define TED7360_VSIZE   200
75
76/* of course you clock select an other clock, but for accurate */
77/* video timing (these are used in c16/c116/plus4) */
78#define TED7360NTSC_CLOCK   (14318180/4)
79#define TED7360PAL_CLOCK    (17734470/5)
80
81/* pal 50 Hz vertical screen refresh, screen consists of 312 lines
82 * ntsc 60 Hz vertical screen refresh, screen consists of 262 lines */
83#define TED7360NTSC_LINES 261
84#define TED7360PAL_LINES 312
85
86
87
88/***************************************************************************
89    TYPE DEFINITIONS
90***************************************************************************/
91
92// ======================> mos7360_interface
93
94struct mos7360_interface
95{
96   const char          *m_screen_tag;
97   const char          *m_cpu_tag;
98
99   devcb_write_line    m_out_irq_cb;
100
101   devcb_read8         m_in_k_cb;
102};
103
104
105// ======================> mos7360_device
106
107class mos7360_device :  public device_t,
108                  public device_memory_interface,
109                  public device_sound_interface,
110                  public mos7360_interface
111{
112public:
113   // construction/destruction
114   //mos7360_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
115   mos7360_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
116
117   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
118
119   DECLARE_READ8_MEMBER( read );
120   DECLARE_WRITE8_MEMBER( write );
121
122   int cs0_r(offs_t offset);
123   int cs1_r(offs_t offset);
124
125   UINT8 bus_r();
126
127   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
128
129   // horrible crap code
130   DECLARE_WRITE_LINE_MEMBER( rom_switch_w );
131   DECLARE_READ_LINE_MEMBER( rom_switch_r );
132   void frame_interrupt_gen();
133   void raster_interrupt_gen();
134
135protected:
136   enum
137   {
138      TYPE_7360
139   };
140
141   enum
142   {
143      TIMER_ID_1,
144      TIMER_ID_2,
145      TIMER_ID_3
146   };
147
148   // device-level overrides
149   virtual void device_config_complete();
150   virtual void device_start();
151   virtual void device_reset();
152   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
153
154   // device_sound_interface callbacks
155   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
156
157   inline void set_interrupt(int mask);
158   inline void clear_interrupt(int mask);
159   inline int rastercolumn();
160   inline UINT8 read_ram(offs_t offset);
161   inline UINT8 read_rom(offs_t offset);
162
163   void draw_character(int ybegin, int yend, int ch, int yoff, int xoff, UINT16 *color);
164   void draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff);
165   void draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff);
166   void draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff);
167   void draw_cursor(int ybegin, int yend, int yoff, int xoff, int color);
168   void drawlines(int first, int last);
169   void soundport_w(int offset, int data);
170
171   const address_space_config      m_videoram_space_config;
172
173   devcb_resolved_write_line   m_out_irq_func;
174   devcb_resolved_read8        m_in_k_func;
175
176   screen_device *m_screen;            // screen which sets bitmap properties
177   cpu_device *m_cpu;
178   sound_stream *m_stream;
179
180   UINT8 m_reg[0x20];
181   UINT8 m_last_data;
182
183   bitmap_rgb32 m_bitmap;
184
185   int m_rom;
186
187   int m_frame_count;
188
189   int m_lines;
190   int m_timer1_active, m_timer2_active, m_timer3_active;
191   emu_timer *m_timer1, *m_timer2, *m_timer3;
192   int m_cursor1;
193
194   int m_chargenaddr, m_bitmapaddr, m_videoaddr;
195
196   int m_x_begin, m_x_end;
197   int m_y_begin, m_y_end;
198
199   UINT16 m_c16_bitmap[2], m_bitmapmulti[4], m_mono[2], m_monoinversed[2], m_multi[4], m_ecmcolor[2], m_colors[5];
200
201   int m_rasterline, m_lastline;
202   double m_rastertime;
203
204   /* sound part */
205   UINT8 *m_noise;
206   int m_tone1pos, m_tone2pos,
207   m_tone1samples, m_tone2samples,
208   m_noisesize,          /* number of samples */
209   m_noisepos,         /* pos of tone */
210   m_noisesamples;   /* count of samples to give out per tone */
211
212   int m_variant;
213};
214
215
216// device type definition
217extern const device_type MOS7360;
218
219
220
221#endif
trunk/src/mess/machine/c1581.c
r20984r20985
5252//  complete
5353//-------------------------------------------------
5454
55void base_c1581_device::device_config_complete()
55void c1581_device::device_config_complete()
5656{
5757   switch (m_variant)
5858   {
r20984r20985
100100//  rom_region - device-specific ROM region
101101//-------------------------------------------------
102102
103const rom_entry *base_c1581_device::device_rom_region() const
103const rom_entry *c1581_device::device_rom_region() const
104104{
105105   switch (m_variant)
106106   {
r20984r20985
118118//  ADDRESS_MAP( c1581_mem )
119119//-------------------------------------------------
120120
121static ADDRESS_MAP_START( c1581_mem, AS_PROGRAM, 8, base_c1581_device )
121static ADDRESS_MAP_START( c1581_mem, AS_PROGRAM, 8, c1581_device )
122122   AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM
123123   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE(M8520_TAG, mos8520_device, read, write)
124124   AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE(WD1772_TAG, wd1772_t, read, write)
r20984r20985
130130//  MOS8520_INTERFACE( cia_intf )
131131//-------------------------------------------------
132132
133WRITE_LINE_MEMBER( base_c1581_device::cnt_w )
133WRITE_LINE_MEMBER( c1581_device::cnt_w )
134134{
135135   m_cnt_out = state;
136136
137137   update_iec();
138138}
139139
140WRITE_LINE_MEMBER( base_c1581_device::sp_w )
140WRITE_LINE_MEMBER( c1581_device::sp_w )
141141{
142142   m_sp_out = state;
143143
144144   update_iec();
145145}
146146
147READ8_MEMBER( base_c1581_device::cia_pa_r )
147READ8_MEMBER( c1581_device::cia_pa_r )
148148{
149149   /*
150150
r20984r20985
175175   return data;
176176}
177177
178WRITE8_MEMBER( base_c1581_device::cia_pa_w )
178WRITE8_MEMBER( c1581_device::cia_pa_w )
179179{
180180   /*
181181
r20984r20985
205205   output_set_led_value(LED_ACT, BIT(data, 6));
206206}
207207
208READ8_MEMBER( base_c1581_device::cia_pb_r )
208READ8_MEMBER( c1581_device::cia_pb_r )
209209{
210210   /*
211211
r20984r20985
239239   return data;
240240}
241241
242WRITE8_MEMBER( base_c1581_device::cia_pb_w )
242WRITE8_MEMBER( c1581_device::cia_pb_w )
243243{
244244   /*
245245
r20984r20985
271271   update_iec();
272272}
273273
274static MOS8520_INTERFACE( cia_intf )
275{
276   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0),
277   DEVCB_NULL,
278   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cnt_w),
279   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, sp_w),
280   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pa_r),
281   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pa_w),
282   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pb_r),
283   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1581_device, cia_pb_w)
284};
285274
286
287275//-------------------------------------------------
288276//  SLOT_INTERFACE( c1581_floppies )
289277//-------------------------------------------------
r20984r20985
297285//  FLOPPY_FORMATS( c1581_device::floppy_formats )
298286//-------------------------------------------------
299287
300FLOPPY_FORMATS_MEMBER( base_c1581_device::floppy_formats )
288FLOPPY_FORMATS_MEMBER( c1581_device::floppy_formats )
301289   FLOPPY_D81_FORMAT
302290FLOPPY_FORMATS_END
303291
r20984r20985
310298   MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/8)
311299   MCFG_CPU_PROGRAM_MAP(c1581_mem)
312300
313   MCFG_MOS8520_ADD(M8520_TAG, XTAL_16MHz/8, 0, cia_intf)
301   MCFG_MOS6526_ADD(M8520_TAG, XTAL_16MHz/8, 0, INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0))
302   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1581_device, cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1581_device, sp_w))
303   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c1581_device, cia_pa_r), DEVWRITE8(DEVICE_SELF_OWNER, c1581_device, cia_pa_w))
304   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c1581_device, cia_pb_r), DEVWRITE8(DEVICE_SELF_OWNER, c1581_device, cia_pb_w), NULL)
305
314306   MCFG_WD1772x_ADD(WD1772_TAG, XTAL_16MHz/2)
315307
316   MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", c1581_floppies, "35dd", 0, base_c1581_device::floppy_formats)
308   MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", c1581_floppies, "35dd", 0, c1581_device::floppy_formats)
317309MACHINE_CONFIG_END
318310
319311
r20984r20985
322314//  machine configurations
323315//-------------------------------------------------
324316
325machine_config_constructor base_c1581_device::device_mconfig_additions() const
317machine_config_constructor c1581_device::device_mconfig_additions() const
326318{
327319   return MACHINE_CONFIG_NAME( c1581 );
328320}
r20984r20985
334326//**************************************************************************
335327
336328//-------------------------------------------------
337//  base_c1581_device - constructor
329//  c1581_device - constructor
338330//-------------------------------------------------
339331
340base_c1581_device::base_c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
332c1581_device::c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
341333   : device_t(mconfig, type, name, tag, owner, clock),
342334      device_cbm_iec_interface(mconfig, *this),
343335      m_maincpu(*this, M6502_TAG),
r20984r20985
353345{
354346}
355347
348c1581_device::c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
349   : device_t(mconfig, C1581, "C1581", tag, owner, clock),
350      device_cbm_iec_interface(mconfig, *this),
351      m_maincpu(*this, M6502_TAG),
352      m_cia(*this, M8520_TAG),
353      m_fdc(*this, WD1772_TAG),
354      m_floppy(*this, WD1772_TAG":0:35dd"),
355      m_data_out(0),
356      m_atn_ack(0),
357      m_fast_ser_dir(0),
358      m_sp_out(1),
359      m_cnt_out(1),
360      m_variant(TYPE_1581)
361{
362}
356363
364
357365//-------------------------------------------------
358366//  c1563_device - constructor
359367//-------------------------------------------------
360368
361369c1563_device::c1563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
362   : base_c1581_device(mconfig, C1563, "C1563", tag, owner, clock, TYPE_1563) { }
370   : c1581_device(mconfig, C1563, "C1563", tag, owner, clock, TYPE_1563) { }
363371
364372
365373//-------------------------------------------------
366//  c1581_device - constructor
367//-------------------------------------------------
368
369c1581_device::c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
370   : base_c1581_device(mconfig, C1581, "C1581", tag, owner, clock, TYPE_1581) { }
371
372
373//-------------------------------------------------
374374//  device_start - device-specific startup
375375//-------------------------------------------------
376376
377void base_c1581_device::device_start()
377void c1581_device::device_start()
378378{
379379   // state saving
380380   save_item(NAME(m_data_out));
r20984r20985
389389//  device_reset - device-specific reset
390390//-------------------------------------------------
391391
392void base_c1581_device::device_reset()
392void c1581_device::device_reset()
393393{
394394   m_maincpu->reset();
395395
r20984r20985
410410//  cbm_iec_srq -
411411//-------------------------------------------------
412412
413void base_c1581_device::cbm_iec_srq(int state)
413void c1581_device::cbm_iec_srq(int state)
414414{
415415   update_iec();
416416}
r20984r20985
420420//  cbm_iec_atn -
421421//-------------------------------------------------
422422
423void base_c1581_device::cbm_iec_atn(int state)
423void c1581_device::cbm_iec_atn(int state)
424424{
425425   update_iec();
426426}
r20984r20985
430430//  cbm_iec_data -
431431//-------------------------------------------------
432432
433void base_c1581_device::cbm_iec_data(int state)
433void c1581_device::cbm_iec_data(int state)
434434{
435435   update_iec();
436436}
r20984r20985
440440//  cbm_iec_reset -
441441//-------------------------------------------------
442442
443void base_c1581_device::cbm_iec_reset(int state)
443void c1581_device::cbm_iec_reset(int state)
444444{
445445   if (!state)
446446   {
r20984r20985
453453//  update_iec -
454454//-------------------------------------------------
455455
456void base_c1581_device::update_iec()
456void c1581_device::update_iec()
457457{
458458   m_cia->cnt_w(m_fast_ser_dir || m_bus->srq_r());
459459   m_cia->sp_w(m_fast_ser_dir || m_bus->data_r());
trunk/src/mess/machine/c1581.h
r20984r20985
3434//  TYPE DEFINITIONS
3535//**************************************************************************
3636
37// ======================> base_c1581_device
37// ======================> c1581_device
3838
39class base_c1581_device :  public device_t,
40                     public device_cbm_iec_interface
39class c1581_device :  public device_t,
40                  public device_cbm_iec_interface
4141{
4242public:
4343   // construction/destruction
44   base_c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
44   c1581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
45   c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4546
4647   enum
4748   {
r20984r20985
9495
9596// ======================> c1563_device
9697
97class c1563_device :  public base_c1581_device
98class c1563_device :  public c1581_device
9899{
99100public:
100101   // construction/destruction
r20984r20985
102103};
103104
104105
105// ======================> c1581_device
106
107class c1581_device :  public base_c1581_device
108{
109public:
110   // construction/destruction
111   c1581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
112};
113
114
115106// device type definition
116107extern const device_type C1563;
117108extern const device_type C1581;
trunk/src/mess/machine/c64_legacy.c
r20984r20985
1717
1818#include "cpu/m6502/m6510.h"
1919#include "cpu/z80/z80.h"
20#include "sound/sid6581.h"
20#include "sound/mos6581.h"
2121#include "machine/6526cia.h"
2222#include "machine/cbmiec.h"
2323
trunk/src/mess/machine/ieee488.c
r20984r20985
9696
9797
9898//**************************************************************************
99//  DEVICE CONFIGURATION
100//**************************************************************************
101
102//-------------------------------------------------
103//  device_config_complete - perform any
104//  operations now that the configuration is
105//  complete
106//-------------------------------------------------
107
108void ieee488_device::device_config_complete()
109{
110   // inherit a copy of the static data
111   const ieee488_interface *intf = reinterpret_cast<const ieee488_interface *>(static_config());
112   if (intf != NULL)
113      *static_cast<ieee488_interface *>(this) = *intf;
114
115   // or initialize to defaults if none provided
116   else
117   {
118      memset(&m_out_eoi_cb, 0, sizeof(m_out_eoi_cb));
119      memset(&m_out_dav_cb, 0, sizeof(m_out_dav_cb));
120      memset(&m_out_nrfd_cb, 0, sizeof(m_out_nrfd_cb));
121      memset(&m_out_ndac_cb, 0, sizeof(m_out_ndac_cb));
122      memset(&m_out_ifc_cb, 0, sizeof(m_out_ifc_cb));
123      memset(&m_out_srq_cb, 0, sizeof(m_out_srq_cb));
124      memset(&m_out_atn_cb, 0, sizeof(m_out_atn_cb));
125      memset(&m_out_ren_cb, 0, sizeof(m_out_ren_cb));
126   }
127}
128
129
130
131//**************************************************************************
13299//  INLINE HELPERS
133100//**************************************************************************
134101
r20984r20985
173140   {
174141      switch (signal)
175142      {
176      case EOI:   m_out_eoi_func(state);  break;
177      case DAV:   m_out_dav_func(state);  break;
178      case NRFD:  m_out_nrfd_func(state); break;
179      case NDAC:  m_out_ndac_func(state); break;
180      case IFC:   m_out_ifc_func(state);  break;
181      case SRQ:   m_out_srq_func(state);  break;
182      case ATN:   m_out_atn_func(state);  break;
183      case REN:   m_out_ren_func(state);  break;
143      case EOI:   m_write_eoi(state);  break;
144      case DAV:   m_write_dav(state);  break;
145      case NRFD:  m_write_nrfd(state); break;
146      case NDAC:  m_write_ndac(state); break;
147      case IFC:   m_write_ifc(state);  break;
148      case SRQ:   m_write_srq(state);  break;
149      case ATN:   m_write_atn(state);  break;
150      case REN:   m_write_ren(state);  break;
184151      }
185152
186153      daisy_entry *entry = m_device_list.first();
r20984r20985
325292
326293ieee488_device::ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
327294   : device_t(mconfig, IEEE488, "IEEE488 bus", tag, owner, clock),
295      m_write_eoi(*this),
296      m_write_dav(*this),
297      m_write_nrfd(*this),
298      m_write_ndac(*this),
299      m_write_ifc(*this),
300      m_write_srq(*this),
301      m_write_atn(*this),
302      m_write_ren(*this),
328303      m_dio(0xff)
329304{
330305   for (int i = 0; i < SIGNAL_COUNT; i++)
r20984r20985
341316void ieee488_device::device_start()
342317{
343318   // resolve callbacks
344   m_out_eoi_func.resolve(m_out_eoi_cb, *this);
345   m_out_dav_func.resolve(m_out_dav_cb, *this);
346   m_out_nrfd_func.resolve(m_out_nrfd_cb, *this);
347   m_out_ndac_func.resolve(m_out_ndac_cb, *this);
348   m_out_ifc_func.resolve(m_out_ifc_cb, *this);
349   m_out_srq_func.resolve(m_out_srq_cb, *this);
350   m_out_atn_func.resolve(m_out_atn_cb, *this);
351   m_out_ren_func.resolve(m_out_ren_cb, *this);
319   m_write_eoi.resolve_safe();
320   m_write_dav.resolve_safe();
321   m_write_nrfd.resolve_safe();
322   m_write_ndac.resolve_safe();
323   m_write_ifc.resolve_safe();
324   m_write_srq.resolve_safe();
325   m_write_atn.resolve_safe();
326   m_write_ren.resolve_safe();
352327}
353328
329
354330//-------------------------------------------------
355331//  device_stop - device-specific stop
356332//-------------------------------------------------
trunk/src/mess/machine/ieee488.h
r20984r20985
2929//  INTERFACE CONFIGURATION MACROS
3030//**************************************************************************
3131
32#define MCFG_IEEE488_BUS_ADD(_config) \
33   MCFG_DEVICE_ADD(IEEE488_TAG, IEEE488, 0) \
34   MCFG_DEVICE_CONFIG(_config)
32#define MCFG_IEEE488_BUS_ADD() \
33   MCFG_DEVICE_ADD(IEEE488_TAG, IEEE488, 0)
3534
3635
37#define IEEE488_INTERFACE(_name) \
38   const ieee488_interface (_name) =
36#define MCFG_IEEE488_EOI_CALLBACK(_write) \
37   downcast<ieee488_device *>(device)->set_eoi_callback(DEVCB2_##_write);
3938
39#define MCFG_IEEE488_DAV_CALLBACK(_write) \
40   downcast<ieee488_device *>(device)->set_dav_callback(DEVCB2_##_write);
4041
42#define MCFG_IEEE488_NRFD_CALLBACK(_write) \
43   downcast<ieee488_device *>(device)->set_nrfd_callback(DEVCB2_##_write);
44
45#define MCFG_IEEE488_NDAC_CALLBACK(_write) \
46   downcast<ieee488_device *>(device)->set_ndac_callback(DEVCB2_##_write);
47
48#define MCFG_IEEE488_IFC_CALLBACK(_write) \
49   downcast<ieee488_device *>(device)->set_ifc_callback(DEVCB2_##_write);
50
51#define MCFG_IEEE488_SRQ_CALLBACK(_write) \
52   downcast<ieee488_device *>(device)->set_srq_callback(DEVCB2_##_write);
53
54#define MCFG_IEEE488_ATN_CALLBACK(_write) \
55   downcast<ieee488_device *>(device)->set_atn_callback(DEVCB2_##_write);
56
57#define MCFG_IEEE488_REN_CALLBACK(_write) \
58   downcast<ieee488_device *>(device)->set_ren_callback(DEVCB2_##_write);
59
60
4161#define MCFG_IEEE488_SLOT_ADD(_tag, _num, _slot_intf, _def_slot, _def_inp) \
4262   MCFG_DEVICE_ADD(_tag, IEEE488_SLOT, 0) \
4363   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) \
r20984r20985
4969//  TYPE DEFINITIONS
5070//**************************************************************************
5171
52// ======================> ieee488_interface
53
54struct ieee488_interface
55{
56   devcb_write_line    m_out_eoi_cb;
57   devcb_write_line    m_out_dav_cb;
58   devcb_write_line    m_out_nrfd_cb;
59   devcb_write_line    m_out_ndac_cb;
60   devcb_write_line    m_out_ifc_cb;
61   devcb_write_line    m_out_srq_cb;
62   devcb_write_line    m_out_atn_cb;
63   devcb_write_line    m_out_ren_cb;
64};
65
66
6772// ======================> ieee488_device
6873
6974class device_ieee488_interface;
7075
71class ieee488_device : public device_t,
72                  public ieee488_interface
76class ieee488_device : public device_t
7377{
7478public:
7579   // construction/destruction
7680   ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
7781
82   template<class _write> void set_eoi_callback(_write wr) { m_write_eoi.set_callback(wr); }
83   template<class _write> void set_dav_callback(_write wr) { m_write_dav.set_callback(wr); }
84   template<class _write> void set_nrfd_callback(_write wr) { m_write_nrfd.set_callback(wr); }
85   template<class _write> void set_ndac_callback(_write wr) { m_write_ndac.set_callback(wr); }
86   template<class _write> void set_ifc_callback(_write wr) { m_write_ifc.set_callback(wr); }
87   template<class _write> void set_srq_callback(_write wr) { m_write_srq.set_callback(wr); }
88   template<class _write> void set_atn_callback(_write wr) { m_write_atn.set_callback(wr); }
89   template<class _write> void set_ren_callback(_write wr) { m_write_ren.set_callback(wr); }
90
7891   void add_device(device_t *target, int address);
7992
8093   // reads for both host and peripherals
r20984r20985
128141
129142   // device-level overrides
130143   virtual void device_start();
131   virtual void device_config_complete();
132144   virtual void device_stop();
133145
134146   class daisy_entry
r20984r20985
148160   simple_list<daisy_entry> m_device_list;
149161
150162private:
151   devcb_resolved_write_line   m_out_eoi_func;
152   devcb_resolved_write_line   m_out_dav_func;
153   devcb_resolved_write_line   m_out_nrfd_func;
154   devcb_resolved_write_line   m_out_ndac_func;
155   devcb_resolved_write_line   m_out_ifc_func;
156   devcb_resolved_write_line   m_out_srq_func;
157   devcb_resolved_write_line   m_out_atn_func;
158   devcb_resolved_write_line   m_out_ren_func;
163   devcb2_write_line   m_write_eoi;
164   devcb2_write_line   m_write_dav;
165   devcb2_write_line   m_write_nrfd;
166   devcb2_write_line   m_write_ndac;
167   devcb2_write_line   m_write_ifc;
168   devcb2_write_line   m_write_srq;
169   devcb2_write_line   m_write_atn;
170   devcb2_write_line   m_write_ren;
159171
160172   inline void set_signal(device_t *device, int signal, int state);
161173   inline int get_signal(int signal);
trunk/src/mess/machine/interpod.c
r20984r20985
8585//**************************************************************************
8686
8787//-------------------------------------------------
88//  IEEE488_INTERFACE( ieee488_intf )
89//-------------------------------------------------
90
91static IEEE488_INTERFACE( ieee488_intf )
92{
93   DEVCB_NULL,
94   DEVCB_NULL,
95   DEVCB_NULL,
96   DEVCB_NULL,
97   DEVCB_NULL,
98   DEVCB_NULL,
99   DEVCB_NULL,
100   DEVCB_NULL
101};
102
103
104//-------------------------------------------------
10588//  ROM( interpod )
10689//-------------------------------------------------
10790
r20984r20985
203186   MCFG_RIOT6532_ADD(R6532_TAG, 1000000, riot_intf)
204187   MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
205188
206   MCFG_CBM_IEEE488_ADD(ieee488_intf, NULL)
189   MCFG_CBM_IEEE488_ADD(NULL)
207190MACHINE_CONFIG_END
208191
209192
trunk/src/mess/machine/vic1112.c
r20984r20985
2828
2929
3030//-------------------------------------------------
31//  IEEE488_INTERFACE( ieee488_intf )
32//-------------------------------------------------
33
34static IEEE488_INTERFACE( ieee488_intf )
35{
36   DEVCB_NULL,
37   DEVCB_NULL,
38   DEVCB_NULL,
39   DEVCB_NULL,
40   DEVCB_NULL,
41   DEVCB_DEVICE_LINE_MEMBER(M6522_1_TAG, via6522_device, write_cb1),
42   DEVCB_NULL,
43   DEVCB_NULL
44};
45
46
47//-------------------------------------------------
4831//  via6522_interface via0_intf
4932//-------------------------------------------------
5033
r20984r20985
164147   MCFG_VIA6522_ADD(M6522_0_TAG, 0, via0_intf)
165148   MCFG_VIA6522_ADD(M6522_1_TAG, 0, via1_intf)
166149
167   MCFG_CBM_IEEE488_ADD(ieee488_intf, NULL)
150   MCFG_CBM_IEEE488_ADD(NULL)
151   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb1))
168152MACHINE_CONFIG_END
169153
170154
trunk/src/mess/machine/cbmiec.c
r20984r20985
286286
287287
288288//**************************************************************************
289//  DEVICE CONFIGURATION
290//**************************************************************************
291
292//-------------------------------------------------
293//  device_config_complete - perform any
294//  operations now that the configuration is
295//  complete
296//-------------------------------------------------
297
298void cbm_iec_device::device_config_complete()
299{
300   // inherit a copy of the static data
301   const cbm_iec_interface *intf = reinterpret_cast<const cbm_iec_interface *>(static_config());
302   if (intf != NULL)
303      *static_cast<cbm_iec_interface *>(this) = *intf;
304
305   // or initialize to defaults if none provided
306   else
307   {
308      memset(&m_out_srq_cb, 0, sizeof(m_out_srq_cb));
309      memset(&m_out_atn_cb, 0, sizeof(m_out_atn_cb));
310      memset(&m_out_clk_cb, 0, sizeof(m_out_clk_cb));
311      memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
312      memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
313   }
314}
315
316
317
318//**************************************************************************
319289//  INLINE HELPERS
320290//**************************************************************************
321291
r20984r20985
360330   {
361331      switch (signal)
362332      {
363      case SRQ:   m_out_srq_func(state);  break;
364      case ATN:   m_out_atn_func(state);  break;
365      case CLK:   m_out_clk_func(state);  break;
366      case DATA:  m_out_data_func(state); break;
367      case RESET: m_out_reset_func(state);break;
333      case SRQ:   m_write_srq(state);  break;
334      case ATN:   m_write_atn(state);  break;
335      case CLK:   m_write_clk(state);  break;
336      case DATA:  m_write_data(state); break;
337      case RESET: m_write_reset(state);break;
368338      }
369339
370340      daisy_entry *entry = m_device_list.first();
r20984r20985
441411//-------------------------------------------------
442412
443413cbm_iec_device::cbm_iec_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
444   : device_t(mconfig, CBM_IEC, "CBM IEC bus", tag, owner, clock)
414   : device_t(mconfig, CBM_IEC, "CBM IEC bus", tag, owner, clock),
415      m_write_srq(*this),
416      m_write_atn(*this),
417      m_write_clk(*this),
418      m_write_data(*this),
419      m_write_reset(*this)
445420{
446421   for (int i = 0; i < SIGNAL_COUNT; i++)
447422   {
r20984r20985
457432void cbm_iec_device::device_start()
458433{
459434   // resolve callbacks
460   m_out_srq_func.resolve(m_out_srq_cb, *this);
461   m_out_atn_func.resolve(m_out_atn_cb, *this);
462   m_out_clk_func.resolve(m_out_clk_cb, *this);
463   m_out_data_func.resolve(m_out_data_cb, *this);
464   m_out_reset_func.resolve(m_out_reset_cb, *this);
435   m_write_srq.resolve_safe();
436   m_write_atn.resolve_safe();
437   m_write_clk.resolve_safe();
438   m_write_data.resolve_safe();
439   m_write_reset.resolve_safe();
465440}
466441
467442
trunk/src/mess/machine/cbmiec.h
r20984r20985
2828//  INTERFACE CONFIGURATION MACROS
2929//**************************************************************************
3030
31#define MCFG_CBM_IEC_BUS_ADD(_config) \
32   MCFG_DEVICE_ADD(CBM_IEC_TAG, CBM_IEC, 0) \
33   MCFG_DEVICE_CONFIG(_config)
31#define MCFG_CBM_IEC_BUS_ADD() \
32   MCFG_DEVICE_ADD(CBM_IEC_TAG, CBM_IEC, 0)
3433
3534
36#define CBM_IEC_INTERFACE(_name) \
37   const cbm_iec_interface (_name) =
35#define MCFG_CBM_IEC_BUS_SRQ_CALLBACK(_write) \
36   downcast<cbm_iec_device *>(device)->set_srq_callback(DEVCB2_##_write);
3837
38#define MCFG_CBM_IEC_BUS_ATN_CALLBACK(_write) \
39   downcast<cbm_iec_device *>(device)->set_atn_callback(DEVCB2_##_write);
3940
41#define MCFG_CBM_IEC_BUS_CLK_CALLBACK(_write) \
42   downcast<cbm_iec_device *>(device)->set_clk_callback(DEVCB2_##_write);
43
44#define MCFG_CBM_IEC_BUS_DATA_CALLBACK(_write) \
45   downcast<cbm_iec_device *>(device)->set_data_callback(DEVCB2_##_write);
46
47#define MCFG_CBM_IEC_BUS_RESET_CALLBACK(_write) \
48   downcast<cbm_iec_device *>(device)->set_reset_callback(DEVCB2_##_write);
49
50
4051#define MCFG_CBM_IEC_SLOT_ADD(_tag, _num, _slot_intf, _def_slot, _def_inp) \
4152   MCFG_DEVICE_ADD(_tag, CBM_IEC_SLOT, 0) \
4253   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) \
r20984r20985
4859//  TYPE DEFINITIONS
4960//**************************************************************************
5061
51// ======================> cbm_iec_interface
52
53struct cbm_iec_interface
54{
55   devcb_write_line    m_out_srq_cb;
56   devcb_write_line    m_out_atn_cb;
57   devcb_write_line    m_out_clk_cb;
58   devcb_write_line    m_out_data_cb;
59   devcb_write_line    m_out_reset_cb;
60};
61
62
6362// ======================> cbm_iec_device
6463
6564class device_cbm_iec_interface;
6665
67class cbm_iec_device : public device_t,
68                  public cbm_iec_interface
66class cbm_iec_device : public device_t
6967{
7068public:
7169   // construction/destruction
7270   cbm_iec_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
7371
72   template<class _write> void set_srq_callback(_write wr) { m_write_srq.set_callback(wr); }
73   template<class _write> void set_atn_callback(_write wr) { m_write_atn.set_callback(wr); }
74   template<class _write> void set_clk_callback(_write wr) { m_write_clk.set_callback(wr); }
75   template<class _write> void set_data_callback(_write wr) { m_write_data.set_callback(wr); }
76   template<class _write> void set_reset_callback(_write wr) { m_write_reset.set_callback(wr); }
77
7478   void add_device(device_t *target, int address);
7579
7680   // reads for both host and peripherals
r20984r20985
108112   // device-level overrides
109113   virtual void device_start();
110114   virtual void device_reset();
111   virtual void device_config_complete();
112115   virtual void device_stop();
113116
114117   class daisy_entry
r20984r20985
127130   simple_list<daisy_entry> m_device_list;
128131
129132private:
130   devcb_resolved_write_line   m_out_atn_func;
131   devcb_resolved_write_line   m_out_clk_func;
132   devcb_resolved_write_line   m_out_data_func;
133   devcb_resolved_write_line   m_out_srq_func;
134   devcb_resolved_write_line   m_out_reset_func;
133   devcb2_write_line   m_write_srq;
134   devcb2_write_line   m_write_atn;
135   devcb2_write_line   m_write_clk;
136   devcb2_write_line   m_write_data;
137   devcb2_write_line   m_write_reset;
135138
136139   inline void set_signal(device_t *device, int signal, int state);
137140   inline int get_signal(int signal);
r20984r20985
177180   device_cbm_iec_interface *m_next;
178181
179182   // optional operation overrides
183   virtual void cbm_iec_srq(int state) { };
180184   virtual void cbm_iec_atn(int state) { };
181185   virtual void cbm_iec_clk(int state) { };
182186   virtual void cbm_iec_data(int state) { };
183   virtual void cbm_iec_srq(int state) { };
184187   virtual void cbm_iec_reset(int state) { };
185188
186189   cbm_iec_device  *m_bus;
trunk/src/mess/machine/c64_ieee488.c
r20984r20985
151151
152152
153153//-------------------------------------------------
154//  IEEE488_INTERFACE( ieee488_intf )
155//-------------------------------------------------
156
157static IEEE488_INTERFACE( ieee488_intf )
158{
159   DEVCB_NULL,
160   DEVCB_NULL,
161   DEVCB_NULL,
162   DEVCB_NULL,
163   DEVCB_NULL,
164   DEVCB_NULL,
165   DEVCB_NULL,
166   DEVCB_NULL
167};
168
169
170//-------------------------------------------------
171154//  C64_EXPANSION_INTERFACE( expansion_intf )
172155//-------------------------------------------------
173156
r20984r20985
218201
219202static MACHINE_CONFIG_FRAGMENT( c64_ieee488 )
220203   MCFG_TPI6525_ADD(MOS6525_TAG, tpi_intf)
221   MCFG_CBM_IEEE488_ADD(ieee488_intf, NULL)
204   MCFG_CBM_IEEE488_ADD(NULL)
222205   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, expansion_intf, c64_expansion_cards, NULL, NULL)
223206MACHINE_CONFIG_END
224207
trunk/src/mess/machine/isa_ssi2001.c
r20984r20985
44
55const device_type ISA8_SSI2001 = &device_creator<ssi2001_device>;
66
7static const sid6581_interface ssi_sid6581_interface =
8{
9   DEVCB_NULL,
10   DEVCB_NULL
11};
12
137static MACHINE_CONFIG_FRAGMENT( ssi2001 )
148   MCFG_SPEAKER_STANDARD_MONO("mono")
15   MCFG_SOUND_ADD("sid6581", SID6581, XTAL_14_31818MHz/16)
16   MCFG_SOUND_CONFIG(ssi_sid6581_interface)
9   MCFG_SOUND_ADD("sid6581", MOS6581, XTAL_14_31818MHz/16)
1710   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
1811   MCFG_PC_JOY_ADD("joy")
1912MACHINE_CONFIG_END
r20984r20985
4033{
4134   set_isa_device();
4235   m_isa->install_device(0x0200, 0x0207, 0, 0, read8_delegate(FUNC(pc_joy_device::joy_port_r), subdevice<pc_joy_device>("joy")), write8_delegate(FUNC(pc_joy_device::joy_port_w), subdevice<pc_joy_device>("joy")));
43   m_isa->install_device(0x0280, 0x029F, 0, 0, read8_delegate(FUNC(sid6581_device::read), subdevice<sid6581_device>("sid6581")), write8_delegate(FUNC(sid6581_device::write), subdevice<sid6581_device>("sid6581")));
36   m_isa->install_device(0x0280, 0x029F, 0, 0, read8_delegate(FUNC(mos6581_device::read), subdevice<mos6581_device>("sid6581")), write8_delegate(FUNC(mos6581_device::write), subdevice<mos6581_device>("sid6581")));
4437}
4538
4639
trunk/src/mess/machine/isa_ssi2001.h
r20984r20985
33
44#include "emu.h"
55#include "machine/isa.h"
6#include "sound/sid6581.h"
6#include "sound/mos6581.h"
77#include "machine/pc_joy.h"
88
99//*********************************************************************
r20984r20985
2323   virtual machine_config_constructor device_mconfig_additions() const;
2424
2525   required_device<pc_joy_device> m_joy;
26   required_device<sid6581_device> m_sid;
26   required_device<mos6581_device> m_sid;
2727
2828protected:
2929   // device-level overrides
trunk/src/mess/machine/cbmipt.h
r20984r20985
104104#include "machine/vic20_megacart.h"
105105
106106
107#define MCFG_CBM_IEC_ADD(_intf, _default_drive) \
108   MCFG_CBM_IEC_BUS_ADD(_intf) \
107#define MCFG_CBM_IEC_ADD(_default_drive) \
109108   MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, NULL, NULL) \
110109   MCFG_CBM_IEC_SLOT_ADD("iec8", 8, cbm_iec_devices, _default_drive, NULL) \
111110   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL) \
112111   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL) \
113   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
112   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL) \
113   MCFG_CBM_IEC_BUS_ADD()
114114
115115
116#define MCFG_CBM_IEEE488_ADD(_intf, _default_drive) \
117   MCFG_IEEE488_BUS_ADD(_intf) \
116#define MCFG_CBM_IEEE488_ADD(_default_drive) \
118117   MCFG_IEEE488_SLOT_ADD("ieee8", 8, cbm_ieee488_devices, _default_drive, NULL) \
119118   MCFG_IEEE488_SLOT_ADD("ieee9", 9, cbm_ieee488_devices, NULL, NULL) \
120119   MCFG_IEEE488_SLOT_ADD("ieee10", 10, cbm_ieee488_devices, NULL, NULL) \
121   MCFG_IEEE488_SLOT_ADD("ieee11", 11, cbm_ieee488_devices, NULL, NULL)
120   MCFG_IEEE488_SLOT_ADD("ieee11", 11, cbm_ieee488_devices, NULL, NULL) \
121   MCFG_IEEE488_BUS_ADD()
122122
123123
124124/* Commodore 64 */
trunk/src/mess/machine/plus4_sid.c
r20984r20985
5959
6060
6161//-------------------------------------------------
62//  sid6581_interface sid_intf
63//-------------------------------------------------
64
65static MOS6581_INTERFACE( sid_intf )
66{
67   DEVCB_NULL,
68   DEVCB_NULL
69};
70
71
72//-------------------------------------------------
7362//  MACHINE_CONFIG_FRAGMENT( plus4_sid )
7463//-------------------------------------------------
7564
7665static MACHINE_CONFIG_FRAGMENT( plus4_sid )
7766   MCFG_SPEAKER_STANDARD_MONO("mono")
78   MCFG_SOUND_ADD(MOS8580_TAG, SID8580, XTAL_17_73447MHz/20)
79   MCFG_SOUND_CONFIG(sid_intf)
67   MCFG_SOUND_ADD(MOS8580_TAG, MOS8580, XTAL_17_73447MHz/20)
8068   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
8169   MCFG_SOUND_ADD("dac", DAC, 0)
8270   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
trunk/src/mess/machine/plus4_sid.h
r20984r20985
1616#include "emu.h"
1717#include "machine/plus4exp.h"
1818#include "sound/dac.h"
19#include "sound/sid6581.h"
19#include "sound/mos6581.h"
2020#include "machine/cbmipt.h"
2121#include "machine/vcsctrl.h"
2222
r20984r20985
5151   virtual void plus4_breset_w(int state);
5252
5353private:
54   required_device<sid6581_device> m_sid;
54   required_device<mos6581_device> m_sid;
5555   required_device<vcs_control_port_device> m_joy;
5656};
5757
trunk/src/mess/machine/c65.c
r20984r20985
1111#include "includes/c65.h"
1212#include "includes/c64_legacy.h"
1313#include "cpu/m6502/m4510.h"
14#include "sound/sid6581.h"
14#include "sound/mos6581.h"
1515#include "machine/6526cia.h"
1616#include "machine/cbmiec.h"
1717#include "machine/ram.h"
r20984r20985
645645
646646static WRITE8_HANDLER( c65_write_io )
647647{
648   sid6581_device *sid_0 = space.machine().device<sid6581_device>("sid_r");
649   sid6581_device *sid_1 = space.machine().device<sid6581_device>("sid_l");
648   mos6581_device *sid_0 = space.machine().device<mos6581_device>("sid_r");
649   mos6581_device *sid_1 = space.machine().device<mos6581_device>("sid_l");
650650   device_t *vic3 = space.machine().device("vic3");
651651
652652   switch (offset & 0xf00)
r20984r20985
709709
710710static READ8_HANDLER( c65_read_io )
711711{
712   sid6581_device *sid_0 = space.machine().device<sid6581_device>("sid_r");
713   sid6581_device *sid_1 = space.machine().device<sid6581_device>("sid_l");
712   mos6581_device *sid_0 = space.machine().device<mos6581_device>("sid_r");
713   mos6581_device *sid_1 = space.machine().device<mos6581_device>("sid_l");
714714   device_t *vic3 = space.machine().device("vic3");
715715
716716   switch (offset & 0xf00)
trunk/src/mess/machine/c1571.c
r20984r20985
6767//  complete
6868//-------------------------------------------------
6969
70void base_c1571_device::device_config_complete()
70void c1571_device::device_config_complete()
7171{
7272   switch (m_variant)
7373   {
r20984r20985
148148//  rom_region - device-specific ROM region
149149//-------------------------------------------------
150150
151const rom_entry *base_c1571_device::device_rom_region() const
151const rom_entry *c1571_device::device_rom_region() const
152152{
153153   switch (m_variant)
154154   {
r20984r20985
172172//  ADDRESS_MAP( c1571_mem )
173173//-------------------------------------------------
174174
175static ADDRESS_MAP_START( c1571_mem, AS_PROGRAM, 8, base_c1571_device )
175static ADDRESS_MAP_START( c1571_mem, AS_PROGRAM, 8, c1571_device )
176176   AM_RANGE(0x0000, 0x07ff) AM_RAM
177177   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write)
178178   AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_READWRITE(via1_r, via1_w)
r20984r20985
202202//  via6522_interface via0_intf
203203//-------------------------------------------------
204204
205WRITE_LINE_MEMBER( base_c1571_device::via0_irq_w )
205WRITE_LINE_MEMBER( c1571_device::via0_irq_w )
206206{
207207   m_via0_irq = state;
208208
209209   m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_via0_irq || m_via1_irq || m_cia_irq) ? ASSERT_LINE : CLEAR_LINE);
210210}
211211
212READ8_MEMBER( base_c1571_device::via0_pa_r )
212READ8_MEMBER( c1571_device::via0_pa_r )
213213{
214214   /*
215215
r20984r20985
237237   return data;
238238}
239239
240WRITE8_MEMBER( base_c1571_device::via0_pa_w )
240WRITE8_MEMBER( c1571_device::via0_pa_w )
241241{
242242   /*
243243
r20984r20985
319319   }
320320}
321321
322READ8_MEMBER( base_c1571_device::via0_pb_r )
322READ8_MEMBER( c1571_device::via0_pb_r )
323323{
324324   /*
325325
r20984r20985
353353   return data;
354354}
355355
356WRITE8_MEMBER( base_c1571_device::via0_pb_w )
356WRITE8_MEMBER( c1571_device::via0_pb_w )
357357{
358358   /*
359359
r20984r20985
411411   update_iec();
412412}
413413
414READ_LINE_MEMBER( base_c1571_device::atn_in_r )
414READ_LINE_MEMBER( c1571_device::atn_in_r )
415415{
416416   return !m_bus->atn_r();
417417}
418418
419READ_LINE_MEMBER( base_c1571_device::wprt_r )
419READ_LINE_MEMBER( c1571_device::wprt_r )
420420{
421421   return !floppy_wpt_r(m_image);
422422}
423423
424424static const via6522_interface via0_intf =
425425{
426   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pa_r),
427   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pb_r),
428   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, atn_in_r),
426   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pa_r),
427   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pb_r),
428   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, atn_in_r),
429429   DEVCB_NULL,
430   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wprt_r),
430   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wprt_r),
431431   DEVCB_NULL,
432432
433   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pa_w),
434   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pb_w),
433   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pa_w),
434   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pb_w),
435435   DEVCB_NULL,
436436   DEVCB_NULL,
437437   DEVCB_NULL,
438438   DEVCB_NULL,
439439
440   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_irq_w)
440   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_irq_w)
441441};
442442
443443static const via6522_interface c1571cr_via0_intf =
444444{
445   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pa_r),
446   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_pb_r),
447   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, atn_in_r),
445   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pa_r),
446   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_pb_r),
447   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, atn_in_r),
448448   DEVCB_NULL,
449   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wprt_r),
449   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wprt_r),
450450   DEVCB_NULL,
451451
452452   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571cr_device, via0_pa_w),
r20984r20985
456456   DEVCB_NULL,
457457   DEVCB_NULL,
458458
459   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via0_irq_w)
459   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via0_irq_w)
460460};
461461
462462
r20984r20985
464464//  via6522_interface via1_intf
465465//-------------------------------------------------
466466
467READ8_MEMBER( base_c1571_device::via1_r )
467READ8_MEMBER( c1571_device::via1_r )
468468{
469469   UINT8 data = m_via1->read(space, offset);
470470
r20984r20985
474474   return data;
475475}
476476
477WRITE8_MEMBER( base_c1571_device::via1_w )
477WRITE8_MEMBER( c1571_device::via1_w )
478478{
479479   m_via1->write(space, offset, data);
480480
r20984r20985
482482   m_ga->ted_w(1);
483483}
484484
485WRITE_LINE_MEMBER( base_c1571_device::via1_irq_w )
485WRITE_LINE_MEMBER( c1571_device::via1_irq_w )
486486{
487487   m_via1_irq = state;
488488
489489   m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_via0_irq || m_via1_irq || m_cia_irq) ? ASSERT_LINE : CLEAR_LINE);
490490}
491491
492READ8_MEMBER( base_c1571_device::via1_pb_r )
492READ8_MEMBER( c1571_device::via1_pb_r )
493493{
494494   /*
495495
r20984r20985
517517   return data;
518518}
519519
520WRITE8_MEMBER( base_c1571_device::via1_pb_w )
520WRITE8_MEMBER( c1571_device::via1_pb_w )
521521{
522522   /*
523523
r20984r20985
550550static const via6522_interface via1_intf =
551551{
552552   DEVCB_DEVICE_MEMBER(C64H156_TAG, c64h156_device, yb_r),
553   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via1_pb_r),
553   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via1_pb_r),
554554   DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, byte_r),
555555   DEVCB_NULL,
556556   DEVCB_NULL,
557557   DEVCB_NULL,
558558
559559   DEVCB_DEVICE_MEMBER(C64H156_TAG, c64h156_device, yb_w),
560   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via1_pb_w),
560   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via1_pb_w),
561561   DEVCB_NULL,
562562   DEVCB_NULL,
563563   DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, soe_w),
564564   DEVCB_DEVICE_LINE_MEMBER(C64H156_TAG, c64h156_device, oe_w),
565565
566   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, via1_irq_w)
566   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, via1_irq_w)
567567};
568568
569569
r20984r20985
571571//  MOS6526_INTERFACE( cia_intf )
572572//-------------------------------------------------
573573
574WRITE_LINE_MEMBER( base_c1571_device::cia_irq_w )
574WRITE_LINE_MEMBER( c1571_device::cia_irq_w )
575575{
576576   m_cia_irq = state;
577577
578578   m_maincpu->set_input_line(INPUT_LINE_IRQ0, (m_via0_irq || m_via1_irq || m_cia_irq) ? ASSERT_LINE : CLEAR_LINE);
579579}
580580
581WRITE_LINE_MEMBER( base_c1571_device::cia_pc_w )
581WRITE_LINE_MEMBER( c1571_device::cia_pc_w )
582582{
583583   if (m_other != NULL)
584584   {
r20984r20985
586586   }
587587}
588588
589WRITE_LINE_MEMBER( base_c1571_device::cia_cnt_w )
589WRITE_LINE_MEMBER( c1571_device::cia_cnt_w )
590590{
591591   m_cnt_out = state;
592592   update_iec();
593593}
594594
595WRITE_LINE_MEMBER( base_c1571_device::cia_sp_w )
595WRITE_LINE_MEMBER( c1571_device::cia_sp_w )
596596{
597597   m_sp_out = state;
598598   update_iec();
599599}
600600
601READ8_MEMBER( base_c1571_device::cia_pb_r )
601READ8_MEMBER( c1571_device::cia_pb_r )
602602{
603603   return m_parallel_data;
604604}
605605
606WRITE8_MEMBER( base_c1571_device::cia_pb_w )
606WRITE8_MEMBER( c1571_device::cia_pb_w )
607607{
608608   if (m_other != NULL)
609609   {
r20984r20985
611611   }
612612}
613613
614static MOS6526_INTERFACE( cia_intf )
615{
616   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_irq_w),
617   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_pc_w),
618   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_cnt_w),
619   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_sp_w),
620   DEVCB_NULL,
621   DEVCB_NULL,
622   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_pb_r),
623   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_pb_w)
624};
625614
626615//-------------------------------------------------
627616//  MOS6526_INTERFACE( mini_chief_cia_intf )
r20984r20985
657646   */
658647}
659648
660static MOS6526_INTERFACE( mini_chief_cia_intf )
661{
662   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_irq_w),
663   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_pc_w),
664   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_cnt_w),
665   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, cia_sp_w),
666   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, mini_chief_device, cia_pa_r),
667   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, mini_chief_device, cia_pa_w),
668   DEVCB_NULL,
669   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, mini_chief_device, cia_pb_w)
670};
671649
672
673650//-------------------------------------------------
674651//  C64H156_INTERFACE( ga_intf )
675652//-------------------------------------------------
676653
677WRITE_LINE_MEMBER( base_c1571_device::byte_w )
654WRITE_LINE_MEMBER( c1571_device::byte_w )
678655{
679656   m_via1->write_ca1(state);
680657   m_maincpu->set_input_line(M6502_SET_OVERFLOW, state);
r20984r20985
684661{
685662   DEVCB_NULL,
686663   DEVCB_NULL,
687   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, byte_w)
664   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, byte_w)
688665};
689666
690667
r20984r20985
721698//  floppy_interface c1571_floppy_interface
722699//-------------------------------------------------
723700
724WRITE_LINE_MEMBER( base_c1571_device::wpt_w )
701WRITE_LINE_MEMBER( c1571_device::wpt_w )
725702{
726703   m_via0->write_ca2(!state);
727704}
r20984r20985
731708   DEVCB_NULL,
732709   DEVCB_NULL,
733710   DEVCB_NULL,
734   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wpt_w),
711   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wpt_w),
735712   DEVCB_NULL,
736713   FLOPPY_STANDARD_5_25_DSDD,
737714   LEGACY_FLOPPY_OPTIONS_NAME(c1571),
r20984r20985
749726   DEVCB_NULL,
750727   DEVCB_NULL,
751728   DEVCB_NULL,
752   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, base_c1571_device, wpt_w),
729   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1571_device, wpt_w),
753730   DEVCB_NULL,
754731   FLOPPY_STANDARD_5_25_SSDD,
755732   LEGACY_FLOPPY_OPTIONS_NAME(c1541),
r20984r20985
794771
795772   MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, via0_intf)
796773   MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf)
797   MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, cia_intf)
774   MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_irq_w))
775   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_sp_w))
776   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF_OWNER, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_pc_w))
798777   MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2)
799778
800779   MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1570_floppy_interface)
801   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1570_floppies, "525ssdd", 0, base_c1571_device::floppy_formats)
780   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1570_floppies, "525ssdd", 0, c1571_device::floppy_formats)
802781   MCFG_64H156_ADD(C64H156_TAG, XTAL_16MHz, ga_intf)
803782MACHINE_CONFIG_END
804783
r20984r20985
814793
815794   MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, via0_intf)
816795   MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf)
817   MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, cia_intf)
796
797   MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_irq_w))
798   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_sp_w))
799   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c1571_device, cia_pb_r), DEVWRITE8(DEVICE_SELF_OWNER, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_pc_w))
800   
818801   MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2)
819802
820803   MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_interface)
821   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1571_floppies, "525dd", 0, base_c1571_device::floppy_formats)
804   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1571_floppies, "525dd", 0, c1571_device::floppy_formats)
822805   MCFG_64H156_ADD(C64H156_TAG, XTAL_16MHz, ga_intf)
823806MACHINE_CONFIG_END
824807
r20984r20985
834817
835818   MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, c1571cr_via0_intf)
836819   MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf)
837   MCFG_MOS5710_ADD(M5710_TAG, XTAL_16MHz/16, 0, cia_intf)
820
821   //MCFG_MOS5710_ADD(M5710_TAG, XTAL_16MHz/16, 0)
822   
838823   MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2)
839824
840825   MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_interface)
841   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1571_floppies, "525dd", 0, base_c1571_device::floppy_formats)
826   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1571_floppies, "525dd", 0, c1571_device::floppy_formats)
842827   MCFG_64H156_ADD(C64H156_TAG, XTAL_16MHz, ga_intf)
843828MACHINE_CONFIG_END
844829
r20984r20985
854839
855840   MCFG_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/16, via0_intf)
856841   MCFG_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/16, via1_intf)
857   MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, mini_chief_cia_intf)
842
843   MCFG_MOS6526_ADD(M6526_TAG, XTAL_16MHz/16, 0, DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_irq_w))
844   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_cnt_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_sp_w))
845   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, mini_chief_device, cia_pa_r), DEVWRITE8(DEVICE_SELF_OWNER, mini_chief_device, cia_pa_w))
846   MCFG_MOS6526_PORT_B_CALLBACKS(NULL, DEVWRITE8(DEVICE_SELF_OWNER, c1571_device, cia_pb_w), DEVWRITELINE(DEVICE_SELF_OWNER, c1571_device, cia_pc_w))
847   
858848   MCFG_WD1770x_ADD(WD1770_TAG, XTAL_16MHz/2)
859849
860850   MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_interface)
861   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1571_floppies, "525dd", 0, base_c1571_device::floppy_formats)
851   //MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", c1571_floppies, "525dd", 0, c1571_device::floppy_formats)
862852   MCFG_64H156_ADD(C64H156_TAG, XTAL_16MHz, ga_intf)
863853
864854   MCFG_ISA8_BUS_ADD(ISA_BUS_TAG, M6502_TAG, isabus_intf)
r20984r20985
871861//  machine configurations
872862//-------------------------------------------------
873863
874machine_config_constructor base_c1571_device::device_mconfig_additions() const
864machine_config_constructor c1571_device::device_mconfig_additions() const
875865{
876866   switch (m_variant)
877867   {
r20984r20985
897887//**************************************************************************
898888
899889//-------------------------------------------------
900//  base_c1571_device - constructor
890//  c1571_device - constructor
901891//-------------------------------------------------
902892
903base_c1571_device::base_c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
893c1571_device::c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
904894   : device_t(mconfig, type, name, tag, owner, clock),
905895      device_cbm_iec_interface(mconfig, *this),
906896      device_c64_floppy_parallel_interface(mconfig, *this),
r20984r20985
923913{
924914}
925915
916c1571_device::c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
917   : device_t(mconfig, C1571, "C1571", tag, owner, clock),
918      device_cbm_iec_interface(mconfig, *this),
919      device_c64_floppy_parallel_interface(mconfig, *this),
920      m_maincpu(*this, M6502_TAG),
921      m_via0(*this, M6522_0_TAG),
922      m_via1(*this, M6522_1_TAG),
923      m_cia(*this, M6526_TAG),
924      m_fdc(*this, WD1770_TAG),
925      m_ga(*this, C64H156_TAG),
926      m_image(*this, FLOPPY_0),
927      m_1_2mhz(0),
928      m_data_out(1),
929      m_ser_dir(0),
930      m_sp_out(1),
931      m_cnt_out(1),
932      m_via0_irq(CLEAR_LINE),
933      m_via1_irq(CLEAR_LINE),
934      m_cia_irq(CLEAR_LINE),
935      m_variant(TYPE_1571)
936      //m_floppy(*this, WD1770_TAG":0:525dd")
937{
938}
926939
940
927941//-------------------------------------------------
928942//  c1570_device - constructor
929943//-------------------------------------------------
930944
931945c1570_device::c1570_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
932   : base_c1571_device(mconfig, C1570, "C1570", tag, owner, clock, TYPE_1570)
946   : c1571_device(mconfig, C1570, "C1570", tag, owner, clock, TYPE_1570)
933947      //m_floppy(*this, WD1770_TAG":0:525ssdd")
934948{
935949}
936950
937951
938952//-------------------------------------------------
939//  c1571_device - constructor
940//-------------------------------------------------
941
942c1571_device::c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
943   : base_c1571_device(mconfig, C1571, "C1571", tag, owner, clock, TYPE_1571)
944      //m_floppy(*this, WD1770_TAG":0:525dd")
945{
946}
947
948
949//-------------------------------------------------
950953//  c1571cr_device - constructor
951954//-------------------------------------------------
952955
953956c1571cr_device::c1571cr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
954   : base_c1571_device(mconfig, C1571CR, "C1571CR", tag, owner, clock, TYPE_1571CR)
957   : c1571_device(mconfig, C1571CR, "C1571CR", tag, owner, clock, TYPE_1571CR)
955958      //m_floppy(*this, WD1770_TAG":0:525dd")
956959{
957960}
r20984r20985
962965//-------------------------------------------------
963966
964967mini_chief_device::mini_chief_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
965   : base_c1571_device(mconfig, MINI_CHIEF, "ICT Mini Chief", tag, owner, clock, TYPE_MINI_CHIEF)
968   : c1571_device(mconfig, MINI_CHIEF, "ICT Mini Chief", tag, owner, clock, TYPE_MINI_CHIEF)
966969      //m_floppy(*this, WD1770_TAG":0:525dd")
967970{
968971}
r20984r20985
972975//  device_start - device-specific startup
973976//-------------------------------------------------
974977
975void base_c1571_device::device_start()
978void c1571_device::device_start()
976979{
977980   // install image callbacks
978981   m_ga->set_floppy(m_image);
r20984r20985
994997//  device_reset - device-specific reset
995998//-------------------------------------------------
996999
997void base_c1571_device::device_reset()
1000void c1571_device::device_reset()
9981001{
9991002   m_maincpu->reset();
10001003
r20984r20985
10161019//  cbm_iec_srq -
10171020//-------------------------------------------------
10181021
1019void base_c1571_device::cbm_iec_srq(int state)
1022void c1571_device::cbm_iec_srq(int state)
10201023{
10211024   update_iec();
10221025}
r20984r20985
10261029//  cbm_iec_atn -
10271030//-------------------------------------------------
10281031
1029void base_c1571_device::cbm_iec_atn(int state)
1032void c1571_device::cbm_iec_atn(int state)
10301033{
10311034   update_iec();
10321035}
r20984r20985
10361039//  cbm_iec_data -
10371040//-------------------------------------------------
10381041
1039void base_c1571_device::cbm_iec_data(int state)
1042void c1571_device::cbm_iec_data(int state)
10401043{
10411044   update_iec();
10421045}
r20984r20985
10461049//  cbm_iec_reset -
10471050//-------------------------------------------------
10481051
1049void base_c1571_device::cbm_iec_reset(int state)
1052void c1571_device::cbm_iec_reset(int state)
10501053{
10511054   if (!state)
10521055   {
r20984r20985
10591062//  parallel_data_w -
10601063//-------------------------------------------------
10611064
1062void base_c1571_device::parallel_data_w(UINT8 data)
1065void c1571_device::parallel_data_w(UINT8 data)
10631066{
10641067   m_parallel_data = data;
10651068}
r20984r20985
10691072//  parallel_strobe_w -
10701073//-------------------------------------------------
10711074
1072void base_c1571_device::parallel_strobe_w(int state)
1075void c1571_device::parallel_strobe_w(int state)
10731076{
10741077   m_cia->flag_w(state);
10751078}
r20984r20985
10791082//  update_iec -
10801083//-------------------------------------------------
10811084
1082void base_c1571_device::update_iec()
1085void c1571_device::update_iec()
10831086{
10841087   m_cia->cnt_w(m_ser_dir || m_bus->srq_r());
10851088   m_cia->sp_w(m_ser_dir || m_bus->data_r());
trunk/src/mess/machine/c1571.h
r20984r20985
4141
4242// ======================> c1571_device
4343
44class base_c1571_device :  public device_t,
45                     public device_cbm_iec_interface,
46                     public device_c64_floppy_parallel_interface
44class c1571_device :  public device_t,
45                  public device_cbm_iec_interface,
46                  public device_c64_floppy_parallel_interface
4747{
4848public:
4949   enum
r20984r20985
5555   };
5656
5757   // construction/destruction
58   base_c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
58   c1571_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
59   c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5960
6061   // optional information overrides
6162   virtual const rom_entry *device_rom_region() const;
r20984r20985
133134
134135// ======================> c1570_device
135136
136class c1570_device :  public base_c1571_device
137class c1570_device :  public c1571_device
137138{
138139public:
139140   // construction/destruction
r20984r20985
141142};
142143
143144
144// ======================> c1571_device
145
146class c1571_device :  public base_c1571_device
147{
148public:
149   // construction/destruction
150   c1571_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
151};
152
153
154145// ======================> c1571cr_device
155146
156class c1571cr_device :  public base_c1571_device
147class c1571cr_device :  public c1571_device
157148{
158149public:
159150   // construction/destruction
r20984r20985
166157
167158// ======================> mini_chief_device
168159
169class mini_chief_device :  public base_c1571_device
160class mini_chief_device :  public c1571_device
170161{
171162public:
172163   // construction/destruction
trunk/src/mess/includes/cbm2.h
r20984r20985
2424#include "machine/serial.h"
2525#include "machine/vcsctrl.h"
2626#include "sound/dac.h"
27#include "sound/sid6581.h"
27#include "sound/mos6581.h"
2828#include "video/mc6845.h"
2929#include "video/mos6566.h"
3030
r20984r20985
3434#define MOS6567_TAG     "u23"
3535#define MOS6569_TAG     "u23"
3636#define MC68B45_TAG     "u10"
37#define MOS6851_TAG     "u4"
37#define MOS6581_TAG     "u4"
3838#define MOS6525_1_TAG   "u20"
3939#define MOS6525_2_TAG   "u102"
4040#define MOS6551A_TAG    "u19"
r20984r20985
6060         m_maincpu(*this, M6509_TAG),
6161         m_pla1(*this, PLA1_TAG),
6262         m_crtc(*this, MC68B45_TAG),
63         m_sid(*this, MOS6851_TAG),
63         m_sid(*this, MOS6581_TAG),
6464         m_tpi1(*this, MOS6525_1_TAG),
6565         m_tpi2(*this, MOS6525_2_TAG),
6666         m_acia(*this, MOS6551A_TAG),
r20984r20985
115115   required_device<cpu_device> m_maincpu;
116116   required_device<pls100_device> m_pla1;
117117   optional_device<mc6845_device> m_crtc;
118   required_device<sid6581_device> m_sid;
118   required_device<mos6581_device> m_sid;
119119   required_device<tpi6525_device> m_tpi1;
120120   required_device<tpi6525_device> m_tpi2;
121121   required_device<mos6551_device> m_acia;
trunk/src/mess/includes/vic20.h
r20984r20985
113113
114114   // keyboard state
115115   int m_key_col;
116   INTERRUPT_GEN_MEMBER(vic20_raster_interrupt);
117116};
118117
119118#endif
trunk/src/mess/includes/c64.h
r20984r20985
1616#include "machine/ram.h"
1717#include "machine/vcsctrl.h"
1818#include "sound/dac.h"
19#include "sound/sid6581.h"
19#include "sound/mos6581.h"
2020#include "video/mos6566.h"
2121
2222#define M6510_TAG       "u7"
r20984r20985
7777   required_device<m6510_device> m_maincpu;
7878   required_device<pls100_device> m_pla;
7979   required_device<mos6566_device> m_vic;
80   required_device<sid6581_device> m_sid;
80   required_device<mos6581_device> m_sid;
8181   required_device<mos6526_device> m_cia1;
8282   required_device<mos6526_device> m_cia2;
8383   optional_device<cbm_iec_device> m_iec;
trunk/src/mess/includes/plus4.h
r20984r20985
44#define __PLUS4__
55
66#include "emu.h"
7#include "audio/mos7360.h"
87#include "cpu/m6502/m7501.h"
98#include "formats/cbm_snqk.h"
109#include "machine/cbmiec.h"
r20984r20985
1716#include "machine/plus4exp.h"
1817#include "machine/plus4user.h"
1918#include "machine/ram.h"
19#include "sound/mos7360.h"
2020#include "sound/t6721a.h"
2121
2222#define MOS7501_TAG         "u2"
r20984r20985
9999   virtual void machine_reset();
100100
101101   void check_interrupts();
102   void bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal, int *cs0, int *cs1);
103   UINT8 read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal, int cs0, int cs1);
102   void bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal);
103   UINT8 read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal);
104104   UINT8 read_keyboard(UINT8 databus);
105105
106106   DECLARE_READ8_MEMBER( read );
r20984r20985
149149
150150   // keyboard state
151151   UINT8 m_kb;
152
153   INTERRUPT_GEN_MEMBER(c16_raster_interrupt);
154   INTERRUPT_GEN_MEMBER(c16_frame_interrupt);
155152};
156153
157154
trunk/src/mess/includes/c128.h
r20984r20985
1818#include "machine/ram.h"
1919#include "machine/vcsctrl.h"
2020#include "sound/dac.h"
21#include "sound/sid6581.h"
21#include "sound/mos6581.h"
2222#include "video/mos6566.h"
2323
2424#define Z80A_TAG        "u10"
r20984r20985
105105   required_device<mos8721_device> m_pla;
106106   required_device<mos8563_device> m_vdc;
107107   required_device<mos6566_device> m_vic;
108   required_device<sid6581_device> m_sid;
108   required_device<mos6581_device> m_sid;
109109   required_device<mos6526_device> m_cia1;
110110   required_device<mos6526_device> m_cia2;
111111   required_device<cbm_iec_device> m_iec;
trunk/src/mess/includes/vic10.h
r20984r20985
1111#include "machine/ram.h"
1212#include "machine/vcsctrl.h"
1313#include "sound/dac.h"
14#include "sound/sid6581.h"
14#include "sound/mos6581.h"
1515#include "video/mos6566.h"
1616
1717#define M6510_TAG       "u3"
r20984r20985
5555
5656   required_device<m6510_device> m_maincpu;
5757   required_device<mos6566_device> m_vic;
58   required_device<sid6581_device> m_sid;
58   required_device<mos6581_device> m_sid;
5959   required_device<mos6526_device> m_cia;
6060   required_device<vcs_control_port_device> m_joy1;
6161   required_device<vcs_control_port_device> m_joy2;
trunk/src/mess/video/mos6566.c
r20984r20985
267267      {
268268         DBG_LOG(2, "vic2", ("irq start %.2x\n", mask));
269269         m_reg[0x19] |= 0x80;
270         m_out_irq_func(ASSERT_LINE);
270         m_write_irq(ASSERT_LINE);
271271      }
272272   }
273273   m_reg[0x19] |= mask;
r20984r20985
280280   {
281281      DBG_LOG(2, "vic2", ("irq end %.2x\n", mask));
282282      m_reg[0x19] &= ~0x80;
283      m_out_irq_func(CLEAR_LINE);
283      m_write_irq(CLEAR_LINE);
284284   }
285285}
286286
r20984r20985
586586      m_icount(0),
587587      m_variant(TYPE_6566),
588588      m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(mos6566_videoram_map)),
589      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6566_colorram_map))
589      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6566_colorram_map)),
590      m_write_irq(*this),
591      m_write_ba(*this),
592      m_write_aec(*this),
593      m_write_k(*this)
590594{
591595}
592596
593mos6566_device::mos6566_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
597mos6566_device::mos6566_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
594598   : device_t(mconfig, type, name, tag, owner, clock),
595599      device_memory_interface(mconfig, *this),
596600      device_execute_interface(mconfig, *this),
597601      m_icount(0),
602      m_variant(variant),
598603      m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(mos6566_videoram_map)),
599604      m_colorram_space_config("colorram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(mos6566_colorram_map)),
605      m_write_irq(*this),
606      m_write_ba(*this),
607      m_write_aec(*this),
608      m_write_k(*this),
600609      m_phi0(1),
601610      m_ba(ASSERT_LINE),
602611      m_aec(ASSERT_LINE)
r20984r20985
604613}
605614
606615mos6567_device::mos6567_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
607   :mos6566_device(mconfig, MOS6567, "MOS6567", tag, owner, clock) { m_variant = TYPE_6567; }
616   :mos6566_device(mconfig, MOS6567, "MOS6567", tag, owner, clock, TYPE_6567) { }
608617
609mos6567_device::mos6567_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
610   :mos6566_device(mconfig, type, name, tag, owner, clock) { }
618mos6567_device::mos6567_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
619   :mos6566_device(mconfig, type, name, tag, owner, clock, TYPE_6567) { }
611620
612621mos8562_device::mos8562_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
613   :mos6567_device(mconfig, MOS8562, "MOS8562", tag, owner, clock) { m_variant = TYPE_8562; }
622   :mos6567_device(mconfig, MOS8562, "MOS8562", tag, owner, clock, TYPE_8562) { }
614623
615624mos8564_device::mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
616   :mos6567_device(mconfig, MOS8564, "MOS8564", tag, owner, clock) { m_variant = TYPE_8564; }
625   :mos6567_device(mconfig, MOS8564, "MOS8564", tag, owner, clock, TYPE_8564) { }
617626
618627mos6569_device::mos6569_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
619   :mos6566_device(mconfig, MOS6566, "MOS6569", tag, owner, clock) { m_variant = TYPE_6569; }
628   :mos6566_device(mconfig, MOS6566, "MOS6569", tag, owner, clock, TYPE_6569) { }
620629
621mos6569_device::mos6569_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
622   :mos6566_device(mconfig, type, name, tag, owner, clock) { }
630mos6569_device::mos6569_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant)
631   :mos6566_device(mconfig, type, name, tag, owner, clock, TYPE_6569) { }
623632
624633mos8565_device::mos8565_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
625   :mos6569_device(mconfig, MOS8565, "MOS8565", tag, owner, clock) { m_variant = TYPE_8565; }
634   :mos6569_device(mconfig, MOS8565, "MOS8565", tag, owner, clock, TYPE_8565) { }
626635
627636mos8566_device::mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
628   :mos6569_device(mconfig, MOS8566, "MOS8566", tag, owner, clock) { m_variant = TYPE_8566; }
637   :mos6569_device(mconfig, MOS8566, "MOS8566", tag, owner, clock, TYPE_8566) { }
629638
630639
631640//-------------------------------------------------
632//  device_config_complete - perform any
633//  operations now that the configuration is
634//  complete
635//-------------------------------------------------
636
637void mos6566_device::device_config_complete()
638{
639   // inherit a copy of the static data
640   const mos6566_interface *intf = reinterpret_cast<const mos6566_interface *>(static_config());
641   if (intf != NULL)
642      *static_cast<mos6566_interface *>(this) = *intf;
643
644   // or initialize to defaults if none provided
645   else
646   {
647      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
648      memset(&m_out_ba_cb, 0, sizeof(m_out_ba_cb));
649      memset(&m_out_aec_cb, 0, sizeof(m_out_aec_cb));
650      memset(&m_out_k_cb, 0, sizeof(m_out_k_cb));
651   }
652}
653
654
655//-------------------------------------------------
656641//  device_start - device-specific startup
657642//-------------------------------------------------
658643
r20984r20985
662647   m_icountptr = &m_icount;
663648
664649   // resolve callbacks
665   m_out_irq_func.resolve(m_out_irq_cb, *this);
666   m_out_ba_func.resolve(m_out_ba_cb, *this);
667   m_out_aec_func.resolve(m_out_aec_cb, *this);
668   m_out_k_func.resolve(m_out_k_cb, *this);
650   m_write_irq.resolve_safe();
651   m_write_ba.resolve_safe();
652   m_write_aec.resolve_safe();
653   m_write_k.resolve_safe();
669654
670   m_cpu = machine().device<cpu_device>(m_cpu_tag);
655   if (m_cpu_tag != NULL)
656      m_cpu = machine().device<cpu_device>(m_cpu_tag);
657   else
658      m_cpu = machine().firstcpu;
671659
672660   m_screen = machine().device<screen_device>(m_screen_tag);
673661   m_screen->register_screen_bitmap(m_bitmap);
r20984r20985
14391427      m_phi0 = 1;
14401428      set_aec(BIT(m_aec_delay, 2));
14411429
1442      m_out_ba_func(m_ba);
1443      m_out_aec_func(m_aec);
1430      m_write_ba(m_ba);
1431      m_write_aec(m_aec);
14441432
14451433      m_raster_x += 8;
14461434      if (m_raster_x == 0x1fc) m_raster_x = 0x004;
r20984r20985
20081996      m_phi0 = 1;
20091997      set_aec(BIT(m_aec_delay, 2));
20101998
2011      m_out_ba_func(m_ba);
2012      m_out_aec_func(m_aec);
1999      m_write_ba(m_ba);
2000      m_write_aec(m_aec);
20132001
20142002      m_raster_x += 8;
20152003      if (m_raster_x == 0x1fc) m_raster_x = 0x004;
r20984r20985
27892777      {
27902778         m_reg[offset] = data | 0xf8;
27912779
2792         m_out_k_func(0, data & 0x07);
2780         m_write_k((offs_t)0, data & 0x07);
27932781      }
27942782      break;
27952783
trunk/src/mess/video/mos6566.h
r20984r20985
9191// DEVICE CONFIGURATION MACROS
9292//***************************************************************************
9393
94#define MCFG_MOS6566_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
94#define MCFG_MOS6566_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _irq) \
9595   MCFG_DEVICE_ADD(_tag, MOS6566, _clock) \
96   MCFG_DEVICE_CONFIG(_config) \
96   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, NULL, DEVCB2_##_irq, DEVCB2_NULL); \
9797   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
9898   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
9999   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
102102   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \
103103   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6566_device, screen_update)
104104
105#define MCFG_MOS6567_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
105#define MCFG_MOS6567_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _irq) \
106106   MCFG_DEVICE_ADD(_tag, MOS6567, _clock) \
107   MCFG_DEVICE_CONFIG(_config) \
107   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, NULL, DEVCB2_##_irq, DEVCB2_NULL); \
108108   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
109109   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
110110   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
113113   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \
114114   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6567_device, screen_update)
115115
116#define MCFG_MOS8562_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
116#define MCFG_MOS8562_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _irq) \
117117   MCFG_DEVICE_ADD(_tag, MOS8562, _clock) \
118   MCFG_DEVICE_CONFIG(_config) \
118   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, NULL, DEVCB2_##_irq, DEVCB2_NULL); \
119119   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
120120   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
121121   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
124124   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \
125125   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8562_device, screen_update)
126126
127#define MCFG_MOS8564_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
127#define MCFG_MOS8564_ADD(_tag, _screen_tag, _cpu_tag, _clock, _videoram_map, _colorram_map, _irq, _k) \
128128   MCFG_DEVICE_ADD(_tag, MOS8564, _clock) \
129   MCFG_DEVICE_CONFIG(_config) \
129   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, _cpu_tag, DEVCB2_##_irq, DEVCB2_##_k); \
130130   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
131131   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
132132   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
135135   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \
136136   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8564_device, screen_update)
137137
138#define MCFG_MOS6569_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
138#define MCFG_MOS6569_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _irq) \
139139   MCFG_DEVICE_ADD(_tag, MOS6569, _clock) \
140   MCFG_DEVICE_CONFIG(_config) \
140   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, NULL, DEVCB2_##_irq, DEVCB2_NULL); \
141141   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
142142   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
143143   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
146146   MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) \
147147   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6569_device, screen_update)
148148
149#define MCFG_MOS8565_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
149#define MCFG_MOS8565_ADD(_tag, _screen_tag, _clock, _videoram_map, _colorram_map, _irq) \
150150   MCFG_DEVICE_ADD(_tag, MOS8565, _clock) \
151   MCFG_DEVICE_CONFIG(_config) \
151   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, NULL, DEVCB2_##_irq, DEVCB2_NULL); \
152152   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
153153   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
154154   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
157157   MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) \
158158   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8565_device, screen_update)
159159
160#define MCFG_MOS8566_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \
160#define MCFG_MOS8566_ADD(_tag, _screen_tag, _cpu_tag, _clock, _videoram_map, _colorram_map, _irq, _k) \
161161   MCFG_DEVICE_ADD(_tag, MOS8566, _clock) \
162   MCFG_DEVICE_CONFIG(_config) \
162   downcast<mos6566_device *>(device)->set_callbacks(_screen_tag, _cpu_tag, DEVCB2_##_irq, DEVCB2_##_k); \
163163   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
164164   MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \
165165   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
r20984r20985
169169   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8566_device, screen_update)
170170
171171
172#define MOS6566_INTERFACE(_name) \
173   const mos6566_interface (_name) =
174172
175#define MOS6567_INTERFACE(_name) \
176   const mos6566_interface (_name) =
177
178#define MOS8564_INTERFACE(_name) \
179   const mos6566_interface (_name) =
180
181#define MOS6569_INTERFACE(_name) \
182   const mos6566_interface (_name) =
183
184#define MOS8566_INTERFACE(_name) \
185   const mos6566_interface (_name) =
186
187
188
189173//**************************************************************************
190174//  MACROS / CONSTANTS
191175//**************************************************************************
r20984r20985
281265//  TYPE DEFINITIONS
282266//***************************************************************************
283267
284// ======================> mos6566_interface
285
286struct mos6566_interface
287{
288   const char          *m_screen_tag;
289   const char          *m_cpu_tag;
290
291   devcb_write_line    m_out_irq_cb;
292   devcb_write_line    m_out_ba_cb;
293   devcb_write_line    m_out_aec_cb;
294
295   devcb_write8        m_out_k_cb;
296};
297
298
299268// ======================> mos6566_device
300269
301270class mos6566_device :  public device_t,
302271                  public device_memory_interface,
303                  public device_execute_interface,
304                  public mos6566_interface
272                  public device_execute_interface
305273{
306274public:
307275   // construction/destruction
308   mos6566_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
276   mos6566_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
309277   mos6566_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
310278
279   template<class _irq, class _k> void set_callbacks(const char *screen_tag, const char *cpu_tag, _irq irq, _k k) {
280      m_screen_tag = screen_tag;
281      m_cpu_tag = cpu_tag;
282      m_write_irq.set_callback(irq);
283      m_write_k.set_callback(k);
284   }
285
311286   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
312287
313288   DECLARE_READ8_MEMBER( read );
r20984r20985
340315   };
341316
342317   // device-level overrides
343   virtual void device_config_complete();
344318   virtual void device_start();
345319   virtual void device_reset();
346320   virtual void execute_run();
r20984r20985
376350   void draw_graphics();
377351   void draw_sprites();
378352
353   devcb2_write_line       m_write_irq;
354   devcb2_write_line       m_write_ba;
355   devcb2_write_line       m_write_aec;
356   devcb2_write8           m_write_k;
357
358   const char *m_screen_tag;
359   const char *m_cpu_tag;
379360   screen_device *m_screen;            // screen which sets bitmap properties
380361   cpu_device *m_cpu;
381362
r20984r20985
450431   /* Cycles */
451432   UINT64 m_first_ba_cycle;
452433   UINT8 m_device_suspended;
453
454   devcb_resolved_write_line       m_out_irq_func;
455   devcb_resolved_write_line       m_out_ba_func;
456   devcb_resolved_write_line       m_out_aec_func;
457   devcb_resolved_write8           m_out_k_func;
458434};
459435
460436
r20984r20985
465441public:
466442   // construction/destruction
467443   mos6567_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
468   mos6567_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
444   mos6567_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
469445};
470446
471447
r20984r20985
496472public:
497473   // construction/destruction
498474   mos6569_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
499   mos6569_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
475   mos6569_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant);
500476
501477   // device-level overrides
502478   virtual void execute_run();
trunk/src/mess/drivers/osborne1.c
r20984r20985
212212   NULL
213213};
214214
215static IEEE488_INTERFACE( ieee488_intf )
216{
217   DEVCB_NULL,
218   DEVCB_NULL,
219   DEVCB_NULL,
220   DEVCB_NULL,
221   DEVCB_NULL,
222   DEVCB_DEVICE_LINE_MEMBER("pia_0", pia6821_device, ca2_w),
223   DEVCB_NULL,
224   DEVCB_NULL
225};
226
227215/* F4 Character Displayer */
228216static const gfx_layout osborne1_charlayout =
229217{
r20984r20985
267255   MCFG_MB8877_ADD("mb8877", default_wd17xx_interface_2_drives )
268256
269257   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(osborne1_floppy_interface)
270   MCFG_IEEE488_BUS_ADD(ieee488_intf)
258   MCFG_IEEE488_BUS_ADD()
259   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE("pia_0", pia6821_device, ca2_w))
271260   MCFG_SOFTWARE_LIST_ADD("flop_list","osborne1")
272261
273262   /* internal ram */
trunk/src/mess/drivers/tek405x.c
r20984r20985
11291129
11301130
11311131
1132//-------------------------------------------------
1133//  IEEE488_INTERFACE( ieee488_intf )
1134//-------------------------------------------------
1135
1136static IEEE488_INTERFACE( ieee488_intf )
1137{
1138   DEVCB_NULL,
1139   DEVCB_NULL,
1140   DEVCB_NULL,
1141   DEVCB_NULL,
1142   DEVCB_NULL,
1143   DEVCB_NULL,
1144   DEVCB_NULL,
1145   DEVCB_NULL
1146};
1147
1148
1149
11501132//**************************************************************************
11511133//  MACHINE INITIALIZATION
11521134//**************************************************************************
r20984r20985
12281210   MCFG_PIA6821_ADD(MC6820_GPIB_TAG, gpib_pia_intf)
12291211   MCFG_PIA6821_ADD(MC6820_COM_TAG, com_pia_intf)
12301212   MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
1231   MCFG_IEEE488_BUS_ADD(ieee488_intf)
1213   MCFG_IEEE488_BUS_ADD()
12321214
12331215   // internal ram
12341216   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/primo.c
r20984r20985
248248   NULL
249249};
250250
251static CBM_IEC_INTERFACE( cbm_iec_intf )
252{
253   DEVCB_NULL,
254   DEVCB_NULL,
255   DEVCB_NULL,
256   DEVCB_NULL,
257   DEVCB_NULL
258};
259
260251static MACHINE_CONFIG_START( primoa32, primo_state )
261252   /* basic machine hardware */
262253   MCFG_CPU_ADD( "maincpu", Z80, 2500000 )
r20984r20985
290281   MCFG_CASSETTE_ADD( CASSETTE_TAG, primo_cassette_interface )
291282
292283   /* floppy from serial bus */
293   MCFG_CBM_IEC_ADD(cbm_iec_intf, NULL)
284   MCFG_CBM_IEC_ADD(NULL)
294285
295286   /* cartridge */
296287   MCFG_CARTSLOT_ADD("cart1")
trunk/src/mess/drivers/c64.c
r20984r20985
493493   check_interrupts();
494494}
495495
496static MOS6567_INTERFACE( vic_intf )
497{
498   SCREEN_TAG,
499   M6510_TAG,
500   DEVCB_DRIVER_LINE_MEMBER(c64_state, vic_irq_w),
501   DEVCB_NULL, // BA -> 6502 RDY
502   DEVCB_NULL, // AEC -> 6502 AEC
503   DEVCB_NULL
504};
505496
506
507497//-------------------------------------------------
508498//  MOS6581_INTERFACE( sid_intf )
509499//-------------------------------------------------
r20984r20985
562552   return data;
563553}
564554
565static MOS6581_INTERFACE( sid_intf )
566{
567   DEVCB_DRIVER_MEMBER(c64_state, sid_potx_r),
568   DEVCB_DRIVER_MEMBER(c64_state, sid_poty_r)
569};
570555
571
572556//-------------------------------------------------
573557//  MOS6526_INTERFACE( cia1_intf )
574558//-------------------------------------------------
r20984r20985
688672   m_vic->lp_w(BIT(data, 4));
689673}
690674
691static MOS6526_INTERFACE( cia1_intf )
692{
693   DEVCB_DRIVER_LINE_MEMBER(c64_state, cia1_irq_w),
694   DEVCB_NULL,
695   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, sp1_w),
696   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, cnt1_w),
697   DEVCB_DRIVER_MEMBER(c64_state, cia1_pa_r),
698   DEVCB_NULL,
699   DEVCB_DRIVER_MEMBER(c64_state, cia1_pb_r),
700   DEVCB_DRIVER_MEMBER(c64_state, cia1_pb_w)
701};
702
703675READ8_MEMBER( c64gs_state::cia1_pa_r )
704676{
705677   /*
r20984r20985
756728   return data;
757729}
758730
759static MOS6526_INTERFACE( c64gs_cia1_intf )
760{
761   DEVCB_DRIVER_LINE_MEMBER(c64_state, cia1_irq_w),
762   DEVCB_NULL,
763   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, sp1_w),
764   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, cnt1_w),
765   DEVCB_DRIVER_MEMBER(c64gs_state, cia1_pa_r),
766   DEVCB_NULL,
767   DEVCB_DRIVER_MEMBER(c64gs_state, cia1_pb_r),
768   DEVCB_DRIVER_MEMBER(c64_state, cia1_pb_w)
769};
770731
771
772732//-------------------------------------------------
773733//  MOS6526_INTERFACE( cia2_intf )
774734//-------------------------------------------------
r20984r20985
839799   m_iec->data_w(!BIT(data, 5));
840800}
841801
842static MOS6526_INTERFACE( cia2_intf )
843{
844   DEVCB_DRIVER_LINE_MEMBER(c64_state, cia2_irq_w),
845   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pc2_w),
846   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, sp2_w),
847   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w),
848   DEVCB_DRIVER_MEMBER(c64_state, cia2_pa_r),
849   DEVCB_DRIVER_MEMBER(c64_state, cia2_pa_w),
850   DEVCB_DEVICE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pb_r),
851   DEVCB_DEVICE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pb_w)
852};
853802
854
855803//-------------------------------------------------
856804//  M6510_INTERFACE( cpu_intf )
857805//-------------------------------------------------
r20984r20985
995943
996944
997945//-------------------------------------------------
998//  CBM_IEC_INTERFACE( iec_intf )
999//-------------------------------------------------
1000
1001static CBM_IEC_INTERFACE( iec_intf )
1002{
1003   DEVCB_DEVICE_LINE_MEMBER(MOS6526_1_TAG, mos6526_device, flag_w),
1004   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, atn_w),
1005   DEVCB_NULL,
1006   DEVCB_NULL,
1007   DEVCB_NULL
1008};
1009
1010
1011//-------------------------------------------------
1012946//  C64_EXPANSION_INTERFACE( expansion_intf )
1013947//-------------------------------------------------
1014948
r20984r20985
11521086   MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
11531087
11541088   // video hardware
1155   MCFG_MOS6567_ADD(MOS6567_TAG, SCREEN_TAG, VIC6567_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
1089   MCFG_MOS6567_ADD(MOS6567_TAG, SCREEN_TAG, VIC6567_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, c64_state, vic_irq_w))
11561090
11571091   // sound hardware
11581092   MCFG_SPEAKER_STANDARD_MONO("mono")
1159   MCFG_SOUND_ADD(MOS6581_TAG, SID6581, VIC6567_CLOCK)
1160   MCFG_SOUND_CONFIG(sid_intf)
1093   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6567_CLOCK)
1094   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c64_state, sid_poty_r))
11611095   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
11621096
11631097   // devices
11641098   MCFG_PLS100_ADD(PLA_TAG)
1165   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6567_CLOCK, 60, cia1_intf)
1166   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6567_CLOCK, 60, cia2_intf)
1099   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6567_CLOCK, 60, DEVWRITELINE(DEVICE_SELF, c64_state, cia1_irq_w))
1100   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt1_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp1_w))
1101   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia1_pa_r), NULL)
1102   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia1_pb_r), DEVWRITE8(DEVICE_SELF, c64_state, cia1_pb_w), NULL)
1103   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6567_CLOCK, 60, DEVWRITELINE(DEVICE_SELF, c64_state, cia2_irq_w))
1104   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp2_w))
1105   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia2_pa_r), DEVWRITE8(DEVICE_SELF, c64_state, cia2_pa_w))
1106   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(C64_USER_PORT_TAG, c64_user_port_device, pb_r), DEVWRITE8(C64_USER_PORT_TAG, c64_user_port_device, pb_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, pc2_w))
11671107   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w))
1168   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1108   MCFG_CBM_IEC_ADD("c1541")
1109   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w))
1110   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, atn_w))
11691111   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
11701112   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w))
11711113   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
r20984r20985
12341176//-------------------------------------------------
12351177
12361178static MACHINE_CONFIG_DERIVED_CLASS( ntsc_c, ntsc, c64c_state )
1237   MCFG_SOUND_REPLACE(MOS6581_TAG, SID8580, VIC6567_CLOCK)
1238   MCFG_SOUND_CONFIG(sid_intf)
1179   MCFG_SOUND_REPLACE(MOS6581_TAG, MOS8580, VIC6567_CLOCK)
1180   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c64_state, sid_poty_r))
12391181   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
12401182MACHINE_CONFIG_END
12411183
r20984r20985
12531195   MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
12541196
12551197   // video hardware
1256   MCFG_MOS6569_ADD(MOS6569_TAG, SCREEN_TAG, VIC6569_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
1198   MCFG_MOS6569_ADD(MOS6569_TAG, SCREEN_TAG, VIC6569_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, c64_state, vic_irq_w))
12571199
12581200   // sound hardware
12591201   MCFG_SPEAKER_STANDARD_MONO("mono")
1260   MCFG_SOUND_ADD(MOS6581_TAG, SID6581, VIC6569_CLOCK)
1261   MCFG_SOUND_CONFIG(sid_intf)
1202   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6569_CLOCK)
1203   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c64_state, sid_poty_r))
12621204   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
12631205
12641206   // devices
12651207   MCFG_PLS100_ADD(PLA_TAG)
1266   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6569_CLOCK, 50, cia1_intf)
1267   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6569_CLOCK, 50, cia2_intf)
1208   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(DEVICE_SELF, c64_state, cia1_irq_w))
1209   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt1_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp1_w))
1210   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia1_pa_r), NULL)
1211   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia1_pb_r), DEVWRITE8(DEVICE_SELF, c64_state, cia1_pb_w), NULL)
1212   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(DEVICE_SELF, c64_state, cia2_irq_w))
1213   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp2_w))
1214   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia2_pa_r), DEVWRITE8(DEVICE_SELF, c64_state, cia2_pa_w))
1215   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(C64_USER_PORT_TAG, c64_user_port_device, pb_r), DEVWRITE8(C64_USER_PORT_TAG, c64_user_port_device, pb_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, pc2_w))
12681216   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w))
1269   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1217   MCFG_CBM_IEC_ADD("c1541")
1218   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w))
1219   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, atn_w))
12701220   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
12711221   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w))
12721222   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
r20984r20985
13131263//-------------------------------------------------
13141264
13151265static MACHINE_CONFIG_DERIVED_CLASS( pal_c, pal, c64c_state )
1316   MCFG_SOUND_REPLACE(MOS6581_TAG, SID8580, VIC6569_CLOCK)
1317   MCFG_SOUND_CONFIG(sid_intf)
1266   MCFG_SOUND_REPLACE(MOS6581_TAG, MOS8580, VIC6569_CLOCK)
1267   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c64_state, sid_poty_r))
13181268   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
13191269MACHINE_CONFIG_END
13201270
r20984r20985
13321282   MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
13331283
13341284   // video hardware
1335   MCFG_MOS8565_ADD(MOS6569_TAG, SCREEN_TAG, VIC6569_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
1285   MCFG_MOS8565_ADD(MOS6569_TAG, SCREEN_TAG, VIC6569_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, c64_state, vic_irq_w))
13361286
13371287   // sound hardware
13381288   MCFG_SPEAKER_STANDARD_MONO("mono")
1339   MCFG_SOUND_ADD(MOS6581_TAG, SID8580, VIC6569_CLOCK)
1340   MCFG_SOUND_CONFIG(sid_intf)
1289   MCFG_SOUND_ADD(MOS6581_TAG, MOS8580, VIC6569_CLOCK)
1290   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c64_state, sid_poty_r))
13411291   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
13421292
13431293   // devices
13441294   MCFG_PLS100_ADD(PLA_TAG)
1345   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6569_CLOCK, 50, c64gs_cia1_intf)
1346   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6569_CLOCK, 50, cia2_intf)
1347   MCFG_CBM_IEC_BUS_ADD(iec_intf)
1295   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(DEVICE_SELF, c64_state, cia1_irq_w))
1296   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt1_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp1_w))
1297   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c64gs_state, cia1_pa_r), NULL)
1298   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c64gs_state, cia1_pb_r), NULL, NULL)
1299   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(DEVICE_SELF, c64_state, cia2_irq_w))
1300   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp2_w))
1301   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, cia2_pa_r), DEVWRITE8(DEVICE_SELF, c64_state, cia2_pa_w))
1302   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(C64_USER_PORT_TAG, c64_user_port_device, pb_r), DEVWRITE8(C64_USER_PORT_TAG, c64_user_port_device, pb_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, pc2_w))
1303   MCFG_CBM_IEC_ADD(NULL)
1304   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w))
1305   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, atn_w))
1306
13481307   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
13491308   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w))
13501309   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
trunk/src/mess/drivers/sage2.c
r20984r20985
507507
508508
509509//-------------------------------------------------
510//  IEEE488_INTERFACE( ieee488_intf )
511//-------------------------------------------------
512
513static IEEE488_INTERFACE( ieee488_intf )
514{
515   DEVCB_NULL,
516   DEVCB_NULL,
517   DEVCB_NULL,
518   DEVCB_NULL,
519   DEVCB_NULL,
520   DEVCB_NULL,
521   DEVCB_NULL,
522   DEVCB_NULL
523};
524
525
526//-------------------------------------------------
527510//  GENERIC_TERMINAL_INTERFACE( terminal_intf )
528511//-------------------------------------------------
529512
r20984r20985
596579   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
597580   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", sage2_floppies, "525qd", 0, floppy_image_device::default_floppy_formats)
598581   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", sage2_floppies, "525qd", 0, floppy_image_device::default_floppy_formats)
599   MCFG_IEEE488_BUS_ADD(ieee488_intf)
582   MCFG_IEEE488_BUS_ADD()
600583
601584   // internal ram
602585   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/victor9k.c
r20984r20985
884884   DEVCB_DRIVER_LINE_MEMBER(victor9k_state, kbrdy_w)
885885};
886886
887// IEEE-488 Interface
888
889static IEEE488_INTERFACE( ieee488_intf )
890{
891   DEVCB_NULL,
892   DEVCB_NULL,
893   DEVCB_DEVICE_LINE_MEMBER(M6522_1_TAG, via6522_device, write_ca1),
894   DEVCB_DEVICE_LINE_MEMBER(M6522_1_TAG, via6522_device, write_ca2),
895   DEVCB_NULL,
896   DEVCB_NULL,
897   DEVCB_NULL,
898   DEVCB_NULL
899};
900
901887static SLOT_INTERFACE_START( victor9k_floppies )
902888   SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
903889SLOT_INTERFACE_END
r20984r20985
948934   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
949935
950936   // devices
951   MCFG_IEEE488_BUS_ADD(ieee488_intf)
937   MCFG_IEEE488_BUS_ADD()
938   MCFG_IEEE488_NRFD_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_ca1))
939   MCFG_IEEE488_NDAC_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_ca2))
952940   MCFG_PIC8259_ADD(I8259A_TAG, pic_intf)
953941   MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
954942   MCFG_UPD7201_ADD(UPD7201_TAG, XTAL_30MHz/30, mpsc_intf)
trunk/src/mess/drivers/c65.c
r20984r20985
5252
5353#include "emu.h"
5454#include "cpu/m6502/m4510.h"
55#include "sound/sid6581.h"
55#include "sound/mos6581.h"
5656#include "machine/6526cia.h"
5757#include "machine/cbmipt.h"
5858#include "video/vic4567.h"
r20984r20985
203203   return c64_paddle_read(sid, space, 1);
204204}
205205
206static MOS6581_INTERFACE( sidr_intf )
207{
208   DEVCB_DRIVER_MEMBER(c65_state, sid_potx_r),
209   DEVCB_DRIVER_MEMBER(c65_state, sid_poty_r)
210};
211206
212static MOS6581_INTERFACE( sidl_intf )
213{
214   DEVCB_NULL,
215   DEVCB_NULL
216};
217
218
219static CBM_IEC_INTERFACE( cbm_iec_intf )
220{
221   DEVCB_NULL,
222   DEVCB_NULL,
223   DEVCB_NULL,
224   DEVCB_NULL,
225   DEVCB_NULL
226};
227
228
229207/*************************************
230208 *
231209 *  VIC III interfaces
r20984r20985
326304
327305   /* sound hardware */
328306   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
329   MCFG_SOUND_ADD("sid_r", SID8580, 985248)
330   MCFG_SOUND_CONFIG(sidr_intf)
307   MCFG_SOUND_ADD("sid_r", MOS8580, 985248)
308   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c65_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c65_state, sid_poty_r))
331309   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
332   MCFG_SOUND_ADD("sid_l", SID8580, 985248)
310   MCFG_SOUND_ADD("sid_l", MOS8580, 985248)
333311   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
334   MCFG_SOUND_CONFIG(sidl_intf)
335312
336313   /* quickload */
337314   MCFG_QUICKLOAD_ADD("quickload", cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
r20984r20985
341318   MCFG_LEGACY_MOS6526R1_ADD("cia_1", 3500000, 60, c65_cia1)
342319
343320   /* floppy from serial bus */
344   MCFG_CBM_IEC_ADD(cbm_iec_intf, NULL)
321   MCFG_CBM_IEC_ADD(NULL)
345322
346323   MCFG_FRAGMENT_ADD(c64_cartslot)
347324
r20984r20985
361338   MCFG_VIC3_ADD("vic3", c65_vic3_pal_intf)
362339
363340   /* sound hardware */
364   MCFG_SOUND_REPLACE("sid_r", SID8580, 1022727)
365   MCFG_SOUND_CONFIG(sidr_intf)
341   MCFG_SOUND_REPLACE("sid_r", MOS8580, 1022727)
342   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c65_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c65_state, sid_poty_r))
366343   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
367   MCFG_SOUND_REPLACE("sid_l", SID8580, 1022727)
368   MCFG_SOUND_CONFIG(sidl_intf)
344   MCFG_SOUND_REPLACE("sid_l", MOS8580, 1022727)
369345   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
370346
371347   /* cia */
trunk/src/mess/drivers/c128.c
r20984r20985
899899   m_vic_k = data;
900900}
901901
902static MOS8564_INTERFACE( vic_intf )
903{
904   SCREEN_VIC_TAG,
905   M8502_TAG,
906   DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_irq_w),
907   DEVCB_NULL,
908   DEVCB_NULL,
909   DEVCB_DRIVER_MEMBER(c128_state, vic_k_w)
910};
911902
912
913903//-------------------------------------------------
914904//  MOS6581_INTERFACE( sid_intf )
915905//-------------------------------------------------
r20984r20985
968958   return data;
969959}
970960
971static MOS6581_INTERFACE( sid_intf )
972{
973   DEVCB_DRIVER_MEMBER(c128_state, sid_potx_r),
974   DEVCB_DRIVER_MEMBER(c128_state, sid_poty_r)
975};
976961
977
978962//-------------------------------------------------
979963//  MOS6526_INTERFACE( cia1_intf )
980964//-------------------------------------------------
r20984r20985
11121096   update_iec();
11131097}
11141098
1115static MOS6526_INTERFACE( cia1_intf )
1116{
1117   DEVCB_DRIVER_LINE_MEMBER(c128_state, cia1_irq_w),
1118   DEVCB_NULL,
1119   DEVCB_DRIVER_LINE_MEMBER(c128_state, cia1_cnt_w),
1120   DEVCB_DRIVER_LINE_MEMBER(c128_state, cia1_sp_w),
1121   DEVCB_DRIVER_MEMBER(c128_state, cia1_pa_r),
1122   DEVCB_NULL,
1123   DEVCB_DRIVER_MEMBER(c128_state, cia1_pb_r),
1124   DEVCB_DRIVER_MEMBER(c128_state, cia1_pb_w)
1125};
11261099
1127
11281100//-------------------------------------------------
11291101//  MOS6526_INTERFACE( cia2_intf )
11301102//-------------------------------------------------
r20984r20985
11971169   update_iec();
11981170}
11991171
1200static MOS6526_INTERFACE( cia2_intf )
1201{
1202   DEVCB_DRIVER_LINE_MEMBER(c128_state, cia2_irq_w),
1203   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pc2_w),
1204   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, sp2_w),
1205   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w),
1206   DEVCB_DRIVER_MEMBER(c128_state, cia2_pa_r),
1207   DEVCB_DRIVER_MEMBER(c128_state, cia2_pa_w),
1208   DEVCB_DEVICE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pb_r),
1209   DEVCB_DEVICE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pb_w)
1210};
12111172
1212
12131173//-------------------------------------------------
12141174//  M6510_INTERFACE( cpu_intf )
12151175//-------------------------------------------------
r20984r20985
13131273   update_iec();
13141274}
13151275
1316static CBM_IEC_INTERFACE( cbm_iec_intf )
1317{
1318   DEVCB_DRIVER_LINE_MEMBER(c128_state, iec_srq_w),
1319   DEVCB_NULL,
1320   DEVCB_NULL,
1321   DEVCB_DRIVER_LINE_MEMBER(c128_state, iec_data_w),
1322   DEVCB_NULL
1323};
13241276
1325
13261277//-------------------------------------------------
13271278//  C64_EXPANSION_INTERFACE( expansion_intf )
13281279//-------------------------------------------------
r20984r20985
14911442
14921443   // video hardware
14931444   MCFG_MOS8563_ADD(MOS8563_TAG, SCREEN_VDC_TAG, VIC6567_CLOCK*2, vdc_intf, vdc_videoram_map)
1494   MCFG_MOS8564_ADD(MOS8564_TAG, SCREEN_VIC_TAG, VIC6567_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
1445   MCFG_MOS8564_ADD(MOS8564_TAG, SCREEN_VIC_TAG, M8502_TAG, VIC6567_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, c128_state, vic_irq_w), DEVWRITE8(DEVICE_SELF, c128_state, vic_k_w))
14951446   MCFG_GFXDECODE(c128)
14961447
14971448   // sound hardware
14981449   MCFG_SPEAKER_STANDARD_MONO("mono")
1499   MCFG_SOUND_ADD(MOS6581_TAG, SID6581, VIC6567_CLOCK)
1500   MCFG_SOUND_CONFIG(sid_intf)
1450   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6567_CLOCK)
1451   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c128_state, sid_poty_r))
15011452   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
15021453   MCFG_SOUND_ADD("dac", DAC, 0)
15031454   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
r20984r20985
15051456   // devices
15061457   MCFG_MOS8722_ADD(MOS8722_TAG, mmu_intf)
15071458   MCFG_MOS8721_ADD(MOS8721_TAG)
1508   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6567_CLOCK, 60, cia1_intf)
1509   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6567_CLOCK, 60, cia2_intf)
1459   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6567_CLOCK, 60, DEVWRITELINE(DEVICE_SELF, c128_state, cia1_irq_w))
1460   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c128_state, cia1_cnt_w), DEVWRITELINE(DEVICE_SELF, c128_state, cia1_sp_w))
1461   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, cia1_pa_r), NULL)
1462   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, cia1_pb_r), DEVWRITE8(DEVICE_SELF, c128_state, cia1_pb_w), NULL)
1463   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6567_CLOCK, 60, DEVWRITELINE(DEVICE_SELF, c128_state, cia2_irq_w))
1464   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp2_w))
1465   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, cia2_pa_r), DEVWRITE8(DEVICE_SELF, c128_state, cia2_pa_w))
1466   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(C64_USER_PORT_TAG, c64_user_port_device, pb_r), DEVWRITE8(C64_USER_PORT_TAG, c64_user_port_device, pb_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, pc2_w))
15101467   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
15111468   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w))
15121469   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
r20984r20985
15471504//-------------------------------------------------
15481505
15491506static MACHINE_CONFIG_DERIVED( c128, ntsc )
1550   MCFG_CBM_IEC_ADD(cbm_iec_intf, "c1571")
1507   MCFG_CBM_IEC_ADD("c1571")
1508   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_srq_w))
1509   MCFG_CBM_IEC_BUS_DATA_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_data_w))
15511510MACHINE_CONFIG_END
15521511
15531512
r20984r20985
15561515//-------------------------------------------------
15571516
15581517static MACHINE_CONFIG_DERIVED( c128dcr, ntsc )
1559   MCFG_CBM_IEC_BUS_ADD(cbm_iec_intf)
15601518   MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, NULL, NULL)
15611519   MCFG_CBM_IEC_SLOT_ADD("iec8", 8, c128dcr_iec_devices, "c1571", NULL) // TODO c1571cr
15621520   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL)
15631521   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
15641522   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
1523   MCFG_CBM_IEC_BUS_ADD()
1524   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_srq_w))
1525   MCFG_CBM_IEC_BUS_DATA_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_data_w))
15651526MACHINE_CONFIG_END
15661527
15671528
r20984r20985
15701531//-------------------------------------------------
15711532
15721533static MACHINE_CONFIG_DERIVED( c128d81, ntsc )
1573   MCFG_CBM_IEC_BUS_ADD(cbm_iec_intf)
15741534   MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, NULL, NULL)
15751535   MCFG_CBM_IEC_SLOT_ADD("iec8", 8, c128d81_iec_devices, "c1563", NULL)
15761536   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL)
15771537   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
15781538   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
1539   MCFG_CBM_IEC_BUS_ADD()
1540   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_srq_w))
1541   MCFG_CBM_IEC_BUS_DATA_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_data_w))
15791542MACHINE_CONFIG_END
15801543
15811544
r20984r20985
15981561
15991562   // video hardware
16001563   MCFG_MOS8563_ADD(MOS8563_TAG, SCREEN_VDC_TAG, VIC6569_CLOCK*2, vdc_intf, vdc_videoram_map)
1601   MCFG_MOS8566_ADD(MOS8564_TAG, SCREEN_VIC_TAG, VIC6569_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
1564   MCFG_MOS8566_ADD(MOS8564_TAG, SCREEN_VIC_TAG, M8502_TAG, VIC6569_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, c128_state, vic_irq_w), DEVWRITE8(DEVICE_SELF, c128_state, vic_k_w))
16021565   MCFG_GFXDECODE(c128)
16031566
16041567   // sound hardware
16051568   MCFG_SPEAKER_STANDARD_MONO("mono")
1606   MCFG_SOUND_ADD(MOS6581_TAG, SID6581, VIC6569_CLOCK)
1607   MCFG_SOUND_CONFIG(sid_intf)
1569   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6569_CLOCK)
1570   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, sid_potx_r), DEVREAD8(DEVICE_SELF, c128_state, sid_poty_r))
16081571   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
16091572   MCFG_SOUND_ADD("dac", DAC, 0)
16101573   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
r20984r20985
16121575   // devices
16131576   MCFG_MOS8722_ADD(MOS8722_TAG, mmu_intf)
16141577   MCFG_MOS8721_ADD(MOS8721_TAG)
1615   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6569_CLOCK, 50, cia1_intf)
1616   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6569_CLOCK, 50, cia2_intf)
1578   MCFG_MOS6526_ADD(MOS6526_1_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(DEVICE_SELF, c128_state, cia1_irq_w))
1579   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c128_state, cia1_cnt_w), DEVWRITELINE(DEVICE_SELF, c128_state, cia1_sp_w))
1580   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, cia1_pa_r), NULL)
1581   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, cia1_pb_r), DEVWRITE8(DEVICE_SELF, c128_state, cia1_pb_w), NULL)
1582   MCFG_MOS6526_ADD(MOS6526_2_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(DEVICE_SELF, c128_state, cia2_irq_w))
1583   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, sp2_w))
1584   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, c128_state, cia2_pa_r), DEVWRITE8(DEVICE_SELF, c128_state, cia2_pa_w))
1585   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(C64_USER_PORT_TAG, c64_user_port_device, pb_r), DEVWRITE8(C64_USER_PORT_TAG, c64_user_port_device, pb_w), DEVWRITELINE(C64_USER_PORT_TAG, c64_user_port_device, pc2_w))
16171586   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
16181587   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w))
16191588   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
r20984r20985
16541623//-------------------------------------------------
16551624
16561625static MACHINE_CONFIG_DERIVED( c128pal, pal )
1657   MCFG_CBM_IEC_ADD(cbm_iec_intf, "c1571")
1626   MCFG_CBM_IEC_ADD("c1571")
1627   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_srq_w))
1628   MCFG_CBM_IEC_BUS_DATA_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_data_w))
16581629MACHINE_CONFIG_END
16591630
16601631
r20984r20985
16631634//-------------------------------------------------
16641635
16651636static MACHINE_CONFIG_DERIVED( c128dcrp, pal )
1666   MCFG_CBM_IEC_BUS_ADD(cbm_iec_intf)
16671637   MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, NULL, NULL)
16681638   MCFG_CBM_IEC_SLOT_ADD("iec8", 8, c128dcr_iec_devices, "c1571", NULL) // TODO c1571cr
16691639   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL)
16701640   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
16711641   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
1642   MCFG_CBM_IEC_BUS_ADD()
1643   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_srq_w))
1644   MCFG_CBM_IEC_BUS_DATA_CALLBACK(DEVWRITELINE(DEVICE_SELF, c128_state, iec_data_w))
16721645MACHINE_CONFIG_END
16731646
16741647
trunk/src/mess/drivers/vic10.c
r20984r20985
290290   check_interrupts();
291291}
292292
293static MOS6566_INTERFACE( vic_intf )
294{
295   SCREEN_TAG,
296   M6510_TAG,
297   DEVCB_DRIVER_LINE_MEMBER(vic10_state, vic_irq_w),
298   DEVCB_NULL,
299   DEVCB_NULL,
300   DEVCB_NULL
301};
302293
303
304294//-------------------------------------------------
305295//  sid6581_interface sid_intf
306296//-------------------------------------------------
r20984r20985
359349   return data;
360350}
361351
362static MOS6581_INTERFACE( sid_intf )
363{
364   DEVCB_DRIVER_MEMBER(vic10_state, sid_potx_r),
365   DEVCB_DRIVER_MEMBER(vic10_state, sid_poty_r)
366};
367352
368
369353//-------------------------------------------------
370354//  MOS6526_INTERFACE( cia_intf )
371355//-------------------------------------------------
r20984r20985
485469   m_vic->lp_w(BIT(data, 4));
486470}
487471
488static MOS6526_INTERFACE( cia_intf )
489{
490   DEVCB_DRIVER_LINE_MEMBER(vic10_state, cia_irq_w),
491   DEVCB_NULL,
492   DEVCB_DEVICE_LINE_MEMBER(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, sp_w),
493   DEVCB_DEVICE_LINE_MEMBER(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, cnt_w),
494   DEVCB_DRIVER_MEMBER(vic10_state, cia_pa_r),
495   DEVCB_NULL,
496   DEVCB_DRIVER_MEMBER(vic10_state, cia_pb_r),
497   DEVCB_DRIVER_MEMBER(vic10_state, cia_pb_w)
498};
499472
500
501473//-------------------------------------------------
502474//  M6510_INTERFACE( cpu_intf )
503475//-------------------------------------------------
r20984r20985
636608   MCFG_QUANTUM_PERFECT_CPU(M6510_TAG)
637609
638610   // video hardware
639   MCFG_MOS6566_ADD(MOS6566_TAG, SCREEN_TAG, VIC6566_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
611   MCFG_MOS6566_ADD(MOS6566_TAG, SCREEN_TAG, VIC6566_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, vic10_state, vic_irq_w))
640612
641613   // sound hardware
642614   MCFG_SPEAKER_STANDARD_MONO("mono")
643   MCFG_SOUND_ADD(MOS6581_TAG, SID6581, VIC6566_CLOCK)
644   MCFG_SOUND_CONFIG(sid_intf)
615   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6566_CLOCK)
616   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, vic10_state, sid_potx_r), DEVREAD8(DEVICE_SELF, vic10_state, sid_poty_r))
645617   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
646618
647619   // devices
648   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6566_CLOCK, 60, cia_intf)
620   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6566_CLOCK, 60, DEVWRITELINE(DEVICE_SELF, vic10_state, cia_irq_w))
621   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, cnt_w), DEVWRITELINE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, sp_w))
622   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, vic10_state, cia_pa_r), NULL)
623   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, vic10_state, cia_pb_r), DEVWRITE8(DEVICE_SELF, vic10_state, cia_pb_w), NULL)
649624   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w))
650625   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
651626   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6566_TAG, mos6566_device, lp_w))
trunk/src/mess/drivers/pet2001.c
r20984r20985
864864
865865
866866//-------------------------------------------------
867//  IEEE488_INTERFACE( ieee488_intf )
868//-------------------------------------------------
869
870static IEEE488_INTERFACE( ieee488_intf )
871{
872   DEVCB_NULL,
873   DEVCB_NULL,
874   DEVCB_NULL,
875   DEVCB_NULL,
876   DEVCB_NULL,
877   DEVCB_DEVICE_LINE_MEMBER(M6520_2_TAG, pia6821_device, cb1_w),
878   DEVCB_DEVICE_LINE_MEMBER(M6520_2_TAG, pia6821_device, ca1_w),
879   DEVCB_NULL
880};
881
882
883//-------------------------------------------------
884867//  PET_USER_PORT_INTERFACE( user_intf )
885868//-------------------------------------------------
886869
r20984r20985
11701153   MCFG_VIA6522_ADD(M6522_TAG, XTAL_8MHz/8, via_intf)
11711154   MCFG_PIA6821_ADD(M6520_1_TAG, pia1_intf)
11721155   MCFG_PIA6821_ADD(M6520_2_TAG, pia2_intf)
1173   MCFG_CBM_IEEE488_ADD(ieee488_intf, "c4040")
1156   MCFG_CBM_IEEE488_ADD("c4040")
1157   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, cb1_w))
1158   MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, ca1_w))
11741159   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c2n", NULL, DEVWRITELINE(M6520_1_TAG, pia6821_device, ca1_w))
11751160   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, cbm_datassette_devices, NULL, NULL, DEVWRITELINE(M6522_TAG, via6522_device, write_cb1))
11761161   MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_8MHz/8, pet_expansion_cards, NULL, NULL)
r20984r20985
14471432   MCFG_VIA6522_ADD(M6522_TAG, XTAL_16MHz/16, via_intf)
14481433   MCFG_PIA6821_ADD(M6520_1_TAG, pia1_intf)
14491434   MCFG_PIA6821_ADD(M6520_2_TAG, pia2_intf)
1450   MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050")
1435   MCFG_CBM_IEEE488_ADD("c8050")
1436   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, cb1_w))
1437   MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, ca1_w))
14511438   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c2n", NULL, DEVWRITELINE(M6520_1_TAG, pia6821_device, ca1_w))
14521439   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, cbm_datassette_devices, NULL, NULL, DEVWRITELINE(M6522_TAG, via6522_device, write_cb1))
14531440   MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, NULL, NULL)
trunk/src/mess/drivers/vic20.c
r20984r20985
302302
303303
304304//**************************************************************************
305//  VIDEO
306//**************************************************************************
307
308INTERRUPT_GEN_MEMBER(vic20_state::vic20_raster_interrupt)
309{
310   m_vic->raster_interrupt_gen();
311}
312
313
314
315//**************************************************************************
316305//  ADDRESS MAPS
317306//**************************************************************************
318307
r20984r20985
702691
703692
704693//-------------------------------------------------
705//  CBM_IEC_INTERFACE( cbm_iec_intf )
706//-------------------------------------------------
707
708static CBM_IEC_INTERFACE( cbm_iec_intf )
709{
710   DEVCB_DEVICE_LINE_MEMBER(M6522_1_TAG, via6522_device, write_cb1),
711   DEVCB_NULL,
712   DEVCB_NULL,
713   DEVCB_NULL,
714   DEVCB_NULL
715};
716
717
718//-------------------------------------------------
719//  mos6560_interface vic_ntsc_intf
720//-------------------------------------------------
721
722static MOS6560_INTERFACE( vic_intf )
723{
724   SCREEN_TAG,
725   DEVCB_DEVICE_MEMBER(CONTROL1_TAG, vcs_control_port_device, pot_x_r),
726   DEVCB_DEVICE_MEMBER(CONTROL1_TAG, vcs_control_port_device, pot_y_r)
727};
728
729
730//-------------------------------------------------
731694//  VIC20_EXPANSION_INTERFACE( expansion_intf )
732695//-------------------------------------------------
733696
r20984r20985
813776   MCFG_VIA6522_ADD(M6522_0_TAG, 0, via0_intf)
814777   MCFG_VIA6522_ADD(M6522_1_TAG, 0, via1_intf)
815778   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(M6522_1_TAG, via6522_device, write_ca1))
816   MCFG_CBM_IEC_ADD(cbm_iec_intf, "c1541")
779   MCFG_CBM_IEC_ADD("c1541")
780   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb1))
817781   MCFG_VIC20_USER_PORT_ADD(VIC20_USER_PORT_TAG, user_intf, vic20_user_port_cards, NULL, NULL)
818782   MCFG_QUICKLOAD_ADD("quickload", cbm_vc20, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
819783
r20984r20985
836800   // basic machine hardware
837801   MCFG_CPU_ADD(M6502_TAG, M6502, MOS6560_CLOCK)
838802   MCFG_CPU_PROGRAM_MAP(vic20_mem)
839   MCFG_CPU_PERIODIC_INT_DRIVER(vic20_state, vic20_raster_interrupt,  MOS656X_HRETRACERATE)
840803
841804   // video/sound hardware
842805   MCFG_SPEAKER_STANDARD_MONO("mono")
843   MCFG_MOS6560_ADD(M6560_TAG, SCREEN_TAG, MOS6560_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
806   MCFG_MOS6560_ADD(M6560_TAG, SCREEN_TAG, MOS6560_CLOCK, vic_videoram_map, vic_colorram_map, DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_x_r), DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_y_r))
844807   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
845808
846809   // devices
r20984r20985
863826   // basic machine hardware
864827   MCFG_CPU_ADD(M6502_TAG, M6502, MOS6561_CLOCK)
865828   MCFG_CPU_PROGRAM_MAP(vic20_mem)
866   MCFG_CPU_PERIODIC_INT_DRIVER(vic20_state, vic20_raster_interrupt,  MOS656X_HRETRACERATE)
867829
868830   // video/sound hardware
869831   MCFG_SPEAKER_STANDARD_MONO("mono")
870   MCFG_MOS6561_ADD(M6560_TAG, SCREEN_TAG, MOS6561_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
832   MCFG_MOS6561_ADD(M6560_TAG, SCREEN_TAG, MOS6561_CLOCK, vic_videoram_map, vic_colorram_map, DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_x_r), DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_y_r))
871833   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
872834
873835   // devices
trunk/src/mess/drivers/plus4.c
r20984r20985
5252//  MEMORY MANAGEMENT
5353//**************************************************************************
5454
55void plus4_state::bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal, int *cs0, int *cs1)
55void plus4_state::bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal)
5656{
5757   UINT16 i = ras << 15 | BA10 << 14 | BA11 << 13 | BA13 << 12 | BA9 << 11 | BA8 << 10 | BA14 << 9 | mux << 8 | BA12 << 7 | BA7 << 6 | BA6 << 5 | BA5 << 4 | BA4 << 3 | BA15 << 2 | phi0 << 1 | 1;
5858/*  UINT8 data = m_pla->read(i);
r20984r20985
118118   *addr_clk = F4;
119119   *keyport = F5;
120120   *kernal = F6;
121
122   *cs0 = m_ted->cs0_r(offset);
123   *cs1 = m_ted->cs1_r(offset);
124121}
125122
126123
r20984r20985
128125//  read_memory -
129126//-------------------------------------------------
130127
131UINT8 plus4_state::read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal, int cs0, int cs1)
128UINT8 plus4_state::read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal)
132129{
133   UINT8 data = m_ted->bus_r();
134   int c1l = 1, c1h = 1, c2l = 1, c2h = 1;
130   int cs0 = 1, cs1 = 1, c1l = 1, c1h = 1, c2l = 1, c2h = 1;
131   UINT8 data = m_ted->read(space, offset, cs0, cs1);
135132
136133   //logerror("offset %04x user %u 6551 %u addr_clk %u keyport %u kernal %u cs0 %u cs1 %u\n", offset,user,_6551,addr_clk,keyport,kernal,cs0,cs1);
137134
r20984r20985
222219         }
223220      }
224221   }
225   else if (offset >= 0xff00 && offset < 0xff20)
226   {
227      data = m_ted->read(space, offset & 0x1f);
228   }
229222   else if (offset < 0xfd00 || offset >= 0xff20)
230223   {
231224      data = m_ram->pointer()[offset & m_ram->mask()];
r20984r20985
242235READ8_MEMBER( plus4_state::read )
243236{
244237   int phi0 = 1, mux = 0, ras = 0, ba = 1;
245   int scs, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1;
238   int scs, phi2, user, _6551, addr_clk, keyport, kernal;
246239
247   bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1);
240   bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal);
248241
249   return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1);
242   return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal);
250243}
251244
252245
r20984r20985
256249
257250WRITE8_MEMBER( plus4_state::write )
258251{
259   int scs, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1;
252   int scs, phi2, user, _6551, addr_clk, keyport, kernal;
260253   int phi0 = 1, mux = 0, ras = 0, ba = 1;
261   int c1l = 1, c1h = 1, c2l = 1, c2h = 1;
254   int cs0 = 1, cs1 = 1, c1l = 1, c1h = 1, c2l = 1, c2h = 1;
262255
263   bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1);
256   bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal);
264257
258   m_ted->write(space, offset, data, cs0, cs1);
259
265260   //logerror("write offset %04x data %02x user %u 6551 %u addr_clk %u keyport %u kernal %u cs0 %u cs1 %u\n", offset,data,user,_6551,addr_clk,keyport,kernal,cs0,cs1);
266261
267262   if (!scs && m_vslsi)
r20984r20985
284279   {
285280      m_spi_kb->write(space, 0, data);
286281   }
287   else if (offset >= 0xff00 && offset < 0xff20)
288   {
289      m_ted->write(space, offset & 0x1f, data);
290   }
291   else if (offset == 0xff3e)
292   {
293      m_ted->rom_switch_w(1);
294   }
295   else if (offset == 0xff3f)
296   {
297      m_ted->rom_switch_w(0);
298   }
299282   else if (offset < 0xfd00 || offset >= 0xff20)
300283   {
301284      m_ram->pointer()[offset & m_ram->mask()] = data;
r20984r20985
312295READ8_MEMBER( plus4_state::ted_videoram_r )
313296{
314297   int phi0 = 1, mux = 0, ras = 1, ba = 0;
315   int scs, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1;
298   int scs, phi2, user, _6551, addr_clk, keyport, kernal;
316299
317   bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1);
300   bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal);
318301
319   return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1);
302   return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal);
320303}
321304
322305
r20984r20985
574557//  ted7360_interface ted_intf
575558//-------------------------------------------------
576559
577INTERRUPT_GEN_MEMBER(plus4_state::c16_raster_interrupt)
578{
579   m_ted->raster_interrupt_gen();
580}
581
582INTERRUPT_GEN_MEMBER(plus4_state::c16_frame_interrupt)
583{
584   m_ted->frame_interrupt_gen();
585}
586
587560WRITE_LINE_MEMBER( plus4_state::ted_irq_w )
588561{
589562   m_ted_irq = state;
r20984r20985
640613   return data;
641614}
642615
643static MOS7360_INTERFACE( ted_intf )
644{
645   SCREEN_TAG,
646   MOS7501_TAG,
647   DEVCB_DRIVER_LINE_MEMBER(plus4_state, ted_irq_w),
648   DEVCB_DRIVER_MEMBER(plus4_state, ted_k_r)
649};
650616
651617
652618//-------------------------------------------------
r20984r20985
672638
673639
674640//-------------------------------------------------
675//  CBM_IEC_INTERFACE( iec_intf )
676//-------------------------------------------------
677
678static CBM_IEC_INTERFACE( iec_intf )
679{
680   DEVCB_NULL,
681   DEVCB_DEVICE_LINE_MEMBER(PLUS4_USER_PORT_TAG, plus4_user_port_device, atn_w),
682   DEVCB_NULL,
683   DEVCB_NULL,
684   DEVCB_NULL
685};
686
687
688//-------------------------------------------------
689//  CBM_IEC_INTERFACE( c16_iec_intf )
690//-------------------------------------------------
691
692static CBM_IEC_INTERFACE( c16_iec_intf )
693{
694   DEVCB_NULL,
695   DEVCB_NULL,
696   DEVCB_NULL,
697   DEVCB_NULL,
698   DEVCB_NULL
699};
700
701
702//-------------------------------------------------
703641//  PLUS4_EXPANSION_INTERFACE( expansion_intf )
704642//-------------------------------------------------
705643
r20984r20985
799737   MCFG_CPU_PROGRAM_MAP(plus4_mem)
800738   MCFG_M7501_PORT_CALLBACKS(READ8(plus4_state, cpu_r), WRITE8(plus4_state, cpu_w))
801739   MCFG_M7501_PORT_PULLS(0x00, 0xc0)
802   MCFG_CPU_VBLANK_INT_DRIVER(SCREEN_TAG, plus4_state, c16_frame_interrupt)
803   MCFG_CPU_PERIODIC_INT_DRIVER(plus4_state, c16_raster_interrupt, TED7360_HRETRACERATE)
804740   MCFG_QUANTUM_PERFECT_CPU(MOS7501_TAG)
805741
806742   // video and sound hardware
807743   MCFG_SPEAKER_STANDARD_MONO("mono")
808   MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, XTAL_14_31818MHz/4, ted_intf, ted_videoram_map)
744   MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, MOS7501_TAG, XTAL_14_31818MHz/4, ted_videoram_map, DEVWRITELINE(DEVICE_SELF, plus4_state, ted_irq_w), DEVREAD8(DEVICE_SELF, plus4_state, ted_k_r))
809745   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
810746
811747   // devices
r20984r20985
814750   MCFG_MOS6529_ADD(MOS6529_USER_TAG, DEVREAD8(PLUS4_USER_PORT_TAG, plus4_user_port_device, p_r), DEVWRITE8(PLUS4_USER_PORT_TAG, plus4_user_port_device, p_w))
815751   MCFG_MOS6529_ADD(MOS6529_KB_TAG, CONSTANT(0xff), DEVWRITE8(DEVICE_SELF, plus4_state, spi_kb_w))
816752   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, plus4_datassette_devices, "c1531", NULL, NULL)
817   MCFG_CBM_IEC_ADD(iec_intf, NULL)
753   MCFG_CBM_IEC_ADD(NULL)
754   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PLUS4_USER_PORT_TAG, plus4_user_port_device, atn_w))
818755   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
819756   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
820757   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, "c1551", NULL)
r20984r20985
845782   MCFG_CPU_PROGRAM_MAP(plus4_mem)
846783   MCFG_M7501_PORT_CALLBACKS(READ8(plus4_state, cpu_r), WRITE8(plus4_state, cpu_w))
847784   MCFG_M7501_PORT_PULLS(0x00, 0xc0)
848   MCFG_CPU_VBLANK_INT_DRIVER(SCREEN_TAG, plus4_state, c16_frame_interrupt)
849   MCFG_CPU_PERIODIC_INT_DRIVER(plus4_state, c16_raster_interrupt, TED7360_HRETRACERATE)
850785   MCFG_QUANTUM_PERFECT_CPU(MOS7501_TAG)
851786
852787   // video and sound hardware
853788   MCFG_SPEAKER_STANDARD_MONO("mono")
854   MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, XTAL_17_73447MHz/5, ted_intf, ted_videoram_map)
789   MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, MOS7501_TAG, XTAL_17_73447MHz/5, ted_videoram_map, DEVWRITELINE(DEVICE_SELF, plus4_state, ted_irq_w), DEVREAD8(DEVICE_SELF, plus4_state, ted_k_r))
855790   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
856791
857792   // devices
r20984r20985
860795   MCFG_MOS6529_ADD(MOS6529_USER_TAG, DEVREAD8(PLUS4_USER_PORT_TAG, plus4_user_port_device, p_r), DEVWRITE8(PLUS4_USER_PORT_TAG, plus4_user_port_device, p_w))
861796   MCFG_MOS6529_ADD(MOS6529_KB_TAG, CONSTANT(0xff), DEVWRITE8(DEVICE_SELF, plus4_state, spi_kb_w))
862797   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, plus4_datassette_devices, "c1531", NULL, NULL)
863   MCFG_CBM_IEC_ADD(iec_intf, NULL)
798   MCFG_CBM_IEC_ADD(NULL)
799   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PLUS4_USER_PORT_TAG, plus4_user_port_device, atn_w))
864800   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
865801   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
866802   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, "c1551", NULL)
r20984r20985
895831   MCFG_DEVICE_REMOVE(PLUS4_USER_PORT_TAG)
896832
897833   MCFG_DEVICE_MODIFY(CBM_IEC_TAG)
898   MCFG_DEVICE_CONFIG(c16_iec_intf)
834   MCFG_CBM_IEC_BUS_ATN_CALLBACK(NULL)
899835
900836   MCFG_DEVICE_MODIFY(RAM_TAG)
901837   MCFG_RAM_DEFAULT_SIZE("16K")
r20984r20985
917853   MCFG_DEVICE_REMOVE(PLUS4_USER_PORT_TAG)
918854
919855   MCFG_DEVICE_MODIFY(CBM_IEC_TAG)
920   MCFG_DEVICE_CONFIG(c16_iec_intf)
856   MCFG_CBM_IEC_BUS_ATN_CALLBACK(NULL)
921857
922858   MCFG_DEVICE_MODIFY(RAM_TAG)
923859   MCFG_RAM_DEFAULT_SIZE("16K")
trunk/src/mess/drivers/cbm2.c
r20984r20985
11351135   m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq);
11361136}
11371137
1138static MOS6567_INTERFACE( vic_intf )
1139{
1140   SCREEN_TAG,
1141   M6509_TAG,
1142   DEVCB_DRIVER_LINE_MEMBER(p500_state, vic_irq_w),
1143   DEVCB_NULL,
1144   DEVCB_NULL,
1145   DEVCB_NULL
1146};
11471138
1148
11491139//-------------------------------------------------
11501140//  MOS6581_INTERFACE( sid_intf )
11511141//-------------------------------------------------
r20984r20985
12041194   return data;
12051195}
12061196
1207static MOS6581_INTERFACE( sid_intf )
1208{
1209   DEVCB_DRIVER_MEMBER(cbm2_state, sid_potx_r),
1210   DEVCB_DRIVER_MEMBER(cbm2_state, sid_poty_r)
1211};
12121197
1213
12141198//-------------------------------------------------
12151199//  tpi6525_interface tpi1_intf
12161200//-------------------------------------------------
r20984r20985
16491633   return data;
16501634}
16511635
1652static MOS6526_INTERFACE( cia_intf )
1653{
1654   DEVCB_DEVICE_LINE_MEMBER(MOS6525_1_TAG, tpi6525_device, i2_w),
1655   DEVCB_DEVICE_LINE_MEMBER(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w),
1656   DEVCB_DEVICE_LINE_MEMBER(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w),
1657   DEVCB_DEVICE_LINE_MEMBER(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w),
1658   DEVCB_DRIVER_MEMBER(cbm2_state, cia_pa_r),
1659   DEVCB_DRIVER_MEMBER(cbm2_state, cia_pa_w),
1660   DEVCB_DRIVER_MEMBER(cbm2_state, cia_pb_r),
1661   DEVCB_DEVICE_MEMBER(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)
1662};
16631636
1664
16651637//-------------------------------------------------
16661638//  DS75161A_INTERFACE( ds75161a_intf )
16671639//-------------------------------------------------
r20984r20985
16881660
16891661
16901662//-------------------------------------------------
1691//  IEEE488_INTERFACE( ieee488_intf )
1692//-------------------------------------------------
1693
1694static IEEE488_INTERFACE( ieee488_intf )
1695{
1696   DEVCB_NULL,
1697   DEVCB_NULL,
1698   DEVCB_NULL,
1699   DEVCB_NULL,
1700   DEVCB_NULL,
1701   DEVCB_DEVICE_LINE_MEMBER(MOS6525_1_TAG, tpi6525_device, i1_w),
1702   DEVCB_NULL,
1703   DEVCB_NULL
1704};
1705
1706
1707//-------------------------------------------------
17081663//  pic8259_interface ext_pic_intf
17091664//-------------------------------------------------
17101665
r20984r20985
18881843   m_ext_pic->ir7_w(BIT(data, 7));
18891844}
18901845
1891static MOS6526_INTERFACE( ext_cia_intf )
1892{
1893   DEVCB_DEVICE_LINE_MEMBER(MOS6525_1_TAG, tpi6525_device, i3_w),
1894   DEVCB_NULL,
1895   DEVCB_NULL,
1896   DEVCB_NULL,
1897   DEVCB_DEVICE_HANDLER(EXT_MOS6525_TAG, tpi6525_porta_r),
1898   DEVCB_NULL,
1899   DEVCB_DRIVER_MEMBER(cbm2_state, ext_cia_pb_r),
1900   DEVCB_DRIVER_MEMBER(cbm2_state, ext_cia_pb_w)
1901};
19021846
1903
19041847//-------------------------------------------------
19051848//  CBM2_USER_PORT_INTERFACE( user_intf )
19061849//-------------------------------------------------
r20984r20985
21872130   MCFG_QUANTUM_PERFECT_CPU(M6509_TAG)
21882131
21892132   // video hardware
2190   MCFG_MOS6567_ADD(MOS6567_TAG, SCREEN_TAG, VIC6567_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
2133   MCFG_MOS6567_ADD(MOS6567_TAG, SCREEN_TAG, VIC6567_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, p500_state, vic_irq_w))
21912134
21922135   // sound hardware
21932136   MCFG_SPEAKER_STANDARD_MONO("mono")
2194   MCFG_SOUND_ADD(MOS6851_TAG, SID6581, VIC6567_CLOCK)
2195   MCFG_SOUND_CONFIG(sid_intf)
2137   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6567_CLOCK)
2138   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, p500_state, sid_potx_r), DEVREAD8(DEVICE_SELF, p500_state, sid_poty_r))
21962139   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
21972140
21982141   // devices
r20984r20985
22012144   MCFG_TPI6525_ADD(MOS6525_1_TAG, p500_tpi1_intf)
22022145   MCFG_TPI6525_ADD(MOS6525_2_TAG, p500_tpi2_intf)
22032146   MCFG_MOS6551_ADD(MOS6551A_TAG, XTAL_1_8432MHz, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w))
2204   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6567_CLOCK, 60, cia_intf)
2147   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6567_CLOCK, 60, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
2148   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2149   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
2150   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pb_r), DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w))
22052151   MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w))
22062152   MCFG_DS75161A_ADD(DS75161A_TAG, ds75161a_intf)
2207   MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050")
2153   MCFG_CBM_IEEE488_ADD("c8050")
2154   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w))
22082155   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w))
22092156   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
22102157   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w))
r20984r20985
22392186   MCFG_QUANTUM_PERFECT_CPU(M6509_TAG)
22402187
22412188   // video hardware
2242   MCFG_MOS6569_ADD(MOS6569_TAG, SCREEN_TAG, VIC6569_CLOCK, vic_intf, vic_videoram_map, vic_colorram_map)
2189   MCFG_MOS6569_ADD(MOS6569_TAG, SCREEN_TAG, VIC6569_CLOCK, vic_videoram_map, vic_colorram_map, DEVWRITELINE(DEVICE_SELF, p500_state, vic_irq_w))
22432190
22442191   // sound hardware
22452192   MCFG_SPEAKER_STANDARD_MONO("mono")
2246   MCFG_SOUND_ADD(MOS6851_TAG, SID6581, VIC6569_CLOCK)
2247   MCFG_SOUND_CONFIG(sid_intf)
2193   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, VIC6569_CLOCK)
2194   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, p500_state, sid_potx_r), DEVREAD8(DEVICE_SELF, p500_state, sid_poty_r))
22482195   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
22492196
22502197   // devices
r20984r20985
22532200   MCFG_TPI6525_ADD(MOS6525_1_TAG, p500_tpi1_intf)
22542201   MCFG_TPI6525_ADD(MOS6525_2_TAG, p500_tpi2_intf)
22552202   MCFG_MOS6551_ADD(MOS6551A_TAG, XTAL_1_8432MHz, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w))
2256   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6569_CLOCK, 50, cia_intf)
2203   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
2204   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2205   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
2206   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pb_r), DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w))
22572207   MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w))
22582208   MCFG_DS75161A_ADD(DS75161A_TAG, ds75161a_intf)
2259   MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050")
2209   MCFG_CBM_IEEE488_ADD("c8050")
2210   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w))
22602211   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w))
22612212   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
22622213   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w))
r20984r20985
23032254
23042255   // sound hardware
23052256   MCFG_SPEAKER_STANDARD_MONO("mono")
2306   MCFG_SOUND_ADD(MOS6851_TAG, SID6581, XTAL_18MHz/9)
2307   MCFG_SOUND_CONFIG(sid_intf)
2257   MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_18MHz/9)
2258   MCFG_MOS6581_POTXY_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, sid_potx_r), DEVREAD8(DEVICE_SELF, cbm2_state, sid_poty_r))
23082259   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
23092260
23102261   // devices
r20984r20985
23122263   MCFG_TPI6525_ADD(MOS6525_1_TAG, tpi1_intf)
23132264   MCFG_TPI6525_ADD(MOS6525_2_TAG, tpi2_intf)
23142265   MCFG_MOS6551_ADD(MOS6551A_TAG, XTAL_1_8432MHz, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w))
2315   MCFG_MOS6526_ADD(MOS6526_TAG, XTAL_18MHz/9, 60, cia_intf)
2266   MCFG_MOS6526_ADD(MOS6526_TAG, XTAL_18MHz/9, 60, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
2267   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2268   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
2269   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pb_r), DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w))
23162270   MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w))
23172271   MCFG_DS75161A_ADD(DS75161A_TAG, ds75161a_intf)
2318   MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050")
2272   MCFG_CBM_IEEE488_ADD("c8050")
2273   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w))
23192274   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w))
23202275   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
23212276   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL, NULL)
r20984r20985
23582313   MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_pal)
23592314
23602315   MCFG_DEVICE_REMOVE(MOS6526_TAG)
2361   MCFG_MOS6526_ADD(MOS6526_TAG, XTAL_18MHz/9, 50, cia_intf)
2316   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
2317   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2318   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
2319   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pb_r), DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w))
23622320MACHINE_CONFIG_END
23632321
23642322
r20984r20985
24212379
24222380   MCFG_PIC8259_ADD(EXT_I8259A_TAG, ext_pic_intf)
24232381   MCFG_TPI6525_ADD(EXT_MOS6525_TAG, ext_tpi_intf)
2424   MCFG_MOS6526_ADD(EXT_MOS6526_TAG, XTAL_18MHz/9, 50, ext_cia_intf)
2382   MCFG_MOS6526_ADD(EXT_MOS6526_TAG, XTAL_18MHz/9, 60, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i3_w))
2383   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2384   //MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(EXT_MOS6525_TAG, tpi6525_porta_r), NULL)
2385   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, ext_cia_pb_r), DEVWRITE8(DEVICE_SELF, cbm2_state, ext_cia_pb_w), NULL)
24252386MACHINE_CONFIG_END
24262387
24272388
r20984r20985
24372398   MCFG_TPI6525_ADD(MOS6525_2_TAG, hp_tpi2_intf)
24382399
24392400   MCFG_DEVICE_REMOVE(MOS6526_TAG)
2440   MCFG_MOS6526_ADD(MOS6526_TAG, XTAL_18MHz/9, 50, cia_intf)
2401   MCFG_MOS6526_ADD(EXT_MOS6526_TAG, XTAL_18MHz/9, 50, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i3_w))
2402   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2403   //MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(EXT_MOS6525_TAG, tpi6525_porta_r), NULL)
2404   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, ext_cia_pb_r), DEVWRITE8(DEVICE_SELF, cbm2_state, ext_cia_pb_w), NULL)
24412405MACHINE_CONFIG_END
24422406
24432407
r20984r20985
24722436
24732437   MCFG_PIC8259_ADD(EXT_I8259A_TAG, ext_pic_intf)
24742438   MCFG_TPI6525_ADD(EXT_MOS6525_TAG, ext_tpi_intf)
2475   MCFG_MOS6526_ADD(EXT_MOS6526_TAG, XTAL_18MHz/9, 60, ext_cia_intf)
2439   MCFG_MOS6526_ADD(EXT_MOS6526_TAG, XTAL_18MHz/9, 50, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i3_w))
2440   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
2441   //MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(EXT_MOS6525_TAG, tpi6525_porta_r), NULL)
2442   MCFG_MOS6526_PORT_B_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, ext_cia_pb_r), DEVWRITE8(DEVICE_SELF, cbm2_state, ext_cia_pb_w), NULL)
24762443MACHINE_CONFIG_END
24772444
24782445
trunk/src/mess/drivers/vixen.c
r20984r20985
698698   update_interrupt();
699699}
700700
701static IEEE488_INTERFACE( ieee488_intf )
702{
703   DEVCB_NULL,
704   DEVCB_NULL,
705   DEVCB_NULL,
706   DEVCB_NULL,
707   DEVCB_NULL,
708   DEVCB_DRIVER_LINE_MEMBER(vixen_state, srq_w),
709   DEVCB_DRIVER_LINE_MEMBER(vixen_state, atn_w),
710   DEVCB_NULL
711};
712
713701static SLOT_INTERFACE_START( vixen_floppies )
714702   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
715703SLOT_INTERFACE_END
r20984r20985
831819   MCFG_FD1797x_ADD(FDC1797_TAG, XTAL_23_9616MHz/24)
832820   MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":0", vixen_floppies, "525dd", NULL, floppy_image_device::default_floppy_formats)
833821   MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":1", vixen_floppies, "525dd", NULL, floppy_image_device::default_floppy_formats)
834   MCFG_IEEE488_BUS_ADD(ieee488_intf)
822   MCFG_IEEE488_BUS_ADD()
823   MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(DEVICE_SELF, vixen_state, srq_w))
824   MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(DEVICE_SELF, vixen_state, atn_w))
835825
836826   /* software lists */
837827   MCFG_SOFTWARE_LIST_ADD("disk_list", "vixen")
trunk/src/mess/mess.mak
r20984r20985
238238SOUNDS += LMC1992
239239SOUNDS += AWACS
240240SOUNDS += T6721A
241SOUNDS += MOS7360
241242
242243#-------------------------------------------------
243244# this is the list of driver libraries that
r20984r20985
914915   $(MESS_MACHINE)/vic1111.o   \
915916   $(MESS_MACHINE)/vic1112.o   \
916917   $(MESS_MACHINE)/vic1210.o   \
917   $(MESS_AUDIO)/mos7360.o     \
918918   $(MESS_DRIVERS)/plus4.o     \
919919   $(MESS_MACHINE)/plus4exp.o  \
920920   $(MESS_MACHINE)/plus4user.o \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team