Previous 15994 Revisions Next

r3873 Thursday 18th December, 2008 at 18:42:26 UTC by Miodrag Milanović
[BBC] Fixed interrupt handling and rolled back video out change
[src/mess/machine]bbc.c
[src/mess/video]bbc.c

src/mess/video/bbc.c
r3872r3873
2222static void BBC_draw_RGB_in(running_machine *machine, int offset,int data);
2323
2424/************************************************************************
25 * video_refresh flag is used in optimising the screen redrawing
26 * it is set whenever a 6845 or VideoULA registers are change.
27 * This will then cause a full screen refresh.
2528 * The vidmem array is used to optimise the screen redrawing
2629 * whenever a memory location is written to the same location is set in the vidmem array
2730 * if none of the video registers have been changed and a full redraw is not needed
2831 * the video display emulation will only redraw the video memory locations that have been changed.
2932 ************************************************************************/
3033
34static int video_refresh;
3135unsigned char vidmem[0x10000];
3236
3337// this is the real location of the start of the BBC's ram in the emulation
r3872r3873
156160   if ((c0==1) && (c1==0)) video_ram_lookup=video_ram_lookup1;
157161   if ((c0==0) && (c1==1)) video_ram_lookup=video_ram_lookup2;
158162   if ((c0==1) && (c1==1)) video_ram_lookup=video_ram_lookup3;
163
164   // emulation refresh optimisation
165   video_refresh=1;
159166}
160167
161168
r3872r3873
268275
269276   int tpal,tcol,vpos;
270277
278
279   // emulation refresh optimisation
280   video_refresh=1;
281
271282   // Make sure vpos is never <0 2008-10-11 PHS.
272283   vpos=video_screen_get_vpos(space->machine->primary_screen);
273284   if(vpos==0)
r3872r3873
324335      videoULA_pallet1[tpal]=tcol<8?tcol^7:tcol;
325336      break;
326337   }
338
339   // emulation refresh optimisation
340   video_refresh=1;
327341}
328342
329343
r3872r3873
341355      VideoULA_CR_counter-=1;
342356      if (VideoULA_CR_counter<=0) {
343357         VideoULA_CR=0;
358         video_refresh=video_refresh&0xfb;
344359         set_cursor();
345360      }
346361   }
r3872r3873
385400      // this is actually does by the latch IC's not the Video ULA
386401      meml=video_ram_lookup[m6845_memory_address_r(0)]|(BBC_Character_Row&0x7);
387402
388      if (vidmem_RAM[meml])
403      if (vidmem_RAM[meml] || video_refresh )
389404      {
390405         vidmem_RAM[meml]=0;
391406         i=BBC_Video_RAM[meml];
r3872r3873
399414         BBC_display += emulation_pixels_per_byte;
400415      }
401416   } else {
402      // if the display is not enable, just draw a blank area.
403      BBC_ula_drawpixel(0, emulation_pixels_per_byte);
417      if (video_refresh)
418      {
419         // if the display is not enable, just draw a blank area.
420         BBC_ula_drawpixel(0, emulation_pixels_per_byte);
421      } else {
422         BBC_display += emulation_pixels_per_byte;
423      }
404424   }
405425}
406426
r3872r3873
505525   if (data&2) {
506526      VideoULA_CR_counter=emulation_cursor_size;
507527      VideoULA_CR=1;
528      // turn on the video refresh for the cursor area
529      video_refresh=video_refresh|4;
508530      // set the pallet on
509531      if (data&1) set_cursor();
510532   }
r3872r3873
541563         m6845_register_w(0,data);
542564         break;
543565   }
566
567   // emulation refresh optimisation
568   video_refresh=1;
544569}
545570
546571 READ8_HANDLER (BBC_6845_r)
r3872r3873
570595VIDEO_UPDATE( bbc )
571596{
572597   long c;
598   int full_refresh;
573599
574600   //logerror ("Box %d by %d \n",cliprect->min_y,cliprect->max_y);
575601
576602   c = 0; // this is used to time out the screen redraw, in the case that the 6845 is in some way out state.
603   full_refresh = 1;
577604
578605   BBC_bitmap=bitmap;
579606
r3872r3873
581608   BBC_display_right=BBC_display_left;
582609   BBC_display=BBC_display_left;
583610
611   // video_refresh is set if any of the 6845 or Video ULA registers are changed
612   // this then forces a full screen redraw
613
614   if (full_refresh)
615   {
616      video_refresh=video_refresh|2;
617   }
618
584619   // loop until the end of the Vertical Sync pulse
585620   // or until a timeout (this catches the 6845 with silly register values that would not give a VSYNC signal)
586621   while((BBC_VSync)&&(c<60000))
r3872r3873
605640      c++;
606641   }
607642
643   // redrawn the screen so reset video_refresh
644   video_refresh=0;
645
608646   return 0;
609647}
610648
src/mess/machine/bbc.c
r3872r3873
3939 IRQ inputs
4040*****************************/
4141
42static int via_system_irq=0;
43static int via_user_irq=0;
44static int MC6850_irq=0;
4542static int ACCCON_IRR=0;
4643
47static void bbc_setirq(running_machine *machine)
48{
49   cpu_set_input_line(machine->cpu[0], M6502_IRQ_LINE, via_system_irq|via_user_irq|MC6850_irq|ACCCON_IRR);
50}
51
5244/************************
5345Sideways RAM/ROM code
5446*************************/
r3872r3873
396388
397389     if (tempIRR!=ACCCON_IRR)
398390     {
399      bbc_setirq(space->machine);
391      cpu_set_input_line(space->machine->cpu[0], M6502_IRQ_LINE, ACCCON_IRR);
400392   }
401393
402394   if (ACCCON_Y)
r3872r3873
12041196static void bbc_via_system_irq(const device_config *device, int level)
12051197{
12061198//  logerror("SYSTEM via irq %d %d %d\n",via_system_irq,via_user_irq,level);
1207   via_system_irq=level;
1208   bbc_setirq(device->machine);
1199   cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level);
12091200}
12101201
12111202
r3872r3873
12951286
12961287static void bbc_via_user_irq(const device_config *device, int level)
12971288{
1298   via_user_irq=level;
1299   bbc_setirq(device->machine);
1289   cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level);
13001290}
13011291
13021292
r3872r3873
14001390
14011391static void Serial_interrupt(const device_config *device, int level)
14021392{
1403   MC6850_irq=level;
1404   bbc_setirq(device->machine);
1405   //logerror("Set SIO irq  %01x\n",level);
1393   cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level);
14061394}
14071395
14081396UINT8 bbc_tx_pin;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team