Previous 15994 Revisions Next

r1938 Tuesday 11th March, 2008 at 21:36:50 UTC by Wilbert Pol
Removed deprecat.h and mslegacy.h dependencies from video/kc.c
[src/mess/video]kc.c

src/mess/video/kc.c
r1937r1938
99#include "driver.h"
1010#include "includes/kc.h"
1111#include "eventlst.h"
12#include "deprecat.h"
13#include "mslegacy.h"
1412
1513/* KC85/4 and KC85/3 common graphics hardware */
1614
r1937r1938
9694/* Initialise the palette */
9795PALETTE_INIT( kc85 )
9896{
99   palette_set_colors_rgb(machine, 0, kc85_palette, sizeof(kc85_palette) / 3);
97   int i;
98
99   for ( i = 0; i < sizeof(kc85_palette) / 3; i++ ) {
100      palette_set_color_rgb(machine, i, kc85_palette[i*3], kc85_palette[i*3+1], kc85_palette[i*3+2]);
101   }
100102}
101103
102104static int kc85_blink_state;
r1937r1938
114116
115117
116118/* draw 8 pixels */
117static void kc85_draw_8_pixels(bitmap_t *bitmap,int x,int y, unsigned char colour_byte, unsigned char gfx_byte)
119static void kc85_draw_8_pixels(running_machine *machine, bitmap_t *bitmap,int x,int y, unsigned char colour_byte, unsigned char gfx_byte)
118120{
119121   int a;
120122   int background_pen;
r1937r1938
142144      foreground_pen = background_pen;
143145   }
144146
145    pens[0] = Machine->pens[background_pen];
146   pens[1] = Machine->pens[foreground_pen];
147    pens[0] = machine->pens[background_pen];
148   pens[1] = machine->pens[foreground_pen];
147149
148150   px = x;
149151
r1937r1938
286288
287289/* process visible cycles within a line */
288290/* the cycles will never span over the end of a line */
289static void kc85_common_process_cycles(struct video_update_state *video_update, int cycles)
291static void kc85_common_process_cycles(running_machine *machine, struct video_update_state *video_update, int cycles)
290292{
291293   while (cycles!=0)
292294   {
r1937r1938
320322               /* grab colour and pixel information */
321323               video_update->pixel_grab_callback(&video_update->grab_data,video_update->x,video_update->y,&colour_byte, &gfx_byte);
322324               /* draw to screen */
323               kc85_draw_8_pixels(video_update->bitmap, video_update->render_x, video_update->render_y,colour_byte, gfx_byte);
325               kc85_draw_8_pixels(machine, video_update->bitmap, video_update->render_x, video_update->render_y,colour_byte, gfx_byte);
324326               /* update render coordinate */
325327               video_update->render_x+=8;
326328               video_update->x++;
r1937r1938
371373}
372374
373375/* process a whole visible line */
374static int kc85_common_vh_process_line(struct video_update_state *video_update, int cycles)
376static int kc85_common_vh_process_line(running_machine *machine, struct video_update_state *video_update, int cycles)
375377{
376378   int cycles_to_do;
377379
r1937r1938
384386      //logerror("process line: cycles_to_do: %d\n",cycles_to_do);
385387
386388      /* do the cycles - draw them */
387      kc85_common_process_cycles(video_update, cycles_to_do);
389      kc85_common_process_cycles(machine, video_update, cycles_to_do);
388390
389391      video_update->horizontal.cycles_remaining -= cycles_to_do;
390392      cycles -=cycles_to_do;
r1937r1938
421423   return cycles;
422424}
423425
424static void kc85_common_vh_process_lines(struct video_update_state *video_update, int cycles)
426static void kc85_common_vh_process_lines(running_machine *machine, struct video_update_state *video_update, int cycles)
425427{
426428   while (cycles!=0)
427429   {
r1937r1938
449451            int cycles_remaining;
450452
451453            /* update cycles with number of cycles not processed */
452            cycles_remaining = kc85_common_vh_process_line(video_update, cycles_to_do);
454            cycles_remaining = kc85_common_vh_process_line(machine, video_update, cycles_to_do);
453455
454456            cycles_done = cycles_to_do - cycles_remaining;
455457
r1937r1938
490492
491493/* the kc85 screen is 320 pixels wide and 256 pixels tall */
492494/* if we assume a 50hz display, there are 312 lines for the complete frame, leaving 56 lines not visible */
493static void kc85_common_process_frame(bitmap_t *bitmap, void (*pixel_grab_callback)(struct grab_info *,int x,int y,unsigned char *, unsigned char *),struct grab_info *grab_data)
495static void kc85_common_process_frame(running_machine *machine, bitmap_t *bitmap, void (*pixel_grab_callback)(struct grab_info *,int x,int y,unsigned char *, unsigned char *),struct grab_info *grab_data)
494496{
495497   int cycles_remaining_in_frame = KC85_CYCLES_PER_FRAME;
496498
r1937r1938
527529      delta_cycles = pItem->Event_Time - cycles_offset;
528530
529531      //logerror("cycles between this event and next: %d\n",delta_cycles);
530      kc85_common_vh_process_lines(&video_update, delta_cycles);
532      kc85_common_vh_process_lines(machine, &video_update, delta_cycles);
531533
532534      /* update number of cycles remaining in frame */
533535      cycles_remaining_in_frame -= delta_cycles;
r1937r1938
544546
545547
546548   /* process remainder */
547   kc85_common_vh_process_lines(&video_update, cycles_remaining_in_frame);
549   kc85_common_vh_process_lines(machine, &video_update, cycles_remaining_in_frame);
548550   EventList_Reset();
549551   EventList_SetOffsetStartTime ( ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(0), video_screen_get_vpos(0))) );
550552}
r1937r1938
671673         colour_byte = colour_ram[offset];
672674          gfx_byte = pixel_ram[offset];
673675
674         kc85_draw_8_pixels(bitmap,(x<<3),y, colour_byte, gfx_byte);
676         kc85_draw_8_pixels(machine, bitmap,(x<<3),y, colour_byte, gfx_byte);
675677
676678      }
677679   }
r1937r1938
681683   grab_data.pixel_ram = kc85_4_display_video_ram;
682684   grab_data.colour_ram = kc85_4_display_video_ram + 0x04000;
683685
684   kc85_common_process_frame(bitmap, kc85_4_pixel_grab_callback,&grab_data);
686   kc85_common_process_frame(machine, bitmap, kc85_4_pixel_grab_callback,&grab_data);
685687
686688   return 0;
687689}
r1937r1938
768770            colour_byte = colour_ram[colour_offset];
769771            gfx_byte = pixel_ram[pixel_offset];
770772
771         kc85_draw_8_pixels(bitmap,(x<<3),y, colour_byte, gfx_byte);
773         kc85_draw_8_pixels(machine, bitmap,(x<<3),y, colour_byte, gfx_byte);
772774      }
773775   }
774776#endif
r1937r1938
778780   grab_data.pixel_ram = mess_ram+0x08000;
779781   grab_data.colour_ram = mess_ram+0x08000 + 0x02800;
780782
781   kc85_common_process_frame(bitmap, kc85_3_pixel_grab_callback,&grab_data);
783   kc85_common_process_frame(machine, bitmap, kc85_3_pixel_grab_callback,&grab_data);
782784
783785   return 0;
784786}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team