Previous 15994 Revisions Next

r9663 Thursday 25th November, 2010 at 11:29:13 UTC by Curt Coder
[TANDY2K] Video WIP.
[src/mess/drivers]tandy2k.c
[src/mess/video]crt9021.c crt9021.h

src/mess/video/crt9021.c
r9662r9663
77
88**********************************************************************/
99
10/*
11
12   TODO:
13
14   - attributes
15      - reverse video
16      - character blank
17      - character blink
18      - underline
19      - full/half intensity
20   - operation modes
21      - wide graphics
22      - thin graphics
23      - character mode w/o underline
24      - character mode w/underline
25   - double height characters
26   - double width characters
27   - parallel scan line
28   - serial scan line
29   - cursor
30      - underline
31      - blinking underline
32      - reverse video
33      - blinking reverse video
34   - programmable character blink rate (75/25 duty)
35   - programmable cursor blink rate (50/50 duty)
36   - data/attribute latches
37
38*/
39
1040#include "emu.h"
1141#include "crt9021.h"
1242
r9662r9663
1949#define LOG 1
2050
2151
52// attributes
53static const int ATTRIBUTE_REVID   = 0x80;
54static const int ATTRIBUTE_INT      = 0x40;
55static const int ATTRIBUTE_BLINK   = 0x20;
56static const int ATTRIBUTE_MS1      = 0x10;
57static const int ATTRIBUTE_MS0      = 0x08;
58static const int ATTRIBUTE_CHABL   = 0x04;
59static const int ATTRIBUTE_BKC      = 0x02;
60static const int ATTRIBUTE_BLC      = 0x01;
2261
62
63
2364//**************************************************************************
2465//  GLOBAL VARIABLES
2566//**************************************************************************
r9662r9663
80121   // or initialize to defaults if none provided
81122   else
82123   {
83      memset(&out_ld_sh_func, 0, sizeof(out_ld_sh_func));
84124      memset(&in_data_func, 0, sizeof(in_data_func));
85125      memset(&in_attr_func, 0, sizeof(in_attr_func));
86126      memset(&in_atten_func, 0, sizeof(in_atten_func));
r9662r9663
119159   // allocate timers
120160
121161   // resolve callbacks
122   devcb_resolve_write_line(&m_out_ld_sh_func, &m_config.out_ld_sh_func, this);
123162   devcb_resolve_read8(&m_in_data_func, &m_config.in_data_func, this);
124163   devcb_resolve_read8(&m_in_attr_func, &m_config.in_attr_func, this);
125164   devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this);
r9662r9663
129168   assert(m_screen != NULL);
130169
131170   // register for state saving
132   state_save_register_device_item(this, 0, m_sl);
171   state_save_register_device_item(this, 0, m_slg);
172   state_save_register_device_item(this, 0, m_sld);
173   state_save_register_device_item(this, 0, m_cursor);
174   state_save_register_device_item(this, 0, m_retbl);
175   state_save_register_device_item(this, 0, m_vsync);
133176}
134177
135178
r9662r9663
152195
153196
154197//-------------------------------------------------
155//  slg_w -
198//  slg_w - scan line gate
156199//-------------------------------------------------
157200
158201WRITE_LINE_MEMBER( crt9021_device::slg_w )
159202{
203   if (LOG) logerror("CRT9021 '%s' SLG: %u\n", tag(), state);
204
205   m_slg = state;
160206}
161207
162208
163209//-------------------------------------------------
164//  sld_w -
210//  sld_w - scan line data
165211//-------------------------------------------------
166212
167213WRITE_LINE_MEMBER( crt9021_device::sld_w )
168214{
215   if (LOG) logerror("CRT9021 '%s' SLG: %u\n", tag(), state);
216
217   if (!m_slg)
218   {
219      m_sld <<= 1;
220      m_sld |= state;
221   }
169222}
170223
171224
172225//-------------------------------------------------
173//  cursor_w -
226//  cursor_w - cursor
174227//-------------------------------------------------
175228
176229WRITE_LINE_MEMBER( crt9021_device::cursor_w )
177230{
231   if (LOG) logerror("CRT9021 '%s' CURSOR: %u\n", tag(), state);
232
233   m_cursor = state;
178234}
179235
180236
181237//-------------------------------------------------
182//  retbl_w -
238//  retbl_w - retrace blank
183239//-------------------------------------------------
184240
185241WRITE_LINE_MEMBER( crt9021_device::retbl_w )
186242{
243   if (LOG) logerror("CRT9021 '%s' RETBL: %u\n", tag(), state);
244
245   m_retbl = state;
187246}
188247
189248
190249//-------------------------------------------------
191//  vsync_w -
250//  vsync_w - vertical sync
192251//-------------------------------------------------
193252
194253WRITE_LINE_MEMBER( crt9021_device::vsync_w )
195254{
255   if (LOG) logerror("CRT9021 '%s' VSYNC: %u\n", tag(), state);
256
257   m_vsync = state;
196258}
197259
198260
src/mess/video/crt9021.h
r9662r9663
1414                 CHABL   5 |             | 24  D5
1515                 BLINK   6 |             | 23  D6
1616                 INTIN   7 |   CRT9021   | 22  D7
17                   Vcc   8 |             | 21  _VSYNC
17                   +5V   8 |             | 21  _VSYNC
1818                 ATTEN   9 |             | 20  GND
1919                INTOUT  10 |             | 19  SL0/SLD
2020                CURSOR  11 |             | 18  SL1/_SLG
r9662r9663
6565{
6666   const char *screen_tag;      /* screen we are acting on */
6767
68   devcb_write_line      out_ld_sh_func;
69
7068   devcb_read8            in_data_func;
7169   devcb_read8            in_attr_func;
7270
r9662r9663
122120   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
123121
124122private:
125   devcb_resolved_write_line      m_out_ld_sh_func;
126123   devcb_resolved_read8         m_in_data_func;
127124   devcb_resolved_read8         m_in_attr_func;
128125   devcb_resolved_read_line      m_in_atten_func;
129126
130127   screen_device *m_screen;
131128
132   int m_sl;
129   int m_slg;
130   int m_sld;
131   int m_cursor;
132   int m_retbl;
133   int m_vsync;
133134
134135   const crt9021_device_config &m_config;
135136};
src/mess/drivers/tandy2k.c
r9662r9663
204204   /* video access */
205205   m_vram_base = data & 0x1f;
206206
207   /* video clock speed */
208   if (m_clkspd != BIT(data, 5))
209   {
210      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);
212      m_clkspd = BIT(data, 5);
213   }
214
215207   /* dots per char */
208   int character_width = BIT(data, 6) ? 8 : 10;
209
216210   if (m_clkcnt != BIT(data, 6))
217211   {
218      m_vpac->set_hpixels_per_column(BIT(data, 6) ? 8 : 10);
212      m_vpac->set_hpixels_per_column(character_width);
219213      m_clkcnt = BIT(data, 6);
220214   }
221215
216   /* video clock speed */
217   if (m_clkspd != BIT(data, 5))
218   {
219      float pixel_clock = BIT(data, 5) ? XTAL_16MHz*28/16 : XTAL_16MHz*28/20;
220      float character_clock = pixel_clock / character_width;
221
222      m_vpac->set_unscaled_clock(pixel_clock);
223      m_vac->set_unscaled_clock(character_clock);
224      m_clkspd = BIT(data, 5);
225   }
226
222227   /* video source select */
223228   m_vidouts = BIT(data, 7);
224229
r9662r9663
555560   DEVCB_LINE_VCC // WEN2
556561};
557562
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
569563static CRT9021_INTERFACE( vac_intf )
570564{
571565   SCREEN_TAG,
572   DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, vac_ld_ht_w), // _LD/HT
573566   DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data
574567   DEVCB_DEVICE_MEMBER(CRT9212_1_TAG, crt9212_device, read), // attributes
575568   DEVCB_LINE_VCC // ATTEN
r9662r9663
872865   MDRV_CRT9007_ADD(CRT9007_TAG, XTAL_16MHz*28/16, vpac_intf, vpac_mem)
873866   MDRV_CRT9212_ADD(CRT9212_0_TAG, drb0_intf)
874867   MDRV_CRT9212_ADD(CRT9212_1_TAG, drb1_intf)
875   MDRV_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16, vac_intf)
868   MDRV_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16/8, vac_intf)
876869
877870   /* sound hardware */
878871   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team