Previous 15994 Revisions Next

r4619 Sunday 3rd May, 2009 at 10:36:11 UTC by Miodrag Milanović
[VT100] Some updates of video code
[src/mess/drivers]vt100.c
[src/mess/video]vtvideo.c vtvideo.h

src/mess/video/vtvideo.c
r4618r4619
2929struct _vt_video_t
3030{
3131   devcb_resolved_read8      in_ram_func;
32   devcb_resolved_write8      clear_video_interrupt;
3233
3334   const device_config *screen;   /* screen */
3435   UINT8 *gfx;      /* content of char rom */
35   
36    int skip_lines;   
37    int height;
38    int width;
36       
3937    int lba7;
38   
39    // dc012 attributes
40    UINT8 scroll_latch;
41    UINT8 blink_flip_flop;
42    UINT8 reverse_field;
43    UINT8 basic_attribute;
44    // dc011 attributes
45    UINT8 columns;
46    UINT8 height;
47    UINT8 skip_lines;   
48    UINT8 frequency;
49    UINT8 interlaced;
4050};
4151
4252/***************************************************************************
r4618r4619
7080
7181WRITE8_DEVICE_HANDLER( dc012_w )
7282{
73//   vt_video_t *vt = get_safe_token(device);
83   vt_video_t *vt = get_safe_token(device);
84       
85    if ((data & 0x08)==0) {
86      if ((data & 0x04)==0) {
87         // set lower part scroll
88         vt->scroll_latch = (vt->scroll_latch & 0x0c) | (data & 0x03);
89      } else {
90         // set higher part scroll
91         vt->scroll_latch = (vt->scroll_latch & 0x03) | ((data & 0x03) << 2);
92      }
93   } else {
94      switch( data & 0x0f) {
95         case 0x08:
96            // toggle blink flip flop
97            vt->blink_flip_flop = (vt->blink_flip_flop==0) ? 1 : 0;
98            break;
99         case 0x09:
100            // clear vertical frequency interrupt;
101            devcb_call_write8(&vt->clear_video_interrupt, 0, 0);
102            break;
103         case 0x0A:
104            // set reverse field on
105            vt->reverse_field = 1;
106            break;           
107         case 0x0B:
108            // set reverse field off
109            vt->reverse_field = 0;
110            break;
111         case 0x0C:
112            // set basic attribute to underline
113            vt->basic_attribute = 0;
114            vt->blink_flip_flop = 0;
115            break;
116         case 0x0D:
117            // set basic attribute to reverse video
118            vt->basic_attribute = 1;
119            vt->blink_flip_flop = 0;
120            break;
121         case 0x0E:
122         case 0x0F:
123            // reserved for future specification
124            vt->blink_flip_flop = 0;
125            break;
126      }
127   }
74128}
75129
76130
77131WRITE8_DEVICE_HANDLER( dc011_w )
78132{
79//   vt_video_t *vt = get_safe_token(device);
133   vt_video_t *vt = get_safe_token(device);
134   if (BIT(data,5)==0) {
135      if (BIT(data,4)==0) {
136         vt->columns = 80;
137      } else {
138         vt->columns = 132;
139      }
140      vt->interlaced = 1;
141   } else {
142      if (BIT(data,4)==0) {
143         vt->frequency = 60;
144         vt->skip_lines = 2;
145      } else {
146         vt->frequency = 50;
147         vt->skip_lines = 5;
148      }
149      vt->interlaced = 0;     
150   }
80151}
81152
82153WRITE8_DEVICE_HANDLER( vt_video_brightness_w )
r4618r4619
94165
95166   for (i = 0; i < 10; i++)
96167   {
97      if (i==0) j=15; else j=i-1;
168     
98169      switch(display_type) {
99170         case 0 : // bottom half, double height
100                line = vt->gfx[(code & 0x7f)*16 + (j >> 1)+5]; break;
171                j = (i >> 1)+5; break;
101172         case 1 : // top half, double height
102                 line = vt->gfx[(code & 0x7f)*16 + (j >> 1)]; break;
173                 j = (i >> 1); break;
103174         case 2 : // double width           
104175         case 3 : // normal
105                line = vt->gfx[(code & 0x7f)*16 + j]; break;
176                j = i;   break;
106177      }
178      // modify line since that is how it is stored in rom
179      if (j==0) j=15; else j=j-1;
107180     
181      line = vt->gfx[(code & 0x7f)*16 + j];
182     
108183      for (b = 0; b < 8; b++)
109184      {
110185         bit = ((line << b) & 0x80) ? 1 : 0;
r4618r4619
149224       if (code == 0x7f) {
150225          // end of line, fill empty till end of line
151226          if (line >= vt->skip_lines) {
152             for(x = xpos; x < ((display_type==2) ? (vt->width / 2) : vt->width); x++ )
227             for(x = xpos; x < ((display_type==2) ? (vt->columns / 2) : vt->columns); x++ )
153228            {
154229               vt_video_display_char(device,bitmap,code,x,ypos,scroll_region,display_type);
155230            }
r4618r4619
172247            vt_video_display_char(device,bitmap,code,xpos,ypos,scroll_region,display_type);
173248         }               
174249         xpos++;
175         if (xpos > vt->width) {
250         if (xpos > vt->columns) {
176251            line++;           
177252            xpos=0;
178253         }
r4618r4619
192267
193268   /* resolve callbacks */
194269   devcb_resolve_read8(&vt->in_ram_func, &intf->in_ram_func, device);
270   devcb_resolve_write8(&vt->clear_video_interrupt, &intf->clear_video_interrupt, device);   
195271
196272   /* get the screen device */
197273   vt->screen = devtag_get_device(device->machine, intf->screen_tag);
r4618r4619
220296   palette_set_color_rgb(device->machine, 0, 0x00, 0x00, 0x00); // black
221297   palette_set_color_rgb(device->machine, 1, 0xff, 0xff, 0xff); // white
222298
223   vt->skip_lines = 2; // for 60Hz
224   vt->width = 80;
225299   vt->height = 24;
226300   vt->lba7 = 0;
227301
228   // LBA7 is scan line frequency update
302   vt->scroll_latch = 0;
303    vt->blink_flip_flop = 0;
304    vt->reverse_field = 0;
305    vt->basic_attribute = 0;
306
307   vt->columns = 80;
308    vt->frequency = 60;
309    vt->interlaced = 1;
310   vt->skip_lines = 2; // for 60Hz
311    // LBA7 is scan line frequency update
229312   timer_pulse(device->machine, ATTOTIME_IN_NSEC(31778), (void *) device, 0, lba7_change);   
230313}
231314
src/mess/video/vtvideo.h
r4618r4619
3737
3838   /* this gets called for every memory read */
3939   devcb_read8         in_ram_func;
40   devcb_write8      clear_video_interrupt;
4041};
4142
4243/***************************************************************************
src/mess/drivers/vt100.c
r4618r4619
262262   UINT8 retVal = 0xc7 | (0x08 * vt100_keyboard_int) | (0x10 * vt100_receiver_int) | (0x20 * vt100_vertical_int);
263263   vt100_keyboard_int = 0;
264264   vt100_receiver_int = 0;
265   vt100_vertical_int = 0;
266265
267266   return retVal;
268267}
r4618r4619
291290   return vt100_ram[offset];
292291}
293292
293static WRITE8_DEVICE_HANDLER (vt100_clear_video_interrupt)
294{
295   vt100_vertical_int = 0;   
296}
297
294298const vt_video_interface vt100_video_interface = {
295299   "screen",
296300   "gfx1",
297   DEVCB_HANDLER(vt100_read_video_ram_r)
301   DEVCB_HANDLER(vt100_read_video_ram_r),
302   DEVCB_HANDLER(vt100_clear_video_interrupt)
298303};
299304
300305INTERRUPT_GEN( vt100_vertical_interrupt )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team