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