Previous 15994 Revisions Next

r9017 Thursday 2nd September, 2010 at 12:04:08 UTC by Angelo Salese
[PASOPIA7]: Implemented video mixed mode (accessible thru screen 2 cmd)
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r9016r9017
113113   keyb_press(KEYCODE_COMMA, ',');
114114   keyb_shift_press(KEYCODE_COMMA, ';');
115115   keyb_press(KEYCODE_MINUS_PAD, '-');
116
116   keyb_press(KEYCODE_PLUS_PAD, '+');
117117}
118118
119static VIDEO_UPDATE( paso7 )
119static void draw_cg4_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int width)
120120{
121   static UINT8 *vram = memory_region(screen->machine, "vram");
121   static UINT8 *vram = memory_region(machine, "vram");
122122   int x,y,xi,yi;
123123   int count;
124   int width;
125124
126   bitmap_fill(bitmap, cliprect, screen->machine->pens[0]);
127
128   fake_keyboard_data(screen->machine);
129
130   width = x_width ? 80 : 40;
131
132125   for(yi=0;yi<8;yi++)
133126   {
134127      count = yi;
r9016r9017
146139
147140               color =  pen_g<<2 | pen_r<<1 | pen_b<<0;
148141
149               *BITMAP_ADDR16(bitmap, y+yi, x+xi) = screen->machine->pens[color+0x20];
142               *BITMAP_ADDR16(bitmap, y+yi, x+xi) = machine->pens[color+0x20];
150143            }
151144            count+=8;
152145         }
153146      }
154147   }
148}
155149
150static void draw_tv_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int width)
151{
152   static UINT8 *vram = memory_region(machine, "vram");
153   int x,y/*,xi,yi*/;
154   int count;
155
156156   count = 0x0000;
157157
158158   for(y=0;y<25;y++)
r9016r9017
160160      for(x=0;x<width;x++)
161161      {
162162         int tile = vram[count+0x8000];
163         int color = vram[count+0xc000];
163         int attr = vram[count+0xc000];
164         int color = attr & 7;
164165
165         drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8,0);
166         drawgfx_transpen(bitmap,cliprect,machine->gfx[0],tile,color & 7,0,0,x*8,y*8,0);
166167
167168         // draw cursor
168169         if(cursor_addr*8 == count)
r9016r9017
174175            {
175176               case 0x00: cursor_on = 1; break; //always on
176177               case 0x20: cursor_on = 0; break; //always off
177               case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
178               case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
178               case 0x40: if(machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
179               case 0x60: if(machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
179180            }
180181
181182            if(cursor_on)
r9016r9017
184185               {
185186                  for(xc=0;xc<8;xc++)
186187                  {
187                     *BITMAP_ADDR16(bitmap, y*8-yc+7, x*8+xc) = screen->machine->pens[0x27];
188                     *BITMAP_ADDR16(bitmap, y*8-yc+7, x*8+xc) = machine->pens[0x27];
188189                  }
189190               }
190191            }
r9016r9017
192193         count+=8;
193194      }
194195   }
196}
195197
198static void draw_mixed_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int width)
199{
200   static UINT8 *vram = memory_region(machine, "vram");
201   static UINT8 *gfx_data = memory_region(machine,"font");
202   int x,y,xi,yi;
203   int count;
204
205   count = 0x0000;
206
207   for(y=0;y<25;y++)
208   {
209      for(x=0;x<width;x++)
210      {
211         int tile = vram[count+0x8000];
212
213         for(yi=0;yi<8;yi++)
214         {
215            int attr = vram[count+0xc000+yi];
216
217            if(attr & 0x80)
218            {
219               for(xi=0;xi<8;xi++)
220               {
221                  int pen,pen_b,pen_r,pen_g;
222
223                  pen_b = (vram[count+yi+0x0000]>>(7-xi)) & 1;
224                  pen_r = (vram[count+yi+0x4000]>>(7-xi)) & 1;
225                  pen_g = (vram[count+yi+0x8000]>>(7-xi)) & 1;
226
227                  pen =  pen_g<<2 | pen_r<<1 | pen_b<<0;
228
229                  *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = machine->pens[pen+0x20];
230               }
231            }
232            else
233            {
234               int color = attr & 7;
235
236               for(xi=0;xi<8;xi++)
237               {
238                  int pen;
239                  pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0;
240
241                  *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = machine->pens[pen+0x20];
242               }
243               //drawgfx_transpen(bitmap,cliprect,machine->gfx[0],tile,color & 7,0,0,x*8,y*8,0);
244            }
245         }
246
247         // draw cursor
248         if(cursor_addr*8 == count)
249         {
250            int xc,yc,cursor_on;
251
252            cursor_on = 0;
253            switch(cursor_raster & 0x60)
254            {
255               case 0x00: cursor_on = 1; break; //always on
256               case 0x20: cursor_on = 0; break; //always off
257               case 0x40: if(machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
258               case 0x60: if(machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
259            }
260
261            if(cursor_on)
262            {
263               for(yc=0;yc<(8-(cursor_raster & 7));yc++)
264               {
265                  for(xc=0;xc<8;xc++)
266                  {
267                     *BITMAP_ADDR16(bitmap, y*8-yc+7, x*8+xc) = machine->pens[0x27];
268                  }
269               }
270            }
271         }
272
273         count+=8;
274      }
275   }
276}
277
278static VIDEO_UPDATE( paso7 )
279{
280   int width;
281
282   bitmap_fill(bitmap, cliprect, screen->machine->pens[0]);
283
284   fake_keyboard_data(screen->machine);
285
286   width = x_width ? 80 : 40;
287
288   if(gfx_mode)
289      draw_mixed_screen(screen->machine,bitmap,cliprect,width);
290   else
291   {
292      draw_cg4_screen(screen->machine,bitmap,cliprect,width);
293      draw_tv_screen(screen->machine,bitmap,cliprect,width);
294   }
295
196296    return 0;
197297}
198298
r9016r9017
578678static WRITE8_DEVICE_HANDLER( video_attr_w )
579679{
580680   //printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70);
581   attr_data = data & 0xf;
681   attr_data = (data & 0x7) | ((data & 0x8)<<4);
582682}
583683
584684//#include "debugger.h"

Previous 15994 Revisions Next


© 1998-2018 The MESS Team