Annotation of hatari/src/cart.c, revision 1.1.1.6

1.1       root        1: /*
1.1.1.4   root        2:   Hatari - cart.c
                      3: 
                      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.
1.1       root        6: 
1.1.1.5   root        7:   Cartridge program
1.1       root        8: 
                      9:   To load programs into memory, through TOS, we need to intercept GEMDOS so we can
1.1.1.5   root       10:   relocate/execute programs via GEMDOS call $4B (Pexec).
                     11:   We have some 68000 assembler, located at 0xFA0000 (cartridge memory), which is
                     12:   used as our new GEMDOS handler. This checks if we need to intercept the call.
1.1       root       13: 
1.1.1.4   root       14:   The assembler routine can be found in 'cart_asm.s', and has been converted to a byte
1.1.1.5   root       15:   array and stored in 'Cart_data[]' (see cartdata.c).
1.1       root       16: */
1.1.1.6 ! root       17: char Cart_rcsid[] = "Hatari $Id: cart.c,v 1.8 2005/09/13 01:10:09 thothy Exp $";
1.1       root       18: 
                     19: #include "main.h"
                     20: #include "cart.h"
1.1.1.4   root       21: #include "configuration.h"
                     22: #include "file.h"
1.1       root       23: #include "stMemory.h"
1.1.1.4   root       24: #include "vdi.h"
1.1       root       25: 
1.1.1.5   root       26: #include "cartData.c"
1.1       root       27: 
                     28: 
                     29: /*-----------------------------------------------------------------------*/
                     30: /*
1.1.1.4   root       31:   Load ST GEMDOS intercept program image into cartridge memory space.
                     32:   This is used as an interface to the host file system and for GemDOS.
1.1       root       33: */
1.1.1.4   root       34: void Cart_LoadImage(void)
1.1       root       35: {
1.1.1.4   root       36:        char *pCartFileName = ConfigureParams.Rom.szCartridgeImageFileName;
                     37: 
                     38:        /* "Clear" cartridge ROM space */
                     39:        memset(&STRam[0xfa0000], 0xff, 0x20000);
                     40: 
1.1.1.6 ! root       41:        if (bUseVDIRes || ConfigureParams.HardDisk.bUseHardDiskDirectories)
1.1.1.4   root       42:        {
1.1.1.5   root       43:                /* Copy cartrige data into ST's cartridge memory */
                     44:                memcpy(&STRam[0xfa0000], Cart_data, sizeof(Cart_data));
1.1.1.4   root       45:        }
                     46:        else if (strlen(pCartFileName) > 0)
                     47:        {
                     48:                /* Check if we can load an external cartridge file: */
                     49:                if (bUseVDIRes)
                     50:                        fprintf(stderr, "Warning: Cartridge can't be used together with extended VDI resolution!\n");
1.1.1.6 ! root       51:                else if (ConfigureParams.HardDisk.bUseHardDiskDirectories)
        !            52:                        fprintf(stderr, "Warning: Cartridge can't be used together with GEMDOS hard disk emulation!\n");
1.1.1.4   root       53:                else if (!File_Exists(pCartFileName))
                     54:                        fprintf(stderr, "Cartridge file not found: %s\n", pCartFileName);
                     55:                else if (File_Length(pCartFileName) > 0x20000)
                     56:                        fprintf(stderr, "Cartridge file %s is too big.\n", pCartFileName);
                     57:                else
                     58:                {
                     59:                        /* Now we can load it: */
                     60:                        File_Read(pCartFileName, &STRam[0xfa0000], NULL, NULL);
                     61:                }
                     62:        }
1.1       root       63: }

unix.superglobalmegacorp.com

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