changeset 87:60b5c9e2f4e0

vertical interrupts now work
author Mike Pavone <pavone@retrodev.com>
date Wed, 26 Dec 2012 20:18:58 -0800
parents 3d3966c254b2
children c339559f1d4f
files m68k_to_x86.c runtime.S vdp.c
diffstat 3 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/m68k_to_x86.c	Wed Dec 26 18:20:23 2012 -0800
+++ b/m68k_to_x86.c	Wed Dec 26 20:18:58 2012 -0800
@@ -50,7 +50,7 @@
 
 uint8_t * check_cycles_int(uint8_t * dst, uint32_t address)
 {
-	dst = cmp_rr(dst, LIMIT, CYCLES, SZ_D);
+	dst = cmp_rr(dst, CYCLES, LIMIT, SZ_D);
 	uint8_t * jmp_off = dst+1;
 	dst = jcc(dst, CC_NC, dst + 7);
 	dst = mov_ir(dst, address, SCRATCH1, SZ_D);
--- a/runtime.S	Wed Dec 26 18:20:23 2012 -0800
+++ b/runtime.S	Wed Dec 26 20:18:58 2012 -0800
@@ -16,6 +16,7 @@
 	cmp 88(%rsi), %eax
 	jb skip_int
 	push %rcx
+	/* call print_int_dbg */
 	/* swap USP and SSP if not already in supervisor mode */
 	bt $5, 5(%rsi)
 	jc already_supervisor
@@ -50,6 +51,17 @@
 	jmp *%rcx
 skip_int:
 	ret
+	
+int_dbg_msg:
+	.asciz "Executing Interrupt!"
+print_int_dbg:
+	call m68k_save_context
+	push %rsi
+	lea int_dbg_msg(%rip), %rdi
+	call puts
+	pop %rsi
+	call m68k_load_context
+	ret
 
 	.global get_sr
 get_sr:
--- a/vdp.c	Wed Dec 26 18:20:23 2012 -0800
+++ b/vdp.c	Wed Dec 26 20:18:58 2012 -0800
@@ -313,7 +313,7 @@
 					}
 					break;
 				case CRAM_WRITE:
-					printf("CRAM Write: %X to %X, autoinc: %d\n", start->value, context->address, context->regs[REG_AUTOINC]);
+					//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:
@@ -1029,7 +1029,7 @@
 		context->address = (context->address & 0x3FFF) | (value << 14);
 		context->cd = (context->cd & 0x3) | ((value >> 2) & 0x3C);
 		context->flags &= ~FLAG_PENDING;
-		printf("New Address: %X, New CD: %X\n", context->address, context->cd);
+		//printf("New Address: %X, New CD: %X\n", context->address, context->cd);
 		if (context->cd & 0x20) {
 			if((context->regs[REG_DMASRC_H] & 0xC0) != 0x80) {
 				//DMA copy or 68K -> VDP, transfer starts immediately
@@ -1044,11 +1044,11 @@
 			//Register write
 			uint8_t reg = (value >> 8) & 0x1F;
 			if (reg < VDP_REGS) {
-				printf("register %d set to %X\n", reg, value & 0xFF);
+				//printf("register %d set to %X\n", reg, value & 0xFF);
 				context->regs[reg] = value;
-				if (reg == REG_MODE_2) {
+				/*if (reg == REG_MODE_2) {
 					printf("Display is now %s\n", (context->regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
-				}
+				}*/
 			}
 		} else {
 			context->flags |= FLAG_PENDING;