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

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.8 ! root        9: char Reset_rcsid[] = "Hatari $Id: reset.c,v 1.10 2005/08/21 21:13:43 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(0x00000000, 0x00400000);   /* Clear First 4Mb */
                     64:     STMemory_Clear(0x00e00000, 0x00ffffff);   /* Clear Upper memory */
                     65:     STMemory_WriteLong(4, 0x00fc0000);        /* Set reset vector */
                     66:     STMemory_WriteLong(0, 0x0000f000);        /* And reset stack pointer */
1.1.1.2   root       67: 
                     68:     Floppy_GetBootDrive();      /* Find which device to boot from(A: or C:) */
                     69:     Cart_LoadImage();           /* Load program into cartridge memory. Used for gemdos loading */
1.1.1.4   root       70: 
                     71:     ret = TOS_LoadImage();      /* Load TOS, writes into cartridge memory */
                     72:     if(ret)
                     73:     {
                     74:       return ret;               /* If we can not load a TOS image, return now! */
                     75:     }
1.1       root       76:   }
1.1.1.2   root       77:   Int_Reset();                  /* Reset interrupts */
                     78:   MFP_Reset();                  /* Setup MFP chip */
                     79:   Video_Reset();                /* Reset video */
1.1.1.4   root       80: 
1.1.1.5   root       81:   GemDOS_Reset();               /* Reset GEMDOS emulation */
1.1.1.4   root       82:   if (bCold)
                     83:   {
1.1.1.2   root       84:     FDC_Reset();                /* Reset FDC */
1.1       root       85:   }
1.1.1.4   root       86: 
1.1.1.8 ! root       87:   DmaSnd_Reset(bCold);          /* Reset DMA sound */
1.1.1.2   root       88:   PSG_Reset();                  /* Reset PSG */
                     89:   Sound_Reset();                /* Reset Sound */
                     90:   IKBD_Reset(bCold);            /* Keyboard */
                     91:   Screen_Reset();               /* Reset screen */
                     92:   M68000_Reset(bCold);          /* Reset CPU */
1.1       root       93: 
1.1.1.2   root       94:   /* And VBL interrupt, MUST always be one interrupt ready to trigger */
1.1.1.4   root       95:   Int_AddAbsoluteInterrupt(CYCLES_ENDLINE, INTERRUPT_VIDEO_ENDLINE);
                     96:   Int_AddAbsoluteInterrupt(CYCLES_HBL, INTERRUPT_VIDEO_HBL);
                     97:   Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME, INTERRUPT_VIDEO_VBL);
                     98: 
                     99:   return 0;
1.1       root      100: }

unix.superglobalmegacorp.com

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