Annotation of hatari/src/reset.c, revision 1.1.1.23

1.1       root        1: /*
                      2:   Hatari
                      3: 
1.1.1.18  root        4:   This file is distributed under the GNU General Public License, version 2
                      5:   or at your option any later version. Read the file gpl.txt for details.
1.1.1.4   root        6: 
                      7:   Reset emulation state.
1.1       root        8: */
1.1.1.13  root        9: const char Reset_fileid[] = "Hatari reset.c : " __DATE__ " " __TIME__;
1.1       root       10: 
                     11: #include "main.h"
1.1.1.10  root       12: #include "configuration.h"
1.1       root       13: #include "cart.h"
1.1.1.8   root       14: #include "dmaSnd.h"
1.1.1.14  root       15: #include "crossbar.h"
1.1       root       16: #include "fdc.h"
                     17: #include "floppy.h"
                     18: #include "gemdos.h"
1.1.1.19  root       19: #include "hdc.h"
1.1.1.18  root       20: #include "acia.h"
1.1       root       21: #include "ikbd.h"
1.1.1.23! root       22: #include "ioMem.h"
1.1.1.14  root       23: #include "cycInt.h"
1.1       root       24: #include "m68000.h"
                     25: #include "mfp.h"
1.1.1.12  root       26: #include "midi.h"
1.1.1.23! root       27: #include "ncr5380.h"
1.1       root       28: #include "psg.h"
                     29: #include "reset.h"
1.1.1.23! root       30: #include "scc.h"
1.1       root       31: #include "screen.h"
                     32: #include "sound.h"
                     33: #include "stMemory.h"
                     34: #include "tos.h"
1.1.1.10  root       35: #include "vdi.h"
1.1.1.18  root       36: #include "nvram.h"
1.1       root       37: #include "video.h"
1.1.1.10  root       38: #include "falcon/videl.h"
1.1.1.17  root       39: #include "falcon/dsp.h"
1.1.1.15  root       40: #include "debugcpu.h"
                     41: #include "debugdsp.h"
1.1.1.21  root       42: #include "nf_scsidrv.h"
1.1.1.2   root       43: 
                     44: /*-----------------------------------------------------------------------*/
1.1.1.10  root       45: /**
                     46:  * Reset ST emulator states, chips, interrupts and registers.
                     47:  * Return zero or negative TOS image load error code.
                     48:  */
1.1.1.11  root       49: static int Reset_ST(bool bCold)
1.1       root       50: {
1.1.1.10  root       51:        if (bCold)
                     52:        {
                     53:                int ret;
                     54: 
1.1.1.23! root       55:                IoMem_Reset();
1.1.1.10  root       56:                Floppy_GetBootDrive();      /* Find which device to boot from (A: or C:) */
                     57: 
1.1.1.23! root       58:                ret = TOS_InitImage();      /* Load TOS and copy it into ROM memory */
1.1.1.10  root       59:                if (ret)
                     60:                        return ret;               /* If we can not load a TOS image, return now! */
                     61: 
                     62:                Cart_ResetImage();          /* Load cartridge program into ROM memory. */
1.1.1.23! root       63: 
1.1.1.21  root       64:                /* Video timings can change only on cold boot (wakeup states) */
                     65:                Video_SetTimings ( ConfigureParams.System.nMachineType , ConfigureParams.System.VideoTimingMode );
1.1.1.10  root       66:        }
1.1.1.22  root       67: 
                     68:        STMemory_Reset (bCold);
1.1.1.14  root       69:        CycInt_Reset();               /* Reset interrupts */
1.1.1.10  root       70:        MFP_Reset();                  /* Setup MFP chip */
                     71:        Video_Reset();                /* Reset video */
1.1.1.16  root       72:        VDI_Reset();                  /* Reset internal VDI variables */
1.1.1.18  root       73:        NvRam_Reset();                /* reset NvRAM (video) settings */
1.1.1.10  root       74: 
                     75:        GemDOS_Reset();               /* Reset GEMDOS emulation */
                     76:        if (bCold)
                     77:        {
1.1.1.19  root       78:                FDC_Reset( bCold );     /* Reset FDC */
1.1.1.10  root       79:        }
1.1.1.16  root       80:        Floppy_Reset();                 /* Reset Floppy */
1.1.1.10  root       81: 
1.1.1.21  root       82:        if (Config_IsMachineFalcon() || Config_IsMachineTT())
1.1.1.19  root       83:        {
                     84:                Ncr5380_Reset();
                     85:        }
                     86: 
1.1.1.21  root       87:        if (Config_IsMachineFalcon())
1.1.1.19  root       88:        {
1.1.1.17  root       89:                DSP_Reset();                  /* Reset the DSP */
1.1.1.14  root       90:                Crossbar_Reset(bCold);        /* Reset Crossbar sound */
1.1.1.17  root       91:        }
1.1.1.14  root       92:        else
                     93:                DmaSnd_Reset(bCold);          /* Reset DMA sound */
                     94: 
1.1.1.10  root       95:        PSG_Reset();                  /* Reset PSG */
                     96:        Sound_Reset();                /* Reset Sound */
1.1.1.18  root       97:        ACIA_Reset( ACIA_Array );     /* ACIA */
                     98:        IKBD_Reset(bCold);            /* Keyboard (after ACIA) */
1.1.1.23! root       99:        SCC_Reset();
1.1.1.21  root      100:        if (Config_IsMachineFalcon() && !bUseVDIRes)
1.1.1.10  root      101:                VIDEL_reset();
                    102:        else
1.1.1.23! root      103:                Screen_Reset();         /* Reset screen */
        !           104: 
        !           105:        M68000_Reset(bCold);            /* Reset CPU */
1.1.1.10  root      106: 
1.1.1.15  root      107:        DebugCpu_SetDebugging();      /* Re-set debugging flag if needed */
                    108:        DebugDsp_SetDebugging();
                    109: 
1.1.1.12  root      110:        Midi_Reset();
                    111: 
1.1.1.21  root      112: #if defined(__linux__)
                    113:         nf_scsidrv_reset();
                    114: #endif
                    115: 
1.1.1.13  root      116:        /* Start HBL, Timer B and VBL interrupts with a 0 cycle delay */
                    117:        Video_StartInterrupts( 0 );
1.1.1.7   root      118: 
1.1.1.10  root      119:        return 0;
1.1       root      120: }
                    121: 
1.1.1.2   root      122: 
                    123: /*-----------------------------------------------------------------------*/
1.1.1.10  root      124: /**
                    125:  * Cold reset ST (reset memory, all registers and reboot)
                    126:  */
                    127: int Reset_Cold(void)
1.1       root      128: {
1.1.1.20  root      129:        /* Set mouse pointer to the middle of the screen */
                    130:        Main_WarpMouse(sdlscrn->w/2, sdlscrn->h/2, false);
1.1.1.10  root      131: 
1.1.1.13  root      132:        return Reset_ST(true);
1.1       root      133: }
                    134: 
1.1.1.2   root      135: 
                    136: /*-----------------------------------------------------------------------*/
1.1.1.10  root      137: /**
                    138:  * Warm reset ST (reset registers, leave in same state and reboot)
                    139:  */
                    140: int Reset_Warm(void)
1.1       root      141: {
1.1.1.13  root      142:        return Reset_ST(false);
1.1       root      143: }

unix.superglobalmegacorp.com

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