src/mess/video/mbee.c
| r2817 | r2818 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | | #include "deprecat.h" |
| 11 | 10 | #include "includes/mbee.h" |
| 12 | 11 | |
| 13 | 12 | |
| r2817 | r2818 | |
| 98 | 97 | colorram[offset] = data; |
| 99 | 98 | } |
| 100 | 99 | |
| 101 | | static int keyboard_matrix_r(int offs) |
| 100 | static int keyboard_matrix_r(running_machine *machine, int offs) |
| 102 | 101 | { |
| 103 | 102 | char portname[6]; |
| 104 | 103 | int port = (offs >> 7) & 7; |
| 105 | 104 | int bit = (offs >> 4) & 7; |
| 106 | | int extra = input_port_read(Machine, "EXTRA"); |
| 105 | int extra = input_port_read(machine, "EXTRA"); |
| 107 | 106 | int data = 0; |
| 108 | 107 | sprintf(portname, "LINE%d", port); |
| 109 | | data = (input_port_read(Machine, portname) >> bit) & 1; |
| 108 | data = (input_port_read(machine, portname) >> bit) & 1; |
| 110 | 109 | |
| 111 | 110 | if( extra & 0x01 ) /* extra: cursor up */ |
| 112 | 111 | { |
| r2817 | r2818 | |
| 167 | 166 | memory_set_bank( 2, 1); |
| 168 | 167 | } |
| 169 | 168 | |
| 170 | | static void m6545_update_strobe(int param) |
| 169 | static void m6545_update_strobe(running_machine *machine, int param) |
| 171 | 170 | { |
| 172 | 171 | int data; |
| 173 | | data = keyboard_matrix_r(param); |
| 172 | data = keyboard_matrix_r(machine, param); |
| 174 | 173 | crt.update_strobe = 1; |
| 175 | 174 | // if( data ) |
| 176 | 175 | // logerror("6545 update_strobe_cb $%04X = $%02X\n", param, data); |
| r2817 | r2818 | |
| 261 | 260 | /* shared memory latch */ |
| 262 | 261 | addr = (crt.transp_hi << 8) | crt.transp_lo; |
| 263 | 262 | // logerror("6545 transp_latch $%04X\n", addr); |
| 264 | | m6545_update_strobe(addr); |
| 263 | m6545_update_strobe(machine, addr); |
| 265 | 264 | break; |
| 266 | 265 | default: |
| 267 | 266 | logerror("6545 read unmapped port $%X\n", crt.idx); |
| r2817 | r2818 | |
| 383 | 382 | /* shared memory latch */ |
| 384 | 383 | addr = (crt.transp_hi << 8) | crt.transp_lo; |
| 385 | 384 | // logerror("6545 transp_latch $%04X\n", addr); |
| 386 | | m6545_update_strobe(addr); |
| 385 | m6545_update_strobe(machine, addr); |
| 387 | 386 | break; |
| 388 | 387 | default: |
| 389 | 388 | logerror("6545 write unmapped port $%X <- $%02X\n", crt.idx, data); |
| r2817 | r2818 | |
| 465 | 464 | UINT16 cursor = (crt.cursor_address_hi<<8) | crt.cursor_address_lo; // get cursor position |
| 466 | 465 | UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo; // screen home offset (usually zero) |
| 467 | 466 | |
| 468 | | for( i = 0; i < 0x380; i += 0x10 ) keyboard_matrix_r(i); |
| 467 | for( i = 0; i < 0x380; i += 0x10 ) keyboard_matrix_r(screen->machine, i); |
| 469 | 468 | |
| 470 | 469 | framecnt++; |
| 471 | 470 | |
| r2817 | r2818 | |
| 507 | 506 | UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo; // screen home offset (usually zero) |
| 508 | 507 | UINT16 colourm = (mbee_pcg_color_latch & 0x0e) << 7; |
| 509 | 508 | |
| 510 | | for( i = 0; i < 0x380; i += 0x10 ) keyboard_matrix_r(i); |
| 509 | for( i = 0; i < 0x380; i += 0x10 ) keyboard_matrix_r(screen->machine, i); |
| 511 | 510 | |
| 512 | 511 | framecnt++; |
| 513 | 512 | |
src/mess/video/thomson.c
| r2817 | r2818 | |
| 8 | 8 | |
| 9 | 9 | #include <math.h> |
| 10 | 10 | #include "driver.h" |
| 11 | | #include "deprecat.h" |
| 12 | 11 | #include "includes/thomson.h" |
| 13 | 12 | #include "cpu/m6809/m6809.h" |
| 14 | 13 | #include "machine/6821pia.h" |
| r2817 | r2818 | |
| 138 | 137 | |
| 139 | 138 | |
| 140 | 139 | |
| 141 | | static void thom_get_lightpen_pos( int*x, int* y ) |
| 140 | static void thom_get_lightpen_pos( running_machine *machine, int*x, int* y ) |
| 142 | 141 | { |
| 143 | | *x = input_port_read(Machine, "lightpen_x"); |
| 144 | | *y = input_port_read(Machine, "lightpen_y"); |
| 142 | *x = input_port_read(machine, "lightpen_x"); |
| 143 | *y = input_port_read(machine, "lightpen_y"); |
| 145 | 144 | |
| 146 | 145 | if ( *x < 0 ) |
| 147 | 146 | *x = 0; |
| r2817 | r2818 | |
| 158 | 157 | |
| 159 | 158 | |
| 160 | 159 | |
| 161 | | struct thom_vsignal thom_get_lightpen_vsignal ( int xdec, int ydec, int xdec2 ) |
| 160 | struct thom_vsignal thom_get_lightpen_vsignal ( running_machine *machine, int xdec, int ydec, int xdec2 ) |
| 162 | 161 | { |
| 163 | 162 | struct thom_vsignal v; |
| 164 | 163 | int x, y; |
| 165 | 164 | int gpl; |
| 166 | 165 | |
| 167 | | thom_get_lightpen_pos( &x, &y ); |
| 166 | thom_get_lightpen_pos( machine, &x, &y ); |
| 168 | 167 | x += xdec - thom_bwidth; |
| 169 | 168 | y += ydec - thom_bheight; |
| 170 | 169 | |
| r2817 | r2818 | |
| 1038 | 1037 | int fnew, fold = FLOP_STATE; |
| 1039 | 1038 | int i; |
| 1040 | 1039 | UINT16 b = 0; |
| 1041 | | struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 ); |
| 1040 | struct thom_vsignal l = thom_get_lightpen_vsignal( machine, 0, -1, 0 ); |
| 1042 | 1041 | |
| 1043 | 1042 | LOG (( "%f thom: video eof called\n", attotime_to_double(timer_get_time()) )); |
| 1044 | 1043 | |
| r2817 | r2818 | |
| 1216 | 1215 | /* bits 0-13 : latched gpl of lightpen position */ |
| 1217 | 1216 | /* bit 14: latched INIT */ |
| 1218 | 1217 | /* bit 15: latched INIL */ |
| 1219 | | unsigned to7_lightpen_gpl ( int decx, int decy ) |
| 1218 | unsigned to7_lightpen_gpl ( running_machine *machine, int decx, int decy ) |
| 1220 | 1219 | { |
| 1221 | 1220 | int x,y; |
| 1222 | | thom_get_lightpen_pos( &x, &y ); |
| 1221 | thom_get_lightpen_pos( machine, &x, &y ); |
| 1223 | 1222 | x -= thom_bwidth; |
| 1224 | 1223 | y -= thom_bheight; |
| 1225 | 1224 | if ( x < 0 || y < 0 || x >= 320 || y >= 200 ) |
src/mess/video/pc8801.c
| r2817 | r2818 | |
| 8 | 8 | but the pen colours may be wrong. This needs to be tested. */ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | | #include "deprecat.h" |
| 12 | 11 | #include "machine/8255ppi.h" |
| 13 | 12 | #include "includes/pc8801.h" |
| 14 | 13 | |
| r2817 | r2818 | |
| 238 | 237 | |
| 239 | 238 | #undef XXX |
| 240 | 239 | |
| 241 | | int is_pc8801_vram_select(void) |
| 240 | int is_pc8801_vram_select(running_machine *machine) |
| 242 | 241 | { |
| 243 | 242 | read8_machine_func rh5 = NULL, rh6 = NULL; |
| 244 | 243 | write8_machine_func wh5 = NULL, wh6 = NULL; |
| r2817 | r2818 | |
| 299 | 298 | } |
| 300 | 299 | |
| 301 | 300 | |
| 302 | | if (rh5) memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, rh5); |
| 303 | | if (wh5) memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, wh5); |
| 304 | | if (rh6) memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, rh6); |
| 305 | | if (wh6) memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, wh6); |
| 301 | if (rh5) memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, rh5); |
| 302 | if (wh5) memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, wh5); |
| 303 | if (rh6) memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, rh6); |
| 304 | if (wh6) memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, wh6); |
| 306 | 305 | } |
| 307 | 306 | |
| 308 | 307 | WRITE8_HANDLER(pc88sr_disp_32) |
| 309 | 308 | { |
| 310 | 309 | analog_palette=((data & 0x20) != 0x00); |
| 311 | 310 | ALUON=((data & 0x40) != 0x00); |
| 312 | | pc8801_update_bank(); |
| 311 | pc8801_update_bank(machine); |
| 313 | 312 | } |
| 314 | 313 | |
| 315 | 314 | WRITE8_HANDLER(pc88sr_ALU) |
| r2817 | r2818 | |
| 322 | 321 | ALU2=data; |
| 323 | 322 | break; |
| 324 | 323 | } |
| 325 | | pc8801_update_bank(); |
| 324 | pc8801_update_bank(machine); |
| 326 | 325 | } |
| 327 | 326 | |
| 328 | 327 | WRITE8_HANDLER(pc8801_vramsel) |
| r2817 | r2818 | |
| 332 | 331 | } else { |
| 333 | 332 | selected_vram=offset+1; |
| 334 | 333 | } |
| 335 | | pc8801_update_bank(); |
| 334 | pc8801_update_bank(machine); |
| 336 | 335 | } |
| 337 | 336 | |
| 338 | 337 | READ8_HANDLER(pc8801_vramtest) |
src/mess/machine/pc8801.c
| r2817 | r2818 | |
| 37 | 37 | static UINT8 extmem_ctrl[2]; |
| 38 | 38 | |
| 39 | 39 | static int use_5FD; |
| 40 | | static void pc8801_init_5fd(void); |
| 40 | static void pc8801_init_5fd(running_machine *machine); |
| 41 | 41 | |
| 42 | 42 | static void pc88sr_init_fmsound(void); |
| 43 | 43 | static int enable_FM_IRQ; |
| r2817 | r2818 | |
| 376 | 376 | #undef SET_RET |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | | void pc8801_update_bank(void) |
| 379 | void pc8801_update_bank(running_machine *machine) |
| 380 | 380 | { |
| 381 | 381 | char *ext_r,*ext_w; |
| 382 | 382 | |
| r2817 | r2818 | |
| 395 | 395 | if(ext_w==NULL) |
| 396 | 396 | { |
| 397 | 397 | /* read only mode */ |
| 398 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_NOP); |
| 399 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_NOP); |
| 398 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_NOP); |
| 399 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_NOP); |
| 400 | 400 | } |
| 401 | 401 | else |
| 402 | 402 | { |
| 403 | 403 | /* r/w mode */ |
| 404 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK1); |
| 405 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK2); |
| 404 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK1); |
| 405 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK2); |
| 406 | 406 | if(ext_w!=ext_r) logerror("differnt between read and write bank of extension memory.\n"); |
| 407 | 407 | } |
| 408 | 408 | } |
| r2817 | r2818 | |
| 412 | 412 | if(RAMmode) |
| 413 | 413 | { |
| 414 | 414 | /* RAM */ |
| 415 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK1); |
| 416 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK2); |
| 415 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK1); |
| 416 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK2); |
| 417 | 417 | memory_set_bankptr(1, pc8801_mainRAM + 0x0000); |
| 418 | 418 | memory_set_bankptr(2, pc8801_mainRAM + 0x6000); |
| 419 | 419 | } |
| r2817 | r2818 | |
| 421 | 421 | { |
| 422 | 422 | /* ROM */ |
| 423 | 423 | /* write through to main RAM */ |
| 424 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, pc8801_writemem1); |
| 425 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, pc8801_writemem2); |
| 424 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, pc8801_writemem1); |
| 425 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, pc8801_writemem2); |
| 426 | 426 | if(ROMmode) |
| 427 | 427 | { |
| 428 | 428 | /* N-BASIC */ |
| r2817 | r2818 | |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /* 0x8000 to 0xffff */ |
| 447 | | memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x83ff, 0, 0, (RAMmode || ROMmode) ? SMH_BANK3 : pc8801_read_textwindow); |
| 448 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x83ff, 0, 0, (RAMmode || ROMmode) ? SMH_BANK3 : pc8801_write_textwindow); |
| 447 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x83ff, 0, 0, (RAMmode || ROMmode) ? SMH_BANK3 : pc8801_read_textwindow); |
| 448 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x83ff, 0, 0, (RAMmode || ROMmode) ? SMH_BANK3 : pc8801_write_textwindow); |
| 449 | 449 | |
| 450 | 450 | memory_set_bankptr(4, pc8801_mainRAM + 0x8400); |
| 451 | 451 | |
| 452 | | if(is_pc8801_vram_select()) |
| 452 | if(is_pc8801_vram_select(machine)) |
| 453 | 453 | { |
| 454 | 454 | /* VRAM */ |
| 455 | 455 | /* already maped */ |
| 456 | 456 | } |
| 457 | 457 | else |
| 458 | 458 | { |
| 459 | | memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, SMH_BANK5); |
| 460 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, SMH_BANK5); |
| 461 | | memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, SMH_BANK6); |
| 462 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, SMH_BANK6); |
| 459 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, SMH_BANK5); |
| 460 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, SMH_BANK5); |
| 461 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, SMH_BANK6); |
| 462 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, SMH_BANK6); |
| 463 | 463 | |
| 464 | 464 | memory_set_bankptr(5, pc8801_mainRAM + 0xc000); |
| 465 | 465 | if(maptvram) |
| r2817 | r2818 | |
| 479 | 479 | WRITE8_HANDLER(pc8801_write_extmem) |
| 480 | 480 | { |
| 481 | 481 | extmem_ctrl[offset]=data; |
| 482 | | pc8801_update_bank(); |
| 482 | pc8801_update_bank(machine); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | WRITE8_HANDLER(pc88sr_outport_31) |
| r2817 | r2818 | |
| 487 | 487 | /* bit 5 not implemented */ |
| 488 | 488 | RAMmode=((data&0x02)!=0); |
| 489 | 489 | ROMmode=((data&0x04)!=0); |
| 490 | | pc8801_update_bank(); |
| 490 | pc8801_update_bank(machine); |
| 491 | 491 | pc88sr_disp_31(machine, offset,data); |
| 492 | 492 | } |
| 493 | 493 | |
| r2817 | r2818 | |
| 505 | 505 | enable_FM_IRQ=((data & 0x80) == 0x00); |
| 506 | 506 | if(FM_IRQ_save && enable_FM_IRQ) pc8801_raise_interrupt(machine, FM_IRQ_LEVEL); |
| 507 | 507 | pc88sr_disp_32(machine, offset,data); |
| 508 | | pc8801_update_bank(); |
| 508 | pc8801_update_bank(machine); |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | READ8_HANDLER(pc8801_inport_70) |
| r2817 | r2818 | |
| 516 | 516 | WRITE8_HANDLER(pc8801_outport_70) |
| 517 | 517 | { |
| 518 | 518 | text_window=data; |
| 519 | | pc8801_update_bank(); |
| 519 | pc8801_update_bank(machine); |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | WRITE8_HANDLER(pc8801_outport_78) |
| 523 | 523 | { |
| 524 | 524 | text_window=((text_window+1)&0xff); |
| 525 | | pc8801_update_bank(); |
| 525 | pc8801_update_bank(machine); |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | READ8_HANDLER(pc88sr_inport_71) |
| r2817 | r2818 | |
| 549 | 549 | no4throm=0; |
| 550 | 550 | break; |
| 551 | 551 | } |
| 552 | | pc8801_update_bank(); |
| 552 | pc8801_update_bank(machine); |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | static void pc8801_init_bank(running_machine *machine, int hireso) |
| r2817 | r2818 | |
| 570 | 570 | memset(pc8801_mainRAM, 0, 0x10000); |
| 571 | 571 | |
| 572 | 572 | extmem_ctrl[0]=extmem_ctrl[1]=0; |
| 573 | | pc8801_update_bank(); |
| 573 | pc8801_update_bank(machine); |
| 574 | 574 | pc8801_video_init(machine, hireso); |
| 575 | 575 | |
| 576 | 576 | if(extmem_mode!=input_port_read(machine, "MEM")) { |
| r2817 | r2818 | |
| 703 | 703 | is_8MHz = ((a&0x08)!=0x00); |
| 704 | 704 | fix_V1V2(); |
| 705 | 705 | pc8801_init_bank(machine, hireso); |
| 706 | | pc8801_init_5fd(); |
| 706 | pc8801_init_5fd(machine); |
| 707 | 707 | pc8801_init_interrupt(); |
| 708 | 708 | beep_set_state(0, 0); |
| 709 | 709 | beep_set_frequency(0, 2400); |
| r2817 | r2818 | |
| 818 | 818 | pc8801_fdc_dma_drq |
| 819 | 819 | }; |
| 820 | 820 | |
| 821 | | static void pc8801_init_5fd(void) |
| 821 | static void pc8801_init_5fd(running_machine *machine) |
| 822 | 822 | { |
| 823 | | use_5FD = (input_port_read(Machine, "DSW2") & 0x80) != 0x00; |
| 823 | use_5FD = (input_port_read(machine, "DSW2") & 0x80) != 0x00; |
| 824 | 824 | if (!use_5FD) |
| 825 | 825 | cpunum_suspend(1, SUSPEND_REASON_DISABLE, 1); |
| 826 | 826 | else |