src/mess/video/bbc.c
| r3872 | r3873 | |
| 22 | 22 | static void BBC_draw_RGB_in(running_machine *machine, int offset,int data); |
| 23 | 23 | |
| 24 | 24 | /************************************************************************ |
| 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. |
| 25 | 28 | * The vidmem array is used to optimise the screen redrawing |
| 26 | 29 | * whenever a memory location is written to the same location is set in the vidmem array |
| 27 | 30 | * if none of the video registers have been changed and a full redraw is not needed |
| 28 | 31 | * the video display emulation will only redraw the video memory locations that have been changed. |
| 29 | 32 | ************************************************************************/ |
| 30 | 33 | |
| 34 | static int video_refresh; |
| 31 | 35 | unsigned char vidmem[0x10000]; |
| 32 | 36 | |
| 33 | 37 | // this is the real location of the start of the BBC's ram in the emulation |
| r3872 | r3873 | |
| 156 | 160 | if ((c0==1) && (c1==0)) video_ram_lookup=video_ram_lookup1; |
| 157 | 161 | if ((c0==0) && (c1==1)) video_ram_lookup=video_ram_lookup2; |
| 158 | 162 | if ((c0==1) && (c1==1)) video_ram_lookup=video_ram_lookup3; |
| 163 | |
| 164 | // emulation refresh optimisation |
| 165 | video_refresh=1; |
| 159 | 166 | } |
| 160 | 167 | |
| 161 | 168 | |
| r3872 | r3873 | |
| 268 | 275 | |
| 269 | 276 | int tpal,tcol,vpos; |
| 270 | 277 | |
| 278 | |
| 279 | // emulation refresh optimisation |
| 280 | video_refresh=1; |
| 281 | |
| 271 | 282 | // Make sure vpos is never <0 2008-10-11 PHS. |
| 272 | 283 | vpos=video_screen_get_vpos(space->machine->primary_screen); |
| 273 | 284 | if(vpos==0) |
| r3872 | r3873 | |
| 324 | 335 | videoULA_pallet1[tpal]=tcol<8?tcol^7:tcol; |
| 325 | 336 | break; |
| 326 | 337 | } |
| 338 | |
| 339 | // emulation refresh optimisation |
| 340 | video_refresh=1; |
| 327 | 341 | } |
| 328 | 342 | |
| 329 | 343 | |
| r3872 | r3873 | |
| 341 | 355 | VideoULA_CR_counter-=1; |
| 342 | 356 | if (VideoULA_CR_counter<=0) { |
| 343 | 357 | VideoULA_CR=0; |
| 358 | video_refresh=video_refresh&0xfb; |
| 344 | 359 | set_cursor(); |
| 345 | 360 | } |
| 346 | 361 | } |
| r3872 | r3873 | |
| 385 | 400 | // this is actually does by the latch IC's not the Video ULA |
| 386 | 401 | meml=video_ram_lookup[m6845_memory_address_r(0)]|(BBC_Character_Row&0x7); |
| 387 | 402 | |
| 388 | | if (vidmem_RAM[meml]) |
| 403 | if (vidmem_RAM[meml] || video_refresh ) |
| 389 | 404 | { |
| 390 | 405 | vidmem_RAM[meml]=0; |
| 391 | 406 | i=BBC_Video_RAM[meml]; |
| r3872 | r3873 | |
| 399 | 414 | BBC_display += emulation_pixels_per_byte; |
| 400 | 415 | } |
| 401 | 416 | } 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 | } |
| 404 | 424 | } |
| 405 | 425 | } |
| 406 | 426 | |
| r3872 | r3873 | |
| 505 | 525 | if (data&2) { |
| 506 | 526 | VideoULA_CR_counter=emulation_cursor_size; |
| 507 | 527 | VideoULA_CR=1; |
| 528 | // turn on the video refresh for the cursor area |
| 529 | video_refresh=video_refresh|4; |
| 508 | 530 | // set the pallet on |
| 509 | 531 | if (data&1) set_cursor(); |
| 510 | 532 | } |
| r3872 | r3873 | |
| 541 | 563 | m6845_register_w(0,data); |
| 542 | 564 | break; |
| 543 | 565 | } |
| 566 | |
| 567 | // emulation refresh optimisation |
| 568 | video_refresh=1; |
| 544 | 569 | } |
| 545 | 570 | |
| 546 | 571 | READ8_HANDLER (BBC_6845_r) |
| r3872 | r3873 | |
| 570 | 595 | VIDEO_UPDATE( bbc ) |
| 571 | 596 | { |
| 572 | 597 | long c; |
| 598 | int full_refresh; |
| 573 | 599 | |
| 574 | 600 | //logerror ("Box %d by %d \n",cliprect->min_y,cliprect->max_y); |
| 575 | 601 | |
| 576 | 602 | 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; |
| 577 | 604 | |
| 578 | 605 | BBC_bitmap=bitmap; |
| 579 | 606 | |
| r3872 | r3873 | |
| 581 | 608 | BBC_display_right=BBC_display_left; |
| 582 | 609 | BBC_display=BBC_display_left; |
| 583 | 610 | |
| 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 | |
| 584 | 619 | // loop until the end of the Vertical Sync pulse |
| 585 | 620 | // or until a timeout (this catches the 6845 with silly register values that would not give a VSYNC signal) |
| 586 | 621 | while((BBC_VSync)&&(c<60000)) |
| r3872 | r3873 | |
| 605 | 640 | c++; |
| 606 | 641 | } |
| 607 | 642 | |
| 643 | // redrawn the screen so reset video_refresh |
| 644 | video_refresh=0; |
| 645 | |
| 608 | 646 | return 0; |
| 609 | 647 | } |
| 610 | 648 | |
src/mess/machine/bbc.c
| r3872 | r3873 | |
| 39 | 39 | IRQ inputs |
| 40 | 40 | *****************************/ |
| 41 | 41 | |
| 42 | | static int via_system_irq=0; |
| 43 | | static int via_user_irq=0; |
| 44 | | static int MC6850_irq=0; |
| 45 | 42 | static int ACCCON_IRR=0; |
| 46 | 43 | |
| 47 | | static 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 | | |
| 52 | 44 | /************************ |
| 53 | 45 | Sideways RAM/ROM code |
| 54 | 46 | *************************/ |
| r3872 | r3873 | |
| 396 | 388 | |
| 397 | 389 | if (tempIRR!=ACCCON_IRR) |
| 398 | 390 | { |
| 399 | | bbc_setirq(space->machine); |
| 391 | cpu_set_input_line(space->machine->cpu[0], M6502_IRQ_LINE, ACCCON_IRR); |
| 400 | 392 | } |
| 401 | 393 | |
| 402 | 394 | if (ACCCON_Y) |
| r3872 | r3873 | |
| 1204 | 1196 | static void bbc_via_system_irq(const device_config *device, int level) |
| 1205 | 1197 | { |
| 1206 | 1198 | // 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); |
| 1209 | 1200 | } |
| 1210 | 1201 | |
| 1211 | 1202 | |
| r3872 | r3873 | |
| 1295 | 1286 | |
| 1296 | 1287 | static void bbc_via_user_irq(const device_config *device, int level) |
| 1297 | 1288 | { |
| 1298 | | via_user_irq=level; |
| 1299 | | bbc_setirq(device->machine); |
| 1289 | cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level); |
| 1300 | 1290 | } |
| 1301 | 1291 | |
| 1302 | 1292 | |
| r3872 | r3873 | |
| 1400 | 1390 | |
| 1401 | 1391 | static void Serial_interrupt(const device_config *device, int level) |
| 1402 | 1392 | { |
| 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); |
| 1406 | 1394 | } |
| 1407 | 1395 | |
| 1408 | 1396 | UINT8 bbc_tx_pin; |