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

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

unix.superglobalmegacorp.com

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