Annotation of previous/src/uae-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 "video.h"
                     21: 
                     22: #include "sysdeps.h"
                     23: #include "maccess.h"
                     24: #include "memory.h"
                     25: #include "newcpu.h"
                     26: #include "hatari-glue.h"
                     27: 
                     28: 
                     29: struct uae_prefs currprefs, changed_prefs;
                     30: 
                     31: int pendingInterrupts = 0;
                     32: 
                     33: 
                     34: /**
                     35:  * Reset custom chips
                     36:  */
                     37: void customreset(void)
                     38: {
                     39:        pendingInterrupts = 0;
                     40: 
                     41:        /* Reseting the GLUE video chip should also set freq/res register to 0 */
                     42:        Video_Reset_Glue ();
                     43: }
                     44: 
                     45: 
                     46: /**
                     47:  * Return interrupt number (1 - 7), -1 means no interrupt.
                     48:  * Note that the interrupt stays pending if it can't be executed yet
                     49:  * due to the interrupt level field in the SR.
                     50:  */
                     51: int intlev(void)
                     52: {
                     53:        /* There are only VBL and HBL autovector interrupts in the ST... */
                     54:        assert((pendingInterrupts & ~((1<<4)|(1<<2))) == 0);
                     55: 
                     56:        if (pendingInterrupts & (1 << 4))         /* VBL interrupt? */
                     57:        {
                     58:                if (regs.intmask < 4)
                     59:                        pendingInterrupts &= ~(1 << 4);
                     60:                return 4;
                     61:        }
                     62:        else if (pendingInterrupts & (1 << 2))    /* HBL interrupt? */
                     63:        {
                     64:                if (regs.intmask < 2)
                     65:                        pendingInterrupts &= ~(1 << 2);
                     66:                return 2;
                     67:        }
                     68: 
                     69:        return -1;
                     70: }
                     71: 
                     72: 
                     73: /**
                     74:  * Initialize 680x0 emulation
                     75:  */
                     76: int Init680x0(void)
                     77: {
                     78:        currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel;
                     79:        currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
                     80:        currprefs.address_space_24 = changed_prefs.address_space_24 = false;
                     81: 
                     82:        init_m68k();
                     83: 
                     84:        return true;
                     85: }
                     86: 
                     87: 
                     88: /**
                     89:  * Deinitialize 680x0 emulation
                     90:  */
                     91: void Exit680x0(void)
                     92: {
                     93:        memory_uninit();
                     94: 
                     95:        free(table68k);
                     96:        table68k = NULL;
                     97: }
                     98: 
                     99: 
                    100: /**
                    101:  * Check if the CPU type has been changed
                    102:  */
                    103: void check_prefs_changed_cpu(void)
                    104: {
                    105:        if (currprefs.cpu_level != changed_prefs.cpu_level
                    106:                        || currprefs.cpu_compatible != changed_prefs.cpu_compatible)
                    107:        {
                    108:                currprefs.cpu_level = changed_prefs.cpu_level;
                    109:                currprefs.cpu_compatible = changed_prefs.cpu_compatible;
                    110:                set_special(SPCFLAG_MODE_CHANGE);
                    111:                build_cpufunctbl ();
                    112:        }
                    113: }
                    114: 
                    115: 
                    116: 

unix.superglobalmegacorp.com

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