Previous 15994 Revisions Next

r9271 Wednesday 29th September, 2010 at 01:58:10 UTC by Curt Coder
[VIDBRAIN] Implemented partial screen update and fixed X zoom.
[src/mess/drivers]vidbrain.c
[src/mess/includes]vidbrain.h
[src/mess/video]vidbrain.c

src/mess/video/vidbrain.c
r9270r9271
11/*
22
33    TODO:
4
4   
55   - X order
66   - freeze (light pen)
77   - screen size
88   - scanline based update
9   - partial updates to allow mid-screen zoom change
109
1110*/
1211
r9270r9271
6665   vidbrain_state *state = space->machine->driver_data<vidbrain_state>();
6766
6867   UINT8 data = 0xff;
68   int vpos = state->screen->vpos();
6969
70   if (vpos >= 262) vpos -= 262;
71
7072   switch (offset)
7173   {
7274   case REGISTER_X_FREEZE:
r9270r9271
9597
9698      */
9799
98      data = (state->field << 7) | (BIT(state->screen->vpos(), 8) << 1) | BIT(state->freeze_y, 8);
100      data = (state->field << 7) | (BIT(vpos, 8) << 1) | BIT(state->freeze_y, 8);
99101      if (LOG) logerror("Y-Freeze High %02x\n", data);
100102      break;
101103
102104   case REGISTER_CURRENT_Y_LOW:
103      data = state->screen->vpos() & 0xff;
105      data = vpos & 0xff;
104106      if (LOG) logerror("Current-Y Low %02x\n", data);
105107      break;
106108
r9270r9271
126128}
127129
128130/*-------------------------------------------------
131    do_partial_update - update screen
132-------------------------------------------------*/
133
134static void do_partial_update(vidbrain_state *state)
135{
136   int vpos = state->screen->vpos();
137   
138   if (LOG) logerror("Partial screen update at scanline %u\n", vpos);
139   
140   state->screen->update_partial(vpos);
141}
142
143/*-------------------------------------------------
129144    vidbrain_vlsi_w - video VLSI write
130145-------------------------------------------------*/
131146
147#define IS_CHANGED(_bit) \
148   ((state->cmd & _bit) != (data & _bit))
149
132150WRITE8_HANDLER( vidbrain_vlsi_w )
133151{
134152   vidbrain_state *state = space->machine->driver_data<vidbrain_state>();
r9270r9271
163181
164182      if (LOG) logerror("Final Modifier %02x\n", data);
165183
184      do_partial_update(state);
166185      state->fmod = data & 0x1f;
167186      break;
168187
r9270r9271
184203
185204      if (LOG) logerror("Background %02x\n", data);
186205
206      do_partial_update(state);
187207      state->bg = data & 0x1f;
188208      break;
189209
r9270r9271
205225
206226      if (LOG) logerror("Command %02x\n", data);
207227     
208      if (BIT(state->cmd, 7) != BIT(data, 7))
228      if (IS_CHANGED(COMMAND_YINT_H_O))
209229      {
210230         set_y_interrupt(state);
211231      }
212232
233      if (IS_CHANGED(COMMAND_A_B) || IS_CHANGED(COMMAND_Y_ZM) || IS_CHANGED(COMMAND_X_ZM))
234      {
235         do_partial_update(state);
236      }
237
213238      state->cmd = data;
214239      break;
215240
r9270r9271
276301    VIDEO_UPDATE( vidbrain )
277302-------------------------------------------------*/
278303
279#define RAM(_offset) state->vlsi_ram[_offset + i]
304#define RAM(_offset) \
305   state->vlsi_ram[_offset + i]
280306
307#define IS_VISIBLE(_y) \
308   ((_y >= cliprect->min_y) && (_y <= cliprect->max_y))
309
310#define DRAW_PIXEL(_scanline, _dot) \
311   if (IS_VISIBLE(_scanline)) *BITMAP_ADDR16(bitmap, (_scanline), _dot) = pixel;
312
281313static VIDEO_UPDATE( vidbrain )
282314{
283315   vidbrain_state *state = screen->machine->driver_data<vidbrain_state>();
r9270r9271
323355
324356               if (state->cmd & COMMAND_Y_ZM)
325357               {
358                  int scanline = y + (sy * 2);
359
326360                  if (state->cmd & COMMAND_X_ZM)
327361                  {
328                     *BITMAP_ADDR16(bitmap, y + (sy * 2), x + (sx * 8) + (bit * 2)) = pixel;
329                     *BITMAP_ADDR16(bitmap, y + (sy * 2) + 1, x + (sx * 8) + (bit * 2)) = pixel;
330                     *BITMAP_ADDR16(bitmap, y + (sy * 2), x + (sx * 8) + (bit * 2) + 1) = pixel;
331                     *BITMAP_ADDR16(bitmap, y + (sy * 2) + 1, x + (sx * 8) + (bit * 2) + 1) = pixel;
362                     int dot = (x * 2) + (sx * 16) + (bit * 2);
363
364                     DRAW_PIXEL(scanline, dot);
365                     DRAW_PIXEL(scanline, dot + 1);
366                     DRAW_PIXEL(scanline + 1, dot);
367                     DRAW_PIXEL(scanline + 1, dot + 1);
332368                  }
333369                  else
334370                  {
335                     *BITMAP_ADDR16(bitmap, y + (sy * 2), x + (sx * 8) + bit) = pixel;
336                     *BITMAP_ADDR16(bitmap, y + (sy * 2) + 1, x + (sx * 8) + bit) = pixel;
371                     int dot = x + (sx * 8) + bit;
372
373                     DRAW_PIXEL(scanline, dot);
374                     DRAW_PIXEL(scanline + 1, dot);
337375                  }
338376               }
339377               else
340378               {
379                  int scanline = y + sy;
380
341381                  if (state->cmd & COMMAND_X_ZM)
342382                  {
343                     *BITMAP_ADDR16(bitmap, y + sy, x + (sx * 8) + (bit * 2)) = pixel;
344                     *BITMAP_ADDR16(bitmap, y + sy, x + (sx * 8) + (bit * 2) + 1) = pixel;
383                     int dot = (x * 2) + (sx * 16) + (bit * 2);
384
385                     DRAW_PIXEL(scanline, dot);
386                     DRAW_PIXEL(scanline, dot + 1);
345387                  }
346388                  else
347389                  {
348                     *BITMAP_ADDR16(bitmap, y + sy, x + (sx * 8) + bit) = pixel;
390                     int dot = x + (sx * 8) + bit;
391
392                     DRAW_PIXEL(scanline, dot);
349393                  }
350394               }
351395
r9270r9271
397441
398442   if ((state->cmd & COMMAND_INT) && !(state->cmd & COMMAND_FRZ))
399443   {
444      if (LOG) logerror("Y-Interrupt at scanline %u\n", state->screen->vpos());
400445//      f3853_set_external_interrupt_in_line(state->smi, 1);
401446      state->ext_int_latch = 1;
402447      vidbrain_interrupt_check(timer.machine);
r9270r9271
429474    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
430475    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
431476    MDRV_SCREEN_SIZE(320, 525)
432    MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 262-1)
477    MDRV_SCREEN_VISIBLE_AREA(0, 240-1, 0, 240-1)
433478   MDRV_GFXDECODE(vidbrain)
434479    MDRV_PALETTE_LENGTH(32)
435480    MDRV_PALETTE_INIT(vidbrain)
src/mess/includes/vidbrain.h
r9270r9271
3939
4040   /* sound state */
4141   int sound_clk;
42   int sound_q[2];
4342
4443   /* devices */
4544   running_device *discrete;
src/mess/drivers/vidbrain.c
r9270r9271
128128   
129129   if (!state->sound_clk && sound_clk)
130130   {
131      state->sound_q[0] = BIT(state->keylatch, 0);
132      state->sound_q[1] = BIT(state->keylatch, 1);
133
134      discrete_sound_w(state->discrete, NODE_01, state->sound_q[0]);
135      discrete_sound_w(state->discrete, NODE_02, state->sound_q[1]);
131      discrete_sound_w(state->discrete, NODE_01, BIT(state->keylatch, 0));
132      discrete_sound_w(state->discrete, NODE_02, BIT(state->keylatch, 1));
136133   }
137134
138135   state->sound_clk = sound_clk;
r9270r9271
448445   state_save_register_global(machine, state->keylatch);
449446   state_save_register_global(machine, state->joy_enable);
450447   state_save_register_global(machine, state->sound_clk);
451   state_save_register_global_array(machine, state->sound_q);
452448}
453449
454450/***************************************************************************

Previous 15994 Revisions Next


© 1998-2018 The MESS Team