# HG changeset patch # User Mike Pavone # Date 1355898025 28800 # Node ID a6a19c45d358b911692232f8ab54b67415a7e5e9 # Parent bc3bc7a60c4e9d21b2dba9ab4b9f43c94c4c53b0 Properly zero-init all VDP buffers. Comment out some debug printfs. diff -r bc3bc7a60c4e -r a6a19c45d358 vdp.c --- a/vdp.c Tue Dec 18 22:19:52 2012 -0800 +++ b/vdp.c Tue Dec 18 22:20:25 2012 -0800 @@ -26,8 +26,9 @@ void init_vdp_context(vdp_context * context) { - memset(context, 0, sizeof(context)); + memset(context, 0, sizeof(*context)); context->vdpmem = malloc(VRAM_SIZE); + memset(context->vdpmem, 0, VRAM_SIZE); context->framebuf = malloc(FRAMEBUF_SIZE); memset(context->framebuf, 0, FRAMEBUF_SIZE); context->linebuf = malloc(LINEBUF_SIZE + SCROLL_BUFFER_SIZE*2); @@ -191,10 +192,10 @@ { case VRAM_WRITE: if (start->partial) { - printf("VRAM Write: %X to %X\n", start->value, context->address ^ 1); + //printf("VRAM Write: %X to %X\n", start->value, context->address ^ 1); context->vdpmem[context->address ^ 1] = start->value; } else { - printf("VRAM Write: %X to %X\n", start->value >> 8, context->address); + //printf("VRAM Write: %X to %X\n", start->value >> 8, context->address); context->vdpmem[context->address] = start->value >> 8; start->partial = 1; //skip auto-increment and removal of entry from fifo @@ -202,12 +203,12 @@ } break; case CRAM_WRITE: - printf("CRAM Write: %X to %X\n", start->value, context->address); + //printf("CRAM Write: %X to %X\n", start->value, context->address); context->cram[(context->address/2) & (CRAM_SIZE-1)] = start->value; break; case VSRAM_WRITE: if (((context->address/2) & 63) < VSRAM_SIZE) { - printf("VSRAM Write: %X to %X\n", start->value, context->address); + //printf("VSRAM Write: %X to %X\n", start->value, context->address); context->vsram[(context->address/2) & 63] = start->value; } break; @@ -887,7 +888,7 @@ void vdp_control_port_write(vdp_context * context, uint16_t value) { - printf("control port write: %X\n", value); + //printf("control port write: %X\n", value); if (context->flags & FLAG_PENDING) { context->address = (context->address & 0x3FFF) | (value << 14); context->cd = (context->cd & 0x3) | ((value >> 2) & 0x3C); @@ -897,7 +898,7 @@ //Register write uint8_t reg = (value >> 8) & 0x1F; if (reg < VDP_REGS) { - printf("register %d set to %X\n", reg, value); + //printf("register %d set to %X\n", reg, value); context->regs[reg] = value; } } else { @@ -910,11 +911,11 @@ void vdp_data_port_write(vdp_context * context, uint16_t value) { - printf("data port write: %X\n", value); + //printf("data port write: %X\n", value); context->flags &= ~FLAG_PENDING; - if (context->fifo_cur == context->fifo_end) { + /*if (context->fifo_cur == context->fifo_end) { printf("FIFO full, waiting for space before next write at cycle %X\n", context->cycles); - } + }*/ while (context->fifo_cur == context->fifo_end) { vdp_run_context(context, context->cycles + ((context->latched_mode & BIT_H40) ? 16 : 20)); }