comparison vdp.c @ 414:51ee0f117365

Fix vscroll calculation in double resultion interlace mode
author Mike Pavone <pavone@retrodev.com>
date Sun, 23 Jun 2013 09:17:19 -0700
parents 36fbbced25c2
children 8c60c8c09a0f
comparison
equal deleted inserted replaced
413:36fbbced25c2 414:51ee0f117365
438 #define WINDOW_RIGHT 0x80 438 #define WINDOW_RIGHT 0x80
439 #define WINDOW_DOWN 0x80 439 #define WINDOW_DOWN 0x80
440 440
441 void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line, uint16_t address, uint16_t hscroll_val, vdp_context * context) 441 void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line, uint16_t address, uint16_t hscroll_val, vdp_context * context)
442 { 442 {
443 /*if (context->double_res) { 443 if (context->double_res) {
444 line *= 2; 444 line *= 2;
445 if (context->framebuf != context->oddbuf) { 445 if (context->framebuf != context->oddbuf) {
446 line++; 446 line++;
447 } 447 }
448 }*/ 448 }
449 if (!vsram_off) { 449 if (!vsram_off) {
450 uint16_t left_col, right_col; 450 uint16_t left_col, right_col;
451 if (context->regs[REG_WINDOW_H] & WINDOW_RIGHT) { 451 if (context->regs[REG_WINDOW_H] & WINDOW_RIGHT) {
452 left_col = (context->regs[REG_WINDOW_H] & 0x1F) * 2; 452 left_col = (context->regs[REG_WINDOW_H] & 0x1F) * 2;
453 right_col = 42; 453 right_col = 42;
505 break; 505 break;
506 case 0x30: 506 case 0x30:
507 vscroll = 0x3FF; 507 vscroll = 0x3FF;
508 break; 508 break;
509 } 509 }
510 /*if (context->double_res) { 510 uint16_t v_offset_mask, vscroll_shift;
511 if (context->double_res) {
511 vscroll <<= 1; 512 vscroll <<= 1;
512 vscroll |= 1; 513 vscroll |= 1;
513 }*/ 514 v_offset_mask = 0xF;
515 vscroll_shift = 4;
516 } else {
517 v_offset_mask = 0x7;
518 vscroll_shift = 3;
519 }
514 vscroll &= (context->vsram[(context->regs[REG_MODE_3] & BIT_VSCROLL ? column : 0) + vsram_off] + line); 520 vscroll &= (context->vsram[(context->regs[REG_MODE_3] & BIT_VSCROLL ? column : 0) + vsram_off] + line);
515 context->v_offset = vscroll & 0x7; 521 context->v_offset = vscroll & v_offset_mask;
516 //printf("%s | line %d, vsram: %d, vscroll: %d, v_offset: %d\n",(vsram_off ? "B" : "A"), line, context->vsram[context->regs[REG_MODE_3] & 0x4 ? column : 0], vscroll, context->v_offset); 522 //printf("%s | line %d, vsram: %d, vscroll: %d, v_offset: %d\n",(vsram_off ? "B" : "A"), line, context->vsram[context->regs[REG_MODE_3] & 0x4 ? column : 0], vscroll, context->v_offset);
517 vscroll /= 8; 523 vscroll >>= vscroll_shift;
518 uint16_t hscroll_mask; 524 uint16_t hscroll_mask;
519 uint16_t v_mul; 525 uint16_t v_mul;
520 switch(context->regs[REG_SCROLL] & 0x3) 526 switch(context->regs[REG_SCROLL] & 0x3)
521 { 527 {
522 case 0: 528 case 0:
573 address = ((col & 0x7FF) << 5); 579 address = ((col & 0x7FF) << 5);
574 shift = 0; 580 shift = 0;
575 add = 0; 581 add = 0;
576 } 582 }
577 if (col & MAP_BIT_V_FLIP) { 583 if (col & MAP_BIT_V_FLIP) {
578 address += 28 - 4 * ((context->v_offset << shift) + add); 584 address += 28 - 4 * context->v_offset/*((context->v_offset << shift) + add)*/;
579 } else { 585 } else {
580 address += 4 * ((context->v_offset << shift) + add); 586 address += 4 * context->v_offset/*((context->v_offset << shift) + add)*/;
581 } 587 }
582 uint16_t pal_priority = (col >> 9) & 0x70; 588 uint16_t pal_priority = (col >> 9) & 0x70;
583 int32_t dir; 589 int32_t dir;
584 if (col & MAP_BIT_H_FLIP) { 590 if (col & MAP_BIT_H_FLIP) {
585 tmp_buf += 7; 591 tmp_buf += 7;