comparison vdp.c @ 87:60b5c9e2f4e0

vertical interrupts now work
author Mike Pavone <pavone@retrodev.com>
date Wed, 26 Dec 2012 20:18:58 -0800
parents 2d1ae596db7a
children 1a551a85cb06
comparison
equal deleted inserted replaced
86:3d3966c254b2 87:60b5c9e2f4e0
311 //skip auto-increment and removal of entry from fifo 311 //skip auto-increment and removal of entry from fifo
312 return; 312 return;
313 } 313 }
314 break; 314 break;
315 case CRAM_WRITE: 315 case CRAM_WRITE:
316 printf("CRAM Write: %X to %X, autoinc: %d\n", start->value, context->address, context->regs[REG_AUTOINC]); 316 //printf("CRAM Write: %X to %X\n", start->value, context->address);
317 context->cram[(context->address/2) & (CRAM_SIZE-1)] = start->value; 317 context->cram[(context->address/2) & (CRAM_SIZE-1)] = start->value;
318 break; 318 break;
319 case VSRAM_WRITE: 319 case VSRAM_WRITE:
320 if (((context->address/2) & 63) < VSRAM_SIZE) { 320 if (((context->address/2) & 63) < VSRAM_SIZE) {
321 //printf("VSRAM Write: %X to %X\n", start->value, context->address); 321 //printf("VSRAM Write: %X to %X\n", start->value, context->address);
1027 //printf("control port write: %X\n", value); 1027 //printf("control port write: %X\n", value);
1028 if (context->flags & FLAG_PENDING) { 1028 if (context->flags & FLAG_PENDING) {
1029 context->address = (context->address & 0x3FFF) | (value << 14); 1029 context->address = (context->address & 0x3FFF) | (value << 14);
1030 context->cd = (context->cd & 0x3) | ((value >> 2) & 0x3C); 1030 context->cd = (context->cd & 0x3) | ((value >> 2) & 0x3C);
1031 context->flags &= ~FLAG_PENDING; 1031 context->flags &= ~FLAG_PENDING;
1032 printf("New Address: %X, New CD: %X\n", context->address, context->cd); 1032 //printf("New Address: %X, New CD: %X\n", context->address, context->cd);
1033 if (context->cd & 0x20) { 1033 if (context->cd & 0x20) {
1034 if((context->regs[REG_DMASRC_H] & 0xC0) != 0x80) { 1034 if((context->regs[REG_DMASRC_H] & 0xC0) != 0x80) {
1035 //DMA copy or 68K -> VDP, transfer starts immediately 1035 //DMA copy or 68K -> VDP, transfer starts immediately
1036 context->flags |= FLAG_DMA_RUN; 1036 context->flags |= FLAG_DMA_RUN;
1037 if (!(context->regs[REG_DMASRC_H] & 0x80)) { 1037 if (!(context->regs[REG_DMASRC_H] & 0x80)) {
1042 } else { 1042 } else {
1043 if ((value & 0xC000) == 0x8000) { 1043 if ((value & 0xC000) == 0x8000) {
1044 //Register write 1044 //Register write
1045 uint8_t reg = (value >> 8) & 0x1F; 1045 uint8_t reg = (value >> 8) & 0x1F;
1046 if (reg < VDP_REGS) { 1046 if (reg < VDP_REGS) {
1047 printf("register %d set to %X\n", reg, value & 0xFF); 1047 //printf("register %d set to %X\n", reg, value & 0xFF);
1048 context->regs[reg] = value; 1048 context->regs[reg] = value;
1049 if (reg == REG_MODE_2) { 1049 /*if (reg == REG_MODE_2) {
1050 printf("Display is now %s\n", (context->regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled"); 1050 printf("Display is now %s\n", (context->regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
1051 } 1051 }*/
1052 } 1052 }
1053 } else { 1053 } else {
1054 context->flags |= FLAG_PENDING; 1054 context->flags |= FLAG_PENDING;
1055 context->address = (context->address &0xC000) | (value & 0x3FFF); 1055 context->address = (context->address &0xC000) | (value & 0x3FFF);
1056 context->cd = (context->cd &0x3C) | (value >> 14); 1056 context->cd = (context->cd &0x3C) | (value >> 14);