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

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.18! root       19: #include "acia.h"
1.1       root       20: #include "ikbd.h"
1.1.1.14  root       21: #include "cycInt.h"
1.1       root       22: #include "m68000.h"
                     23: #include "mfp.h"
1.1.1.12  root       24: #include "midi.h"
1.1       root       25: #include "psg.h"
                     26: #include "reset.h"
                     27: #include "screen.h"
                     28: #include "sound.h"
                     29: #include "stMemory.h"
                     30: #include "tos.h"
1.1.1.10  root       31: #include "vdi.h"
1.1.1.18! root       32: #include "nvram.h"
1.1       root       33: #include "video.h"
1.1.1.10  root       34: #include "falcon/videl.h"
1.1.1.17  root       35: #include "falcon/dsp.h"
1.1.1.15  root       36: #include "debugcpu.h"
                     37: #include "debugdsp.h"
1.1.1.2   root       38: 
                     39: /*-----------------------------------------------------------------------*/
1.1.1.10  root       40: /**
                     41:  * Reset ST emulator states, chips, interrupts and registers.
                     42:  * Return zero or negative TOS image load error code.
                     43:  */
1.1.1.11  root       44: static int Reset_ST(bool bCold)
1.1       root       45: {
1.1.1.10  root       46:        if (bCold)
                     47:        {
                     48:                int ret;
                     49: 
                     50:                Floppy_GetBootDrive();      /* Find which device to boot from (A: or C:) */
                     51: 
                     52:                ret = TOS_LoadImage();      /* Load TOS, writes into cartridge memory */
                     53:                if (ret)
                     54:                        return ret;               /* If we can not load a TOS image, return now! */
                     55: 
                     56:                Cart_ResetImage();          /* Load cartridge program into ROM memory. */
                     57:        }
1.1.1.14  root       58:        CycInt_Reset();               /* Reset interrupts */
1.1.1.10  root       59:        MFP_Reset();                  /* Setup MFP chip */
                     60:        Video_Reset();                /* Reset video */
1.1.1.16  root       61:        VDI_Reset();                  /* Reset internal VDI variables */
1.1.1.18! root       62:        NvRam_Reset();                /* reset NvRAM (video) settings */
1.1.1.10  root       63: 
                     64:        GemDOS_Reset();               /* Reset GEMDOS emulation */
                     65:        if (bCold)
                     66:        {
                     67:                FDC_Reset();                /* Reset FDC */
                     68:        }
1.1.1.16  root       69:        Floppy_Reset();                 /* Reset Floppy */
1.1.1.10  root       70: 
1.1.1.17  root       71:        if (ConfigureParams.System.nMachineType == MACHINE_FALCON) {
                     72:                DSP_Reset();                  /* Reset the DSP */
1.1.1.14  root       73:                Crossbar_Reset(bCold);        /* Reset Crossbar sound */
1.1.1.17  root       74:        }
1.1.1.14  root       75:        else
                     76:                DmaSnd_Reset(bCold);          /* Reset DMA sound */
                     77: 
1.1.1.10  root       78:        PSG_Reset();                  /* Reset PSG */
                     79:        Sound_Reset();                /* Reset Sound */
1.1.1.18! root       80:        ACIA_Reset( ACIA_Array );     /* ACIA */
        !            81:        IKBD_Reset(bCold);            /* Keyboard (after ACIA) */
1.1.1.10  root       82:        if (ConfigureParams.System.nMachineType == MACHINE_FALCON && !bUseVDIRes)
                     83:                VIDEL_reset();
                     84:        else
                     85:                Screen_Reset();               /* Reset screen */
                     86:        M68000_Reset(bCold);          /* Reset CPU */
                     87: 
1.1.1.15  root       88:        DebugCpu_SetDebugging();      /* Re-set debugging flag if needed */
                     89:        DebugDsp_SetDebugging();
                     90: 
1.1.1.12  root       91:        Midi_Reset();
                     92: 
1.1.1.13  root       93:        /* Start HBL, Timer B and VBL interrupts with a 0 cycle delay */
                     94:        Video_StartInterrupts( 0 );
1.1.1.7   root       95: 
1.1.1.10  root       96:        return 0;
1.1       root       97: }
                     98: 
1.1.1.2   root       99: 
                    100: /*-----------------------------------------------------------------------*/
1.1.1.10  root      101: /**
                    102:  * Cold reset ST (reset memory, all registers and reboot)
                    103:  */
                    104: int Reset_Cold(void)
1.1       root      105: {
1.1.1.10  root      106:        Main_WarpMouse(sdlscrn->w/2, sdlscrn->h/2);  /* Set mouse pointer to the middle of the screen */
                    107: 
1.1.1.13  root      108:        return Reset_ST(true);
1.1       root      109: }
                    110: 
1.1.1.2   root      111: 
                    112: /*-----------------------------------------------------------------------*/
1.1.1.10  root      113: /**
                    114:  * Warm reset ST (reset registers, leave in same state and reboot)
                    115:  */
                    116: int Reset_Warm(void)
1.1       root      117: {
1.1.1.13  root      118:        return Reset_ST(false);
1.1       root      119: }

unix.superglobalmegacorp.com

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