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

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.5 ! root        9: static char rcsid[] = "Hatari $Id: reset.c,v 1.5 2003/06/20 13:13:21 thothy Exp $";
1.1       root       10: 
                     11: #include "main.h"
                     12: #include "cart.h"
                     13: #include "decode.h"
                     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.4   root       37:   return Reset_ST(TRUE);
1.1       root       38: }
                     39: 
1.1.1.2   root       40: 
                     41: /*-----------------------------------------------------------------------*/
1.1       root       42: /*
                     43:   Warm reset ST (reset registers, leave in same state and reboot)
                     44: */
1.1.1.4   root       45: int Reset_Warm(void)
1.1       root       46: {
1.1.1.4   root       47:   return Reset_ST(FALSE);
1.1       root       48: }
                     49: 
1.1.1.2   root       50: 
                     51: /*-----------------------------------------------------------------------*/
1.1       root       52: /*
                     53:   Reset ST emulator states, chips, interrupts and registers
                     54: */
1.1.1.4   root       55: int Reset_ST(BOOL bCold)
1.1       root       56: {
1.1.1.4   root       57:   if (bCold)
                     58:   {
                     59:     int ret;
                     60: 
                     61:     STMemory_Clear(0x00000000, 0x00400000);   /* Clear First 4Mb */
                     62:     STMemory_Clear(0x00e00000, 0x00ffffff);   /* Clear Upper memory */
                     63:     STMemory_WriteLong(4, 0x00fc0000);        /* Set reset vector */
                     64:     STMemory_WriteLong(0, 0x0000f000);        /* And reset stack pointer */
1.1.1.2   root       65: 
                     66:     Floppy_GetBootDrive();      /* Find which device to boot from(A: or C:) */
                     67:     Cart_LoadImage();           /* Load program into cartridge memory. Used for gemdos loading */
1.1.1.4   root       68: 
                     69:     ret = TOS_LoadImage();      /* Load TOS, writes into cartridge memory */
                     70:     if(ret)
                     71:     {
                     72:       return ret;               /* If we can not load a TOS image, return now! */
                     73:     }
1.1       root       74:   }
1.1.1.2   root       75:   Int_Reset();                  /* Reset interrupts */
                     76:   MFP_Reset();                  /* Setup MFP chip */
                     77:   Video_Reset();                /* Reset video */
1.1.1.4   root       78: 
1.1.1.5 ! root       79:   GemDOS_Reset();               /* Reset GEMDOS emulation */
1.1.1.4   root       80:   if (bCold)
                     81:   {
1.1.1.2   root       82:     FDC_Reset();                /* Reset FDC */
1.1       root       83:   }
1.1.1.4   root       84: 
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.4   root       92:   Int_AddAbsoluteInterrupt(CYCLES_ENDLINE, INTERRUPT_VIDEO_ENDLINE);
                     93:   Int_AddAbsoluteInterrupt(CYCLES_HBL, INTERRUPT_VIDEO_HBL);
                     94:   Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME, INTERRUPT_VIDEO_VBL);
1.1.1.2   root       95:   /* And keyboard check for debugger */
1.1       root       96: #ifdef USE_DEBUGGER
1.1.1.4   root       97:   Int_AddAbsoluteInterrupt(CYCLES_DEBUGGER, INTERRUPT_DEBUGGER);
1.1       root       98: #endif
1.1.1.4   root       99: 
                    100:   return 0;
1.1       root      101: }

unix.superglobalmegacorp.com

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