src/main.c

changeset 55
ba6b8e570062
parent 53
e1693c4b8a0c
child 56
b3f309d46e97
     1.1 diff -r 57c6ef81ae81 -r ba6b8e570062 src/main.c
     1.2 --- a/src/main.c	Mon Dec 06 01:43:04 2010 +0000
     1.3 +++ b/src/main.c	Sun Dec 12 23:47:35 2010 +0000
     1.4 @@ -164,7 +164,11 @@
     1.5  
     1.6  	// set up system state
     1.7  	// 512K of RAM
     1.8 -	state_init(512*1024);
     1.9 +	int i;
    1.10 +	if ((i = state_init(512*1024)) != STATE_E_OK) {
    1.11 +		fprintf(stderr, "ERROR: Emulator initialisation failed. Error code %d.\n", i);
    1.12 +		return i;
    1.13 +	}
    1.14  
    1.15  	// set up musashi and reset the CPU
    1.16  	m68k_set_cpu_type(M68K_CPU_TYPE_68010);
    1.17 @@ -190,6 +194,10 @@
    1.18  
    1.19  	// Load a disc image
    1.20  	FILE *disc = fopen("discim", "rb");
    1.21 +	if (!disc) {
    1.22 +		fprintf(stderr, "ERROR loading disc image 'discim'.\n");
    1.23 +		return -4;
    1.24 +	}
    1.25  	wd2797_load(&state.fdc_ctx, disc, 512, 10, 2);
    1.26  
    1.27  	/***
    1.28 @@ -212,11 +220,6 @@
    1.29  		//
    1.30  		if (state.dmaen) { //((state.dma_count < 0x3fff) && state.dmaen) {
    1.31  			printf("DMA: copy addr=%08X count=%08X idmarw=%d dmarw=%d\n", state.dma_address, state.dma_count, state.idmarw, state.dma_reading);
    1.32 -			if (state.dmaenb) {
    1.33 -				state.dmaenb = false;
    1.34 -//				state.dma_address++;
    1.35 -				state.dma_count++;
    1.36 -			}
    1.37  			// DMA ready to go -- so do it.
    1.38  			size_t num = 0;
    1.39  			while (state.dma_count < 0x4000) {