Previous 15994 Revisions Next

r1964 Wednesday 12th March, 2008 at 15:36:51 UTC by Dirk Best
[ASTROCDE] Updated to dynamically change the screen resolution instead of drawing pixels twice
[src/mess/drivers]astrocde.c
[src/mess/includes]astrocde.h
[src/mess/machine]astrocde.c
[src/mess/video]astrocde.c

src/mess/includes/astrocde.h
r1963r1964
88#define ASTROCDE_H_
99
1010
11#define XTAL_Y1  XTAL_14_31818MHz
12
13
1114/*----------- defined in machine/astrocde.c -----------*/
1215
1316WRITE8_HANDLER( astrocade_interrupt_enable_w );
src/mess/video/astrocde.c
r1963r1964
154154
155155WRITE8_HANDLER( astrocade_mode_w )
156156{
157   rectangle visarea;
157158   astrocade_mode = data & 0x01;
159
160   if (astrocade_mode)
161   {
162      /* high res mode */
163      visarea.min_x = 0;
164      visarea.max_x = 319;
165      visarea.min_y = 0;
166      visarea.max_y = 203;
167
168      video_screen_configure(0, 455, 268, &visarea, HZ_TO_ATTOSECONDS(XTAL_Y1/2) * 268 * 455);
169   }
170   else
171   {
172      /* low res mode */
173      visarea.min_x = 0;
174      visarea.max_x = 159;
175      visarea.min_y = 0;
176      visarea.max_y = 101;
177
178      video_screen_configure(0, 455, 134, &visarea, HZ_TO_ATTOSECONDS(XTAL_Y1/4) * 134 * 455);
179   }
158180}
159181
160182WRITE8_HANDLER ( astrocade_colour_register_w )
r1963r1964
334356VIDEO_UPDATE( astrocde )
335357{
336358   int line = video_screen_get_vpos(0);
359    int num_bytes = astrocade_mode ? 80 : 40;
360    int memloc = line * num_bytes;
361    int vblank_start = astrocade_mode ? VerticalBlank : VerticalBlank >> 1;
337362
338    int memloc;
339    int i,x,num_bytes;
340    int data,color;
363    int i;
341364
342   if (astrocade_mode == 0)
343   {
344      memloc = line/2 * 40;
345      num_bytes = 40;
346   }
347   else
348   {
349      num_bytes = 80;
350      memloc = line * 80;
351   }
365   LeftLineColour[line] = LeftColourCheck;
366   RightLineColour[line] = RightColourCheck;
352367
353   LeftLineColour[line]  = LeftColourCheck;
354   RightLineColour[line]  = RightColourCheck;
355
356   for(i=0;i<num_bytes;i++,memloc++)
368   for (i = 0; i < num_bytes; i++, memloc++)
357369   {
358      if (line < VerticalBlank)
370      int data, x;
371     
372      if (line < vblank_start)
359373         data = videoram[memloc];
360374      else
361375         data = BackgroundData;
362376
363      for (x=i*4+3; x>=i*4; x--)
377      for (x = i*4+3; x >= i*4; x--)
364378      {
365         color = data & 03;
379         int color = data & 03;
366380
367         if (i<ColourSplit)
381         if (i < ColourSplit)
368382            color += 4;
369383
370         if (astrocade_mode == 0)
371         {
372            *BITMAP_ADDR16(bitmap, line, 2*x+0) = machine->pens[Colour[color]];
373            *BITMAP_ADDR16(bitmap, line, 2*x+1) = machine->pens[Colour[color]];
374         }
375         else
376            *BITMAP_ADDR16(bitmap, line, x) = machine->pens[Colour[color]];
384         *BITMAP_ADDR16(bitmap, line, x) = machine->pens[Colour[color]];
377385
378386         data >>= 2;
379387      }
src/mess/machine/astrocde.c
r1963r1964
4949
5050   LOG(("Scanline interrupt set to %02x\n",data));
5151
52    NextScanInt = data;
52   /* in low res mode, bits 1-7 are used */
53    NextScanInt = machine->screen[0].height == 134 ? data >> 1 : data;
5354}
5455
5556
src/mess/drivers/astrocde.c
r1963r1964
4040#include "devices/cartslot.h"
4141
4242
43#define XTAL_Y1  XTAL_14_31818MHz
4443
45
4644/****************************************************************************
4745 * Bally Astrocade
4846 ****************************************************************************/
r1963r1964
233231
234232    /* video hardware */
235233   MDRV_SCREEN_ADD("main", RASTER)
236   MDRV_SCREEN_RAW_PARAMS(XTAL_Y1/3, 320, 0, 320, 256, 0, 204)
234   MDRV_SCREEN_RAW_PARAMS(XTAL_Y1/2, 455, 0, 320, 268, 0, 204)
237235   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
238236   MDRV_PALETTE_LENGTH(8*32)
239237   MDRV_PALETTE_INIT(astrocade)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team