Previous 15994 Revisions Next

r9647 Tuesday 23rd November, 2010 at 13:07:25 UTC by Curt Coder
[TANDY2K] Video WIP.
[src/mess]mess.mak
[src/mess/drivers]tandy2k.c
[src/mess/includes]tandy2k.h
[src/mess/video]crt9021.c* crt9021.h*

src/mess/video/crt9021.c
r0r9647
1/**********************************************************************
2
3    SMC CRT9021 Video Attributes Controller (VAC) 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 "crt9021.h"
12
13
14
15//**************************************************************************
16//   MACROS / CONSTANTS
17//**************************************************************************
18
19#define LOG 1
20
21
22
23//**************************************************************************
24//  GLOBAL VARIABLES
25//**************************************************************************
26
27// devices
28const device_type CRT9021 = crt9021_device_config::static_alloc_device_config;
29
30
31
32//**************************************************************************
33//  DEVICE CONFIGURATION
34//**************************************************************************
35
36//-------------------------------------------------
37//  crt9021_device_config - constructor
38//-------------------------------------------------
39
40crt9021_device_config::crt9021_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
41   : device_config(mconfig, static_alloc_device_config, "SMC CRT9021", tag, owner, clock)
42{
43}
44
45
46//-------------------------------------------------
47//  static_alloc_device_config - allocate a new
48//  configuration object
49//-------------------------------------------------
50
51device_config *crt9021_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
52{
53   return global_alloc(crt9021_device_config(mconfig, tag, owner, clock));
54}
55
56
57//-------------------------------------------------
58//  alloc_device - allocate a new device object
59//-------------------------------------------------
60
61device_t *crt9021_device_config::alloc_device(running_machine &machine) const
62{
63   return auto_alloc(&machine, crt9021_device(machine, *this));
64}
65
66
67//-------------------------------------------------
68//  device_config_complete - perform any
69//  operations now that the configuration is
70//  complete
71//-------------------------------------------------
72
73void crt9021_device_config::device_config_complete()
74{
75   // inherit a copy of the static data
76   const crt9021_interface *intf = reinterpret_cast<const crt9021_interface *>(static_config());
77   if (intf != NULL)
78      *static_cast<crt9021_interface *>(this) = *intf;
79
80   // or initialize to defaults if none provided
81   else
82   {
83      memset(&out_ld_sh_func, 0, sizeof(out_ld_sh_func));
84      memset(&in_data_func, 0, sizeof(in_data_func));
85      memset(&in_attr_func, 0, sizeof(in_attr_func));
86      memset(&in_atten_func, 0, sizeof(in_atten_func));
87   }
88}
89
90
91
92//**************************************************************************
93//  INLINE HELPERS
94//**************************************************************************
95
96
97
98//**************************************************************************
99//  LIVE DEVICE
100//**************************************************************************
101
102//-------------------------------------------------
103//  crt9021_device - constructor
104//-------------------------------------------------
105
106crt9021_device::crt9021_device(running_machine &_machine, const crt9021_device_config &config)
107    : device_t(_machine, config),
108      m_config(config)
109{
110}
111
112
113//-------------------------------------------------
114//  device_start - device-specific startup
115//-------------------------------------------------
116
117void crt9021_device::device_start()
118{
119   // allocate timers
120
121   // resolve callbacks
122   devcb_resolve_write_line(&m_out_ld_sh_func, &m_config.out_ld_sh_func, this);
123   devcb_resolve_read8(&m_in_data_func, &m_config.in_data_func, this);
124   devcb_resolve_read8(&m_in_attr_func, &m_config.in_attr_func, this);
125   devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this);
126
127   // get the screen device
128   m_screen = machine->device<screen_device>(m_config.screen_tag);
129   assert(m_screen != NULL);
130
131   // register for state saving
132   state_save_register_device_item(this, 0, m_sl);
133}
134
135
136//-------------------------------------------------
137//  device_clock_changed - handle clock change
138//-------------------------------------------------
139
140void crt9021_device::device_clock_changed()
141{
142}
143
144
145//-------------------------------------------------
146//  device_timer - handle timer events
147//-------------------------------------------------
148
149void crt9021_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
150{
151}
152
153
154//-------------------------------------------------
155//  slg_w -
156//-------------------------------------------------
157
158WRITE_LINE_MEMBER( crt9021_device::slg_w )
159{
160}
161
162
163//-------------------------------------------------
164//  sld_w -
165//-------------------------------------------------
166
167WRITE_LINE_MEMBER( crt9021_device::sld_w )
168{
169}
170
171
172//-------------------------------------------------
173//  cursor_w -
174//-------------------------------------------------
175
176WRITE_LINE_MEMBER( crt9021_device::cursor_w )
177{
178}
179
180
181//-------------------------------------------------
182//  retbl_w -
183//-------------------------------------------------
184
185WRITE_LINE_MEMBER( crt9021_device::retbl_w )
186{
187}
188
189
190//-------------------------------------------------
191//  vsync_w -
192//-------------------------------------------------
193
194WRITE_LINE_MEMBER( crt9021_device::vsync_w )
195{
196}
197
198
199//-------------------------------------------------
200//  update_screen - update screen
201//-------------------------------------------------
202
203void crt9021_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
204{
205}
src/mess/video/crt9021.h
r0r9647
1/**********************************************************************
2
3    SMC CRT9021 Video Attributes Controller (VAC) emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                    D0   1 |*    \_/     | 28  D1
11                   MS0   2 |             | 27  D2
12                   MS1   3 |             | 26  D3
13                 REVID   4 |             | 25  D4
14                 CHABL   5 |             | 24  D5
15                 BLINK   6 |             | 23  D6
16                 INTIN   7 |   CRT9021   | 22  D7
17                   Vcc   8 |             | 21  _VSYNC
18                 ATTEN   9 |             | 20  GND
19                INTOUT  10 |             | 19  SL0/SLD
20                CURSOR  11 |             | 18  SL1/_SLG
21                 RETBL  12 |             | 17  SL2/BLC
22                _LD/SH  13 |             | 16  SL3/BKC
23                 VIDEO  14 |_____________| 15  VDC
24
25**********************************************************************/
26
27#pragma once
28
29#ifndef __CRT9021__
30#define __CRT9021__
31
32#include "emu.h"
33
34
35
36//**************************************************************************
37//   MACROS / CONSTANTS
38//**************************************************************************
39
40
41
42
43//**************************************************************************
44//  INTERFACE CONFIGURATION MACROS
45//**************************************************************************
46
47#define MDRV_CRT9021_ADD(_tag, _clock, _config) \
48   MDRV_DEVICE_ADD(_tag, CRT9021, _clock) \
49   MDRV_DEVICE_CONFIG(_config)
50
51
52#define CRT9021_INTERFACE(name) \
53   const crt9021_interface (name) =
54
55
56
57//**************************************************************************
58//   TYPE DEFINITIONS
59//**************************************************************************
60
61
62// ======================> crt9021_interface
63
64struct crt9021_interface
65{
66   const char *screen_tag;      /* screen we are acting on */
67
68   devcb_write_line      out_ld_sh_func;
69
70   devcb_read8            in_data_func;
71   devcb_read8            in_attr_func;
72
73   devcb_read_line         in_atten_func;
74};
75
76
77
78// ======================> crt9021_device_config
79
80class crt9021_device_config :   public device_config,
81                                public crt9021_interface
82{
83    friend class crt9021_device;
84
85    // construction/destruction
86    crt9021_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
87
88public:
89    // allocators
90    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
91    virtual device_t *alloc_device(running_machine &machine) const;
92
93protected:
94   // device_config overrides
95   virtual void device_config_complete();
96};
97
98
99
100// ======================> crt9021_device
101
102class crt9021_device :   public device_t
103{
104    friend class crt9021_device_config;
105
106    // construction/destruction
107    crt9021_device(running_machine &_machine, const crt9021_device_config &_config);
108
109public:
110   DECLARE_WRITE_LINE_MEMBER( slg_w );
111   DECLARE_WRITE_LINE_MEMBER( sld_w );
112   DECLARE_WRITE_LINE_MEMBER( cursor_w );
113   DECLARE_WRITE_LINE_MEMBER( retbl_w );
114   DECLARE_WRITE_LINE_MEMBER( vsync_w );
115
116   void update_screen(bitmap_t *bitmap, const rectangle *cliprect);
117
118protected:
119    // device-level overrides
120    virtual void device_start();
121   virtual void device_clock_changed();
122   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
123
124private:
125   devcb_resolved_write_line      m_out_ld_sh_func;
126   devcb_resolved_read8         m_in_data_func;
127   devcb_resolved_read8         m_in_attr_func;
128   devcb_resolved_read_line      m_in_atten_func;
129
130   screen_device *m_screen;
131
132   int m_sl;
133
134   const crt9021_device_config &m_config;
135};
136
137
138// device type definition
139extern const device_type CRT9021;
140
141
142
143#endif
src/mess/includes/tandy2k.h
r9646r9647
2929        m_fdc(*this, I8272A_TAG),
3030        m_pic0(*this, I8259A_0_TAG),
3131        m_pic1(*this, I8259A_1_TAG),
32        m_vpac(*this, CRT9007_TAG),
3233        m_drb0(*this, CRT9212_0_TAG),
3334        m_drb1(*this, CRT9212_1_TAG),
34        m_vpac(*this, CRT9007_TAG),
35        m_vac(*this, CRT9021B_TAG),
3536        m_centronics(*this, CENTRONICS_TAG),
3637        m_speaker(*this, SPEAKER_TAG),
3738        m_ram(*this, "messram"),
r9646r9647
4849   required_device<crt9007_device> m_vpac;
4950   required_device<crt9212_device> m_drb0;
5051   required_device<crt9212_device> m_drb1;
51//   required_device<crt9201_device> m_vag;
52   required_device<crt9021_device> m_vac;
5253   required_device<running_device> m_centronics;
5354   required_device<running_device> m_speaker;
5455   required_device<running_device> m_ram;
r9646r9647
7677   DECLARE_WRITE_LINE_MEMBER( rfrqpulse_w );
7778   DECLARE_READ8_MEMBER( ppi_pb_r );
7879   DECLARE_WRITE8_MEMBER( ppi_pc_w );
80   DECLARE_WRITE_LINE_MEMBER( vpac_vlt_w );
81   DECLARE_WRITE_LINE_MEMBER( vpac_drb_w );
82   DECLARE_WRITE_LINE_MEMBER( vac_ld_ht_w );
7983
8084   /* DMA state */
8185   UINT8 m_dma_mux;
src/mess/mess.mak
r9646r9647
500500   $(MESS_VIDEO)/cdp1861.o      \
501501   $(MESS_VIDEO)/cdp1862.o      \
502502   $(MESS_VIDEO)/crt9007.o      \
503   $(MESS_VIDEO)/crt9021.o      \
503504   $(MESS_VIDEO)/crt9212.o      \
504505   $(MESS_VIDEO)/crtc6845.o   \
505506   $(MESS_VIDEO)/dl1416.o      \
src/mess/drivers/tandy2k.c
r9646r9647
3939#include "machine/upd765.h"
4040#include "sound/speaker.h"
4141#include "video/crt9007.h"
42#include "video/crt9021.h"
4243#include "video/crt9212.h"
4344#include "includes/tandy2k.h"
4445
r9646r9647
207208   if (m_clkspd != BIT(data, 5))
208209   {
209210      m_vpac->set_unscaled_clock(BIT(data, 5) ? XTAL_16MHz*28/16 : XTAL_16MHz*28/20);
211      m_vac->set_unscaled_clock(BIT(data, 5) ? XTAL_16MHz*28/16 : XTAL_16MHz*28/20);
210212      m_clkspd = BIT(data, 5);
211213   }
212214
r9646r9647
477479{
478480   if (m_vidouts)
479481   {
480      //m_vag->update_screen(&bitmap, &cliprect);
482      m_vac->update_screen(&bitmap, &cliprect);
481483   }
482484
483485   return 0;
r9646r9647
507509   }
508510}
509511*/
512   
513WRITE_LINE_MEMBER( tandy2k_state::vpac_vlt_w )
514{
515   m_drb0->clrcnt_w(state);
516   m_drb1->clrcnt_w(state);
517}
518
519WRITE_LINE_MEMBER( tandy2k_state::vpac_drb_w )
520{
521   m_drb0->tog_w(state);
522   m_drb1->tog_w(state);
523}
524
510525static CRT9007_INTERFACE( vpac_intf )
511526{
512527   SCREEN_TAG,
513528   10,
514529   DEVCB_DEVICE_LINE(I8259A_1_TAG, pic8259_ir1_w),
515530   DEVCB_NULL,   // DMAR      80186 HOLD
516   DEVCB_NULL,   // VS      CRT9021B U14 VSYNC
531   DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, vsync_w), // VS
517532   DEVCB_NULL,   // HS
518   DEVCB_NULL,   // VLT      CRT9212 U55/U15 _CLRCNT
519   DEVCB_NULL,   // CURS      CRT9021B U14 CURSOR
520   DEVCB_NULL,   // DRB      CRT9212 U55/U15 TOG
521   DEVCB_NULL,   // SLG      CRT9021B U14 _SLG
522   DEVCB_NULL   // SLD      CRT9021B U14 SLD
533   DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vpac_vlt_w), // VLT
534   DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, cursor_w), // CURS
535   DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vpac_drb_w), // DRB
536   DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, slg_w), // SLG
537   DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, sld_w) // SLD
523538};
524539
525540static CRT9212_INTERFACE( drb0_intf )
526541{
527542   DEVCB_NULL, // ROF
528543   DEVCB_NULL, // WOF
529   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r),
530   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r),
531   DEVCB_LINE_VCC
544   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), // REN
545   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), // WEN
546   DEVCB_LINE_VCC // WEN2
532547};
533548
534549static CRT9212_INTERFACE( drb1_intf )
535550{
536551   DEVCB_NULL, // ROF
537552   DEVCB_NULL, // WOF
538   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r),
539   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r),
540   DEVCB_LINE_VCC
553   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, vlt_r), // REN
554   DEVCB_DEVICE_LINE_MEMBER(CRT9007_TAG, crt9007_device, wben_r), // WEN
555   DEVCB_LINE_VCC // WEN2
541556};
542557
558WRITE_LINE_MEMBER( tandy2k_state::vac_ld_ht_w )
559{
560   for (int state = 0; state < 2; state++)
561   {
562      m_drb0->rclk_w(state);
563      m_drb0->wclk_w(state);
564      m_drb1->rclk_w(state);
565      m_drb1->wclk_w(state);
566   }
567}
568
569static CRT9021_INTERFACE( vac_intf )
570{
571   SCREEN_TAG,
572   DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vac_ld_ht_w), // _LD/HT
573   DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data
574   DEVCB_DEVICE_MEMBER(CRT9212_1_TAG, crt9212_device, read), // attributes
575   DEVCB_LINE_VCC // ATTEN
576};
577
543578/* Intel 8251A Interface */
544579
545580static WRITE_LINE_DEVICE_HANDLER( rxrdy_w )
r9646r9647
837872   MDRV_CRT9007_ADD(CRT9007_TAG, XTAL_16MHz*28/16, vpac_intf, vpac_mem)
838873   MDRV_CRT9212_ADD(CRT9212_0_TAG, drb0_intf)
839874   MDRV_CRT9212_ADD(CRT9212_1_TAG, drb1_intf)
875   MDRV_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16, vac_intf)
840876
841877   /* sound hardware */
842878   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team