Previous 15994 Revisions Next

r11888 Thursday 9th June, 2011 at 22:02:21 UTC by Angelo Salese
Implemented preliminary video partial updates effect in Sharp X1 HW [Angelo Salese]
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r11887r11888
88    TODO:
99    - Rewrite keyboard input hook-up and decap/dump the keyboard MCU if possible;
1010    - Fix the 0xe80/0xe83 kanji ROM readback;
11    - Fixe the 0xb00 RAM banking;
1211    - x1turbo keyboard inputs are currently broken, use x1turbo40 for now;
1312    - Hook-up remaining .tap image formats;
1413    - Implement APSS tape commands;
r11887r11888
4544    - Trivia-Q: dunno what to do on the selection screen, missing inputs?
4645    - Turbo Alpha: has z80dma / fdc bugs, doesn't show the presentation properly and then hangs;
4746    - Will 2: doesn't load, fdc issue presumably (note: it's a x1turbo game ONLY);
48    - X1F Demo ("New X1 Demo"): needs partial updates to work properly (note that INDEXED16 doesn't cope at all with partial updates);
47    - X1F Demo ("New X1 Demo"): needs partial updates, but they doesn't cope well with this system;
4948    - Ys 2: crashes after the disclaimer screen;
5049    - Ys 3: missing user disk, to hack it (and play with x1turboz features): bp 81ca,pc += 2
5150    - Ys 3: never uploads a valid 4096 palette, probably related to the fact that we don't have an user disk
r11887r11888
260259
261260   if(width && height)
262261   {
263      *BITMAP_ADDR16(bitmap, y+0, x+0) = machine.pens[pen];
264      *BITMAP_ADDR16(bitmap, y+0, x+1) = machine.pens[pen];
265      *BITMAP_ADDR16(bitmap, y+1, x+0) = machine.pens[pen];
266      *BITMAP_ADDR16(bitmap, y+1, x+1) = machine.pens[pen];
262      *BITMAP_ADDR32(bitmap, y+0, x+0) = machine.pens[pen];
263      *BITMAP_ADDR32(bitmap, y+0, x+1) = machine.pens[pen];
264      *BITMAP_ADDR32(bitmap, y+1, x+0) = machine.pens[pen];
265      *BITMAP_ADDR32(bitmap, y+1, x+1) = machine.pens[pen];
267266   }
268267   else if(width)
269268   {
270      *BITMAP_ADDR16(bitmap, y, x+0) = machine.pens[pen];
271      *BITMAP_ADDR16(bitmap, y, x+1) = machine.pens[pen];
269      *BITMAP_ADDR32(bitmap, y, x+0) = machine.pens[pen];
270      *BITMAP_ADDR32(bitmap, y, x+1) = machine.pens[pen];
272271   }
273272   else if(height)
274273   {
275      *BITMAP_ADDR16(bitmap, y+0, x) = machine.pens[pen];
276      *BITMAP_ADDR16(bitmap, y+1, x) = machine.pens[pen];
274      *BITMAP_ADDR32(bitmap, y+0, x) = machine.pens[pen];
275      *BITMAP_ADDR32(bitmap, y+1, x) = machine.pens[pen];
277276   }
278277   else
279      *BITMAP_ADDR16(bitmap, y, x) = machine.pens[pen];
278      *BITMAP_ADDR32(bitmap, y, x) = machine.pens[pen];
280279}
281280
282281#define mc6845_h_char_total    (state->m_crtc_vreg[0])
r11887r11888
323322   return height;
324323}
325324
326static void draw_fgtilemap(running_machine &machine, bitmap_t *bitmap)
325static void draw_fgtilemap(running_machine &machine, bitmap_t *bitmap,const rectangle *cliprect)
327326{
328327   /*
329328        attribute table:
r11887r11888
470469                  res_x = x*8+xi*(width+1);
471470                  res_y = y*(mc6845_tile_height)+yi;
472471
472                  if(res_y < cliprect->min_y || res_y > cliprect->max_y) // partial update, TODO: optimize
473                     continue;
474
473475                  x1_draw_pixel(machine,bitmap,res_y,res_x,pcg_pen,width,0);
474476               }
475477            }
r11887r11888
509511   return pri_mask_calc;
510512}
511513
512static void draw_gfxbitmap(running_machine &machine, bitmap_t *bitmap,int plane,int pri)
514static void draw_gfxbitmap(running_machine &machine, bitmap_t *bitmap,const rectangle *cliprect, int plane,int pri)
513515{
514516   x1_state *state = machine.driver_data<x1_state>();
515517   int xi,yi,x,y;
r11887r11888
551553               if((color == 8 && state->m_scrn_reg.blackclip & 0x10) || (color == 9 && state->m_scrn_reg.blackclip & 0x20)) // bitmap color clip to black conditions
552554                  color = 0;
553555
556               if(y*(mc6845_tile_height)+yi < cliprect->min_y || y*(mc6845_tile_height)+yi > cliprect->max_y) // partial update TODO: optimize
557                  continue;
558
554559               x1_draw_pixel(machine,bitmap,y*(mc6845_tile_height)+yi,x*8+xi,color,0,0);
555560            }
556561         }
r11887r11888
564569
565570   bitmap_fill(bitmap, cliprect, MAKE_ARGB(0xff,0x00,0x00,0x00));
566571
567   draw_gfxbitmap(screen->machine(),bitmap,state->m_scrn_reg.disp_bank,state->m_scrn_reg.pri);
568   draw_fgtilemap(screen->machine(),bitmap);
569   draw_gfxbitmap(screen->machine(),bitmap,state->m_scrn_reg.disp_bank,state->m_scrn_reg.pri^0xff);
572   draw_gfxbitmap(screen->machine(),bitmap,cliprect,state->m_scrn_reg.disp_bank,state->m_scrn_reg.pri);
573   draw_fgtilemap(screen->machine(),bitmap,cliprect);
574   draw_gfxbitmap(screen->machine(),bitmap,cliprect,state->m_scrn_reg.disp_bank,state->m_scrn_reg.pri^0xff);
570575
571576   return 0;
572577}
573578
574579static SCREEN_EOF( x1 )
575580{
581//   x1_state *state = screen->machine().driver_data<x1_state>();
582
583//   state->m_old_vpos = -1;
576584}
577585
578586/*************************************
r11887r11888
12811289   {
12821290      state->m_x_r = data;
12831291      set_current_palette(space->machine());
1292      //if(state->m_old_vpos != space->machine().primary_screen->vpos())
1293      //{
1294      //   space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
1295      //   state->m_old_vpos = space->machine().primary_screen->vpos();
1296      //}
12841297   }
12851298}
12861299
r11887r11888
12971310   {
12981311      state->m_x_g = data;
12991312      set_current_palette(space->machine());
1313      //if(state->m_old_vpos != space->machine().primary_screen->vpos())
1314      //{
1315         space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
1316      //   state->m_old_vpos = space->machine().primary_screen->vpos();
1317      //}
13001318   }
13011319}
13021320
r11887r11888
13131331   {
13141332      state->m_x_b = data;
13151333      set_current_palette(space->machine());
1334      //if(state->m_old_vpos != space->machine().primary_screen->vpos())
1335      //{
1336      //   space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
1337      //   state->m_old_vpos = space->machine().primary_screen->vpos();
1338      //}
13161339   }
13171340}
13181341
r11887r11888
15811604
15821605/*
15831606    CZ-141SF, CZ-127MF, X1turboZII, X1turboZ3 boards
1584    TODO: still not quite right
15851607*/
15861608static READ8_HANDLER( x1turbo_bank_r )
15871609{
r11887r11888
25732595      palette_set_color_rgb(machine, i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
25742596
25752597   state->m_ram_bank = 0;
2598//   state->m_old_vpos = -1;
25762599}
25772600
25782601static MACHINE_RESET( x1turbo )
r11887r11888
26552678   MCFG_SCREEN_ADD("screen", RASTER)
26562679   MCFG_SCREEN_REFRESH_RATE(60)
26572680   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
2658   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
2681   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
26592682   MCFG_SCREEN_SIZE(640, 480)
26602683   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
26612684   MCFG_SCREEN_UPDATE(x1)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team