--- hatari/src/uae-cpu/memory.c 2019/04/01 07:09:16 1.1.1.1 +++ hatari/src/uae-cpu/memory.c 2019/04/01 07:10:42 1.1.1.4 @@ -1,28 +1,30 @@ /* - * UAE - The Un*x Amiga Emulator + * UAE - The Un*x Amiga Emulator - CPU core * * Memory management * * (c) 1995 Bernd Schmidt + * + * Adaptation to Hatari by Thomas Huth + * + * This file is distributed under the GNU Public License, version 2 or at + * your option any later version. Read the file gpl.txt for details. */ +static char rcsid[] = "Hatari $Id: memory.c,v 1.1.1.4 2019/04/01 07:10:42 root Exp $"; -/*#include "sysconfig.h"*/ #include "sysdeps.h" #include "hatari-glue.h" #include "maccess.h" #include "memory.h" +#include "../includes/main.h" #include "../includes/tos.h" -/* -#include "config.h" -#include "options.h" -#include "uae.h" -*/ +#include "../includes/intercept.h" +#include "../includes/reset.h" + #ifdef USE_MAPPED_MEMORY #include #endif -#include "../includes/intercept.h" - extern unsigned char STRam[16*1024*1024]; /* See hatari.c */ @@ -84,7 +86,7 @@ uae_u32 REGPARAM2 dummy_lget (uaecptr ad { special_mem |= S_READ; if (illegal_mem) - write_log ("Illegal lget at %08lx\n", addr); + write_log ("Illegal lget at %08lx\n", (long)addr); return 0; } @@ -93,7 +95,7 @@ uae_u32 REGPARAM2 dummy_wget (uaecptr ad { special_mem |= S_READ; if (illegal_mem) - write_log ("Illegal wget at %08lx\n", addr); + write_log ("Illegal wget at %08lx\n", (long)addr); return 0; } @@ -102,7 +104,7 @@ uae_u32 REGPARAM2 dummy_bget (uaecptr ad { special_mem |= S_READ; if (illegal_mem) - write_log ("Illegal bget at %08lx\n", addr); + write_log ("Illegal bget at %08lx\n", (long)addr); return 0; } @@ -111,25 +113,25 @@ void REGPARAM2 dummy_lput (uaecptr addr, { special_mem |= S_WRITE; if (illegal_mem) - write_log ("Illegal lput at %08lx\n", addr); + write_log ("Illegal lput at %08lx\n", (long)addr); } void REGPARAM2 dummy_wput (uaecptr addr, uae_u32 w) { special_mem |= S_WRITE; if (illegal_mem) - write_log ("Illegal wput at %08lx\n", addr); + write_log ("Illegal wput at %08lx\n", (long)addr); } void REGPARAM2 dummy_bput (uaecptr addr, uae_u32 b) { special_mem |= S_WRITE; if (illegal_mem) - write_log ("Illegal bput at %08lx\n", addr); + write_log ("Illegal bput at %08lx\n", (long)addr); } int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size) { if (illegal_mem) - write_log ("Illegal check at %08lx\n", addr); + write_log ("Illegal check at %08lx\n", (long)addr); return 0; } @@ -329,19 +331,19 @@ uae_u32 REGPARAM2 ROMmem_bget (uaecptr a void REGPARAM2 ROMmem_lput (uaecptr addr, uae_u32 b) { if (illegal_mem) - write_log ("Illegal ROMmem lput at %08lx\n", addr); + write_log ("Illegal ROMmem lput at %08lx\n", (long)addr); } void REGPARAM2 ROMmem_wput (uaecptr addr, uae_u32 b) { if (illegal_mem) - write_log ("Illegal ROMmem wput at %08lx\n", addr); + write_log ("Illegal ROMmem wput at %08lx\n", (long)addr); } void REGPARAM2 ROMmem_bput (uaecptr addr, uae_u32 b) { if (illegal_mem) - write_log ("Illegal ROMmem lput at %08lx\n", addr); + write_log ("Illegal ROMmem lput at %08lx\n", (long)addr); } int REGPARAM2 ROMmem_check (uaecptr addr, uae_u32 size) @@ -444,10 +446,11 @@ static void init_mem_banks (void) #define MAKE_USER_PROGRAMS_BEHAVE 1 void memory_init (void) { +/* char buffer[4096]; char *nam; int i, fd; - /*int custom_start;*/ +*/ allocated_STmem = STmem_size; allocated_TTmem = TTmem_size; @@ -471,7 +474,7 @@ void memory_init (void) memset (address_space + 0xA00000, 0xFF, 0xF00000 - 0xA00000); #endif STmemory = mmap (address_space, 0x200000, PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0); - ROMmemory = mmap (address_space + TOSAddress, ROMmem_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, fd, 0); + ROMmemory = mmap (address_space + ROMmem_start, ROMmem_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, fd, 0); close(fd); @@ -487,7 +490,7 @@ void memory_init (void) mmap (good_address_map + i + 0x1000000 - ROMmem_size, 4096, PROT_READ, MAP_FIXED | MAP_PRIVATE, good_address_fd, 0); #else - ROMmemory = STRam+TOSAddress; /*(uae_u8 *)malloc (ROMmem_size)*/; + ROMmemory = STRam+ROMmem_start; /*(uae_u8 *)malloc (ROMmem_size)*/; STmemory = STRam; /*(uae_u8 *)malloc (allocated_STmem);*/ /* while (! STmemory && allocated_STmem > 512*1024) { @@ -503,27 +506,10 @@ void memory_init (void) */ #endif - do_put_mem_long ((uae_u32 *)(STmemory), do_get_mem_long((uae_u32 *)ROMmemory)); - do_put_mem_long ((uae_u32 *)(STmemory + 4), do_get_mem_long((uae_u32 *)(ROMmemory+4))); init_mem_banks (); /* Map the STmem into all of the lower 16MB */ map_banks (&STmem_bank, 0x00, 256); -/* - custom_start = 0xC0; - map_banks (&custom_bank, custom_start, 0xE0-custom_start); - map_banks (&cia_bank, 0xA0, 32); - map_banks (&clock_bank, 0xDC, 1); -*/ - /* @@@ Does anyone have a clue what should be in the 0x200000 - 0xA00000 - * range on an Amiga without expansion memory? */ -/* - custom_start = allocated_STmem >> 16; - if (custom_start < 0x20) - custom_start = 0x20; - map_banks (&dummy_bank, custom_start, 0xA0 - custom_start); -*/ - /*map_banks (&TTram_bank, 0xDE, 1);*/ if (allocated_TTmem > 0) TTmemory = (uae_u8 *)malloc (allocated_TTmem); @@ -537,8 +523,8 @@ void memory_init (void) map_banks(&IOmem_bank, IOmem_start>>16, 1); - STmem_mask = 0x00ffffff /*allocated_STmem- 1*/; - ROMmem_mask = 0x00ffffff /*ROMmem_size - 1*/; + STmem_mask = 0x00ffffff; + ROMmem_mask = 0x00ffffff; TTmem_mask = allocated_TTmem - 1; IOmem_mask = IOmem_size - 1; }