Annotation of previous/src/cpu/hatari-glue.c, revision 1.1.1.1

1.1       root        1: /*
                      2:   Hatari - hatari-glue.c
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: 
                      7:   This file contains some code to glue the UAE CPU core to the rest of the
                      8:   emulator and Hatari's "illegal" opcodes.
                      9: */
                     10: const char HatariGlue_fileid[] = "Hatari hatari-glue.c : " __DATE__ " " __TIME__;
                     11: 
                     12: 
                     13: #include <stdio.h>
                     14: 
                     15: #include "main.h"
                     16: #include "configuration.h"
                     17: #include "cycInt.h"
                     18: #include "cart.h"
                     19: #include "nextMemory.h"
                     20: #include "screen.h"
                     21: #include "video.h"
                     22: 
                     23: #include "sysdeps.h"
                     24: #include "maccess.h"
                     25: #include "memory.h"
                     26: #include "newcpu.h"
                     27: #include "hatari-glue.h"
                     28: 
                     29: 
                     30: struct uae_prefs currprefs, changed_prefs;
                     31: 
                     32: int pendingInterrupts = 0;
                     33: 
                     34: 
                     35: /**
                     36:  * Reset custom chips
                     37:  */
                     38: void customreset(void)
                     39: {
                     40:        pendingInterrupts = 0;
                     41: 
                     42:        /* In case the 6301 was executing a custom program from its RAM */
                     43:        /* we must turn it back to the 'normal' mode. */
                     44: //     IKBD_Reset_ExeMode ();
                     45: 
                     46:        /* Reseting the GLUE video chip should also set freq/res register to 0 */
                     47:        Video_Reset_Glue ();
                     48: }
                     49: 
                     50: 
                     51: /**
                     52:  * Return interrupt number (1 - 7), -1 means no interrupt.
                     53:  * Note that the interrupt stays pending if it can't be executed yet
                     54:  * due to the interrupt level field in the SR.
                     55:  */
                     56: int intlev(void)
                     57: {
                     58:        /* There are only VBL and HBL autovector interrupts in the ST... */
                     59:        assert((pendingInterrupts & ~((1<<4)|(1<<2))) == 0);
                     60: 
                     61:        if (pendingInterrupts & (1 << 4))         /* VBL interrupt? */
                     62:        {
                     63:                if (regs.intmask < 4)
                     64:                        pendingInterrupts &= ~(1 << 4);
                     65:                return 4;
                     66:        }
                     67:        else if (pendingInterrupts & (1 << 2))    /* HBL interrupt? */
                     68:        {
                     69:                if (regs.intmask < 2)
                     70:                        pendingInterrupts &= ~(1 << 2);
                     71:                return 2;
                     72:        }
                     73: 
                     74:        return -1;
                     75: }
                     76: 
                     77: /**
                     78:  * Initialize 680x0 emulation
                     79:  */
                     80: int Init680x0(void)
                     81: {
                     82:        currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel;
                     83: 
                     84:        switch (currprefs.cpu_level) {
                     85:                case 0 : currprefs.cpu_model = 68000; break;
                     86:                case 1 : currprefs.cpu_model = 68010; break;
                     87:                case 2 : currprefs.cpu_model = 68020; break;
                     88:                case 3 : currprefs.cpu_model = 68030; break;
                     89:                case 4 : currprefs.cpu_model = 68040; break;
                     90:                case 5 : currprefs.cpu_model = 68060; break;
                     91:                default: fprintf (stderr, "Init680x0() : Error, cpu_level unknown\n");
                     92:        }
                     93:        
                     94:        currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
                     95:        currprefs.address_space_24 = changed_prefs.address_space_24 = ConfigureParams.System.bAddressSpace24;
                     96:        currprefs.cpu_cycle_exact = changed_prefs.cpu_cycle_exact = ConfigureParams.System.bCycleExactCpu;
                     97:        currprefs.fpu_model = changed_prefs.fpu_model = ConfigureParams.System.n_FPUType;
                     98:        currprefs.fpu_strict = changed_prefs.fpu_strict = ConfigureParams.System.bCompatibleFPU;
                     99:        currprefs.mmu_model = changed_prefs.mmu_model = ConfigureParams.System.bMMU;
                    100: 
                    101:        init_m68k();
                    102: 
                    103:        return true;
                    104: }
                    105: 
                    106: 
                    107: /**
                    108:  * Deinitialize 680x0 emulation
                    109:  */
                    110: void Exit680x0(void)
                    111: {
                    112:        memory_uninit();
                    113: 
                    114:        free(table68k);
                    115:        table68k = NULL;
                    116: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.