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

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.9 ! root        9: const char Reset_rcsid[] = "Hatari $Id: reset.c,v 1.14 2006/02/21 14:15:35 thothy Exp $";
1.1       root       10: 
                     11: #include "main.h"
                     12: #include "cart.h"
1.1.1.8   root       13: #include "dmaSnd.h"
1.1       root       14: #include "fdc.h"
                     15: #include "floppy.h"
                     16: #include "gemdos.h"
                     17: #include "ikbd.h"
                     18: #include "int.h"
                     19: #include "m68000.h"
                     20: #include "misc.h"
                     21: #include "mfp.h"
                     22: #include "psg.h"
                     23: #include "reset.h"
                     24: #include "screen.h"
                     25: #include "sound.h"
                     26: #include "stMemory.h"
                     27: #include "tos.h"
                     28: #include "video.h"
                     29: 
1.1.1.2   root       30: 
                     31: /*-----------------------------------------------------------------------*/
1.1       root       32: /*
                     33:   Cold reset ST (reset memory, all registers and reboot)
                     34: */
1.1.1.4   root       35: int Reset_Cold(void)
1.1       root       36: {
1.1.1.7   root       37:   Main_WarpMouse(sdlscrn->w/2, sdlscrn->h/2);  /* Set mouse pointer to the middle of the screen */
                     38: 
1.1.1.4   root       39:   return Reset_ST(TRUE);
1.1       root       40: }
                     41: 
1.1.1.2   root       42: 
                     43: /*-----------------------------------------------------------------------*/
1.1       root       44: /*
                     45:   Warm reset ST (reset registers, leave in same state and reboot)
                     46: */
1.1.1.4   root       47: int Reset_Warm(void)
1.1       root       48: {
1.1.1.4   root       49:   return Reset_ST(FALSE);
1.1       root       50: }
                     51: 
1.1.1.2   root       52: 
                     53: /*-----------------------------------------------------------------------*/
1.1       root       54: /*
                     55:   Reset ST emulator states, chips, interrupts and registers
                     56: */
1.1.1.4   root       57: int Reset_ST(BOOL bCold)
1.1       root       58: {
1.1.1.4   root       59:   if (bCold)
                     60:   {
                     61:     int ret;
                     62: 
                     63:     STMemory_Clear(0x00e00000, 0x00ffffff);   /* Clear Upper memory */
1.1.1.2   root       64: 
                     65:     Floppy_GetBootDrive();      /* Find which device to boot from(A: or C:) */
1.1.1.9 ! root       66:     Cart_ResetImage();          /* Load cartridge program into ROM memory. */
1.1.1.4   root       67: 
                     68:     ret = TOS_LoadImage();      /* Load TOS, writes into cartridge memory */
                     69:     if(ret)
                     70:     {
                     71:       return ret;               /* If we can not load a TOS image, return now! */
                     72:     }
1.1       root       73:   }
1.1.1.2   root       74:   Int_Reset();                  /* Reset interrupts */
                     75:   MFP_Reset();                  /* Setup MFP chip */
                     76:   Video_Reset();                /* Reset video */
1.1.1.4   root       77: 
1.1.1.5   root       78:   GemDOS_Reset();               /* Reset GEMDOS emulation */
1.1.1.4   root       79:   if (bCold)
                     80:   {
1.1.1.2   root       81:     FDC_Reset();                /* Reset FDC */
1.1       root       82:   }
1.1.1.4   root       83: 
1.1.1.8   root       84:   DmaSnd_Reset(bCold);          /* Reset DMA sound */
1.1.1.2   root       85:   PSG_Reset();                  /* Reset PSG */
                     86:   Sound_Reset();                /* Reset Sound */
                     87:   IKBD_Reset(bCold);            /* Keyboard */
                     88:   Screen_Reset();               /* Reset screen */
                     89:   M68000_Reset(bCold);          /* Reset CPU */
1.1       root       90: 
1.1.1.2   root       91:   /* And VBL interrupt, MUST always be one interrupt ready to trigger */
1.1.1.9 ! root       92:   Int_AddAbsoluteInterrupt(nCyclesPerLine, INTERRUPT_VIDEO_ENDLINE);
1.1.1.4   root       93:   Int_AddAbsoluteInterrupt(CYCLES_HBL, INTERRUPT_VIDEO_HBL);
                     94:   Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME, INTERRUPT_VIDEO_VBL);
                     95: 
                     96:   return 0;
1.1       root       97: }

unix.superglobalmegacorp.com

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