trunk/src/emu/video/ef9340_1.c
| r20393 | r20394 | |
| 139 | 139 | switch( m_ef9341.TB & 0xE0 ) |
| 140 | 140 | { |
| 141 | 141 | case 0x00: /* Begin row */ |
| 142 | logerror("begin row\n"); |
| 142 | 143 | m_ef9340.X = 0; |
| 143 | 144 | m_ef9340.Y = m_ef9341.TA & 0x1F; |
| 144 | 145 | break; |
| 145 | 146 | case 0x20: /* Load Y */ |
| 147 | logerror("load y\n"); |
| 146 | 148 | m_ef9340.Y = m_ef9341.TA & 0x1F; |
| 147 | 149 | break; |
| 148 | 150 | case 0x40: /* Load X */ |
| 151 | logerror("load x\n"); |
| 149 | 152 | m_ef9340.X = m_ef9341.TA & 0x3F; |
| 150 | 153 | break; |
| 151 | 154 | case 0x60: /* INC C */ |
| 155 | logerror("inc c\n"); |
| 152 | 156 | ef9340_inc_c(); |
| 153 | 157 | break; |
| 154 | 158 | case 0x80: /* Load M */ |
| 159 | logerror("load m\n"); |
| 155 | 160 | m_ef9340.M = m_ef9341.TA; |
| 156 | 161 | break; |
| 157 | 162 | case 0xA0: /* Load R */ |
| 163 | logerror("load r\n"); |
| 158 | 164 | m_ef9340.R = m_ef9341.TA; |
| 159 | 165 | break; |
| 160 | 166 | case 0xC0: /* Load Y0 */ |
| 167 | logerror("load y0\n"); |
| 161 | 168 | m_ef9340.Y0 = m_ef9341.TA & 0x3F; |
| 162 | 169 | break; |
| 163 | 170 | } |
| r20393 | r20394 | |
| 205 | 212 | UINT8 b = m_ef934x_ram_b[addr]; |
| 206 | 213 | UINT8 slice = ( m_ef9340.M & 0x0f ) % 10; |
| 207 | 214 | |
| 215 | logerror("write slice addr=%04x, b=%02x\n", addr, b); |
| 208 | 216 | if ( b >= 0xa0 ) |
| 209 | 217 | { |
| 210 | | m_ef934x_ext_char_ram[ external_chargen_address( b, slice ) ] = m_ef9341.TA; |
| 218 | logerror("write slice external ram %04x\n", external_chargen_address(b,slice)); |
| 219 | m_ef934x_ext_char_ram[ external_chargen_address( b, slice ) ] = BITSWAP8(m_ef9341.TA,0,1,2,3,4,5,6,7); |
| 211 | 220 | } |
| 212 | 221 | |
| 213 | 222 | // Increment slice number |
| r20393 | r20394 | |
| 216 | 225 | break; |
| 217 | 226 | |
| 218 | 227 | case 0xA0: /* Read slice */ |
| 228 | default: |
| 219 | 229 | fatalerror/*logerror*/("ef9341 unimplemented data action %02X\n", m_ef9340.M & 0xE0 ); |
| 220 | 230 | break; |
| 221 | 231 | } |
| r20393 | r20394 | |
| 238 | 248 | { |
| 239 | 249 | if ( b ) |
| 240 | 250 | { |
| 241 | | data = 0xFF; |
| 251 | data = 0; |
| 242 | 252 | } |
| 243 | 253 | else |
| 244 | 254 | { |
| r20393 | r20394 | |
| 308 | 318 | if ( a & 0x80 ) |
| 309 | 319 | { |
| 310 | 320 | // Graphics |
| 321 | if ( b & 0x80 ) |
| 322 | { |
| 323 | if ( b & 0x60 ) |
| 324 | { |
| 325 | // Extension |
| 326 | char_data = m_ef934x_ext_char_ram[ external_chargen_address( b & 0x7f, slice ) ]; |
| 327 | fg = bgr2rgb[ a & 0x07 ]; |
| 328 | bg = bgr2rgb[ ( a >> 4 ) & 0x07 ]; |
| 329 | } |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | // Normal |
| 334 | char_data = ef9341_char_set[1][b & 0x7f][slice]; |
| 335 | fg = bgr2rgb[ a & 0x07 ]; |
| 336 | bg = bgr2rgb[ ( a >> 4 ) & 0x07 ]; |
| 337 | } |
| 311 | 338 | } |
| 312 | 339 | else |
| 313 | 340 | { |
| 314 | 341 | // Alphannumeric |
| 315 | 342 | if ( b & 0x80 ) |
| 316 | 343 | { |
| 317 | | // Special (DEL or Extension) |
| 344 | if ( b & 0x60 ) |
| 345 | { |
| 346 | // Extension |
| 347 | char_data = m_ef934x_ext_char_ram[ external_chargen_address( b & 0x7f, slice ) ]; |
| 348 | fg = bgr2rgb[ a & 0x07 ]; |
| 349 | } |
| 350 | else |
| 351 | { |
| 352 | // DEL |
| 353 | } |
| 318 | 354 | } |
| 319 | 355 | else |
| 320 | 356 | { |
trunk/src/mess/drivers/odyssey2.c
| r20393 | r20394 | |
| 75 | 75 | static const UINT8 P1_KEYBOARD_SCAN_ENABLE = 0x04; /* active low */ |
| 76 | 76 | static const UINT8 P1_VDC_ENABLE = 0x08; /* active low */ |
| 77 | 77 | static const UINT8 P1_EXT_RAM_ENABLE = 0x10; /* active low */ |
| 78 | static const UINT8 P1_VPP_ENABLE = 0x20; /* active low */ |
| 78 | 79 | static const UINT8 P1_VDC_COPY_MODE_ENABLE = 0x40; |
| 79 | 80 | static const UINT8 P2_KEYBOARD_SELECT_MASK = 0x07; /* select row to scan */ |
| 80 | 81 | |
| r20393 | r20394 | |
| 216 | 217 | 0x50,0xAE,0xFF, /* Blue */ // I r g B |
| 217 | 218 | 0x00,0xFF,0x00, /* Dk Green */ // I r G b |
| 218 | 219 | 0x82,0xfb,0xdb, /* Lt Grey */ // I r G B |
| 219 | | 0xEC,0x02,0x60, /* Red */ // I R g b |
| 220 | 0xff,0x80,0x80, /* Red */ // I R g b |
| 220 | 221 | 0xa9,0x80,0xff, /* Violet */ // I R g B |
| 221 | 222 | 0xff,0x9b,0x60, /* Orange */ // I R G b |
| 222 | 223 | 0xFF,0xFF,0xFF, // I R G B |
| r20393 | r20394 | |
| 348 | 349 | { |
| 349 | 350 | if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) |
| 350 | 351 | { |
| 351 | | return m_i8244->read(space, offset); /* seems to have higher priority than ram??? */ |
| 352 | return m_i8244->read(space, offset); |
| 352 | 353 | } |
| 353 | 354 | if (!(m_p1 & P1_EXT_RAM_ENABLE)) |
| 354 | 355 | { |
| r20393 | r20394 | |
| 388 | 389 | { |
| 389 | 390 | if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) |
| 390 | 391 | { |
| 391 | | return m_i8244->read(space, offset); /* seems to have higher priority than ram??? */ |
| 392 | return m_i8244->read(space, offset); |
| 392 | 393 | } |
| 393 | 394 | else if (!(m_p1 & P1_EXT_RAM_ENABLE)) |
| 394 | 395 | { |
| 395 | 396 | return m_ram[offset]; |
| 396 | 397 | } |
| 397 | | else |
| 398 | else if (!(m_p1 & P1_VPP_ENABLE)) |
| 398 | 399 | { |
| 399 | 400 | return m_ef9340_1->ef9341_read( offset & 0x02, offset & 0x01 ); |
| 400 | 401 | } |
| r20393 | r20394 | |
| 413 | 414 | { |
| 414 | 415 | m_i8244->write(space, offset, data); |
| 415 | 416 | } |
| 416 | | else |
| 417 | else if (!(m_p1 & P1_VPP_ENABLE)) |
| 417 | 418 | { |
| 418 | 419 | m_ef9340_1->ef9341_write( offset & 0x02, offset & 0x01, data ); |
| 419 | 420 | } |
| r20393 | r20394 | |
| 425 | 426 | int vpos = data; |
| 426 | 427 | bitmap_ind16 *bitmap = m_i8244->get_bitmap(); |
| 427 | 428 | |
| 429 | if ( vpos < i8244_device::START_Y || vpos >= i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) |
| 430 | { |
| 431 | return; |
| 432 | } |
| 433 | |
| 428 | 434 | // apply external LUM setting |
| 429 | 435 | for ( int x = i8244_device::START_ACTIVE_SCAN; x < i8244_device::END_ACTIVE_SCAN; x++ ) |
| 430 | 436 | { |
| r20393 | r20394 | |
| 440 | 446 | bitmap_ind16 *bitmap = m_i8244->get_bitmap(); |
| 441 | 447 | bitmap_ind16 *ef934x_bitmap = m_ef9340_1->get_bitmap(); |
| 442 | 448 | |
| 449 | if ( vpos < i8244_device::START_Y || vpos >= i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) |
| 450 | { |
| 451 | return; |
| 452 | } |
| 453 | |
| 443 | 454 | // apply external LUM setting |
| 444 | 455 | int x_real_start = i8244_device::START_ACTIVE_SCAN + i8244_device::BORDER_SIZE; |
| 445 | 456 | int x_real_end = i8244_device::END_ACTIVE_SCAN - i8244_device::BORDER_SIZE; |
| r20393 | r20394 | |
| 447 | 458 | { |
| 448 | 459 | UINT16 d = bitmap->pix16( vpos, x ); |
| 449 | 460 | |
| 450 | | if ( ( ! m_g7400_ic678_decode[ d & 0x07 ] ) && x >= x_real_start && x < x_real_end ) |
| 461 | if ( ( ! m_g7400_ic678_decode[ d & 0x07 ] ) && x >= x_real_start && x < x_real_end && y < 240 ) |
| 451 | 462 | { |
| 452 | 463 | // Use EF934x input |
| 453 | 464 | d = ef934x_bitmap->pix16( y, x - x_real_start ) & 0x07; |
| r20393 | r20394 | |
| 487 | 498 | { |
| 488 | 499 | UINT8 data = m_p1; |
| 489 | 500 | |
| 490 | | logerror("%.9f p1 read %.2x\n", machine().time().as_double(), data); |
| 491 | 501 | return data; |
| 492 | 502 | } |
| 493 | 503 | |
| r20393 | r20394 | |
| 498 | 508 | m_lum = ( data & 0x80 ) >> 4; |
| 499 | 509 | |
| 500 | 510 | switch_banks(); |
| 501 | | |
| 502 | | logerror("%.6f p1 written %.2x\n", machine().time().as_double(), data); |
| 503 | 511 | } |
| 504 | 512 | |
| 505 | 513 | |
| r20393 | r20394 | |
| 537 | 545 | m_p2 = m_p2 | 0xF0; |
| 538 | 546 | } |
| 539 | 547 | |
| 540 | | logerror("%.6f p2 read %.2x\n", machine().time().as_double(), m_p2); |
| 541 | 548 | return m_p2; |
| 542 | 549 | } |
| 543 | 550 | |
| r20393 | r20394 | |
| 550 | 557 | { |
| 551 | 558 | m_i8243->i8243_p2_w( space, 0, m_p2 & 0x0f ); |
| 552 | 559 | } |
| 553 | | |
| 554 | | logerror("%.6f p2 written %.2x\n", machine().time().as_double(), data); |
| 555 | 560 | } |
| 556 | 561 | |
| 557 | 562 | |
| r20393 | r20394 | |
| 569 | 574 | data &= ioport("JOY1")->read(); /* read joystick 2 */ |
| 570 | 575 | } |
| 571 | 576 | |
| 572 | | logerror("%.6f bus read %.2x\n", machine().time().as_double(), data); |
| 573 | 577 | return data; |
| 574 | 578 | } |
| 575 | 579 | |
| r20393 | r20394 | |
| 589 | 593 | switch ( offset & 3 ) |
| 590 | 594 | { |
| 591 | 595 | case 0: // "port 4" |
| 596 | logerror("setting ef-port4 to %02x\n", data); |
| 592 | 597 | m_g7400_ic674_decode[4] = BIT(data,0); |
| 593 | 598 | m_g7400_ic674_decode[5] = BIT(data,1); |
| 594 | 599 | m_g7400_ic674_decode[6] = BIT(data,2); |
| r20393 | r20394 | |
| 596 | 601 | break; |
| 597 | 602 | |
| 598 | 603 | case 1: // "port 5" |
| 604 | logerror("setting ef-port5 to %02x\n", data); |
| 599 | 605 | m_g7400_ic674_decode[0] = BIT(data,0); |
| 600 | 606 | m_g7400_ic674_decode[1] = BIT(data,1); |
| 601 | 607 | m_g7400_ic674_decode[2] = BIT(data,2); |
| r20393 | r20394 | |
| 603 | 609 | break; |
| 604 | 610 | |
| 605 | 611 | case 2: // "port 6" |
| 612 | logerror("setting vdc-port6 to %02x\n", data); |
| 606 | 613 | m_g7400_ic678_decode[4] = BIT(data,0); |
| 607 | 614 | m_g7400_ic678_decode[5] = BIT(data,1); |
| 608 | 615 | m_g7400_ic678_decode[6] = BIT(data,2); |
| r20393 | r20394 | |
| 610 | 617 | break; |
| 611 | 618 | |
| 612 | 619 | case 3: // "port 7" |
| 620 | logerror("setting vdc-port7 to %02x\n", data); |
| 613 | 621 | m_g7400_ic678_decode[0] = BIT(data,0); |
| 614 | 622 | m_g7400_ic678_decode[1] = BIT(data,1); |
| 615 | 623 | m_g7400_ic678_decode[2] = BIT(data,2); |