ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/memory.cpp
(Generate patch)

Comparing BasiliskII/src/uae_cpu/memory.cpp (file contents):
Revision 1.8 by gbeauche, 2005-06-05T07:32:23Z vs.
Revision 1.10 by asvitkine, 2012-03-30T01:25:46Z

# Line 1 | Line 1
1 < /*
2 <  * UAE - The Un*x Amiga Emulator
3 <  *
4 <  * Memory management
5 <  *
6 <  * (c) 1995 Bernd Schmidt
7 <  */
1 > /*
2 > * UAE - The Un*x Amiga Emulator
3 > *
4 > * Memory management
5 > *
6 > * (c) 1995 Bernd Schmidt
7 > *
8 > * This program is free software; you can redistribute it and/or modify
9 > * it under the terms of the GNU General Public License as published by
10 > * the Free Software Foundation; either version 2 of the License, or
11 > * (at your option) any later version.
12 > *
13 > * This program is distributed in the hope that it will be useful,
14 > * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 > * GNU General Public License for more details.
17 > *
18 > * You should have received a copy of the GNU General Public License
19 > * along with this program; if not, write to the Free Software
20 > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 > */
22  
23   #include <stdio.h>
24   #include <stdlib.h>
# Line 71 | Line 85 | static uae_u32 REGPARAM2 dummy_bget (uae
85   static void REGPARAM2 dummy_lput (uaecptr, uae_u32) REGPARAM;
86   static void REGPARAM2 dummy_wput (uaecptr, uae_u32) REGPARAM;
87   static void REGPARAM2 dummy_bput (uaecptr, uae_u32) REGPARAM;
74 static int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size) REGPARAM;
88  
89   uae_u32 REGPARAM2 dummy_lget (uaecptr addr)
90   {
# Line 113 | Line 126 | void REGPARAM2 dummy_bput (uaecptr addr,
126          write_log ("Illegal bput at %08lx\n", addr);
127   }
128  
116 int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size)
117 {
118    if (illegal_mem)
119        write_log ("Illegal check at %08lx\n", addr);
120
121    return 0;
122 }
123
129   /* Mac RAM (32 bit addressing) */
130  
131   static uae_u32 REGPARAM2 ram_lget(uaecptr) REGPARAM;
# Line 129 | Line 134 | static uae_u32 REGPARAM2 ram_bget(uaecpt
134   static void REGPARAM2 ram_lput(uaecptr, uae_u32) REGPARAM;
135   static void REGPARAM2 ram_wput(uaecptr, uae_u32) REGPARAM;
136   static void REGPARAM2 ram_bput(uaecptr, uae_u32) REGPARAM;
132 static int REGPARAM2 ram_check(uaecptr addr, uae_u32 size) REGPARAM;
137   static uae_u8 *REGPARAM2 ram_xlate(uaecptr addr) REGPARAM;
138  
139   static uintptr RAMBaseDiff;     // RAMBaseHost - RAMBaseMac
# Line 172 | Line 176 | void REGPARAM2 ram_bput(uaecptr addr, ua
176          *(uae_u8 *)(RAMBaseDiff + addr) = b;
177   }
178  
175 int REGPARAM2 ram_check(uaecptr addr, uae_u32 size)
176 {
177    return (addr - RAMBaseMac + size) < RAMSize;
178 }
179
179   uae_u8 *REGPARAM2 ram_xlate(uaecptr addr)
180   {
181      return (uae_u8 *)(RAMBaseDiff + addr);
# Line 190 | Line 189 | static uae_u32 REGPARAM2 ram24_bget(uaec
189   static void REGPARAM2 ram24_lput(uaecptr, uae_u32) REGPARAM;
190   static void REGPARAM2 ram24_wput(uaecptr, uae_u32) REGPARAM;
191   static void REGPARAM2 ram24_bput(uaecptr, uae_u32) REGPARAM;
193 static int REGPARAM2 ram24_check(uaecptr addr, uae_u32 size) REGPARAM;
192   static uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr) REGPARAM;
193  
194   uae_u32 REGPARAM2 ram24_lget(uaecptr addr)
# Line 231 | Line 229 | void REGPARAM2 ram24_bput(uaecptr addr,
229          *(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff)) = b;
230   }
231  
234 int REGPARAM2 ram24_check(uaecptr addr, uae_u32 size)
235 {
236    return ((addr & 0xffffff) - RAMBaseMac + size) < RAMSize;
237 }
238
232   uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr)
233   {
234      return (uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
# Line 249 | Line 242 | static uae_u32 REGPARAM2 rom_bget(uaecpt
242   static void REGPARAM2 rom_lput(uaecptr, uae_u32) REGPARAM;
243   static void REGPARAM2 rom_wput(uaecptr, uae_u32) REGPARAM;
244   static void REGPARAM2 rom_bput(uaecptr, uae_u32) REGPARAM;
252 static int REGPARAM2 rom_check(uaecptr addr, uae_u32 size) REGPARAM;
245   static uae_u8 *REGPARAM2 rom_xlate(uaecptr addr) REGPARAM;
246  
247   static uintptr ROMBaseDiff;     // ROMBaseHost - ROMBaseMac
# Line 291 | Line 283 | void REGPARAM2 rom_bput(uaecptr addr, ua
283          write_log ("Illegal ROM bput at %08lx\n", addr);
284   }
285  
294 int REGPARAM2 rom_check(uaecptr addr, uae_u32 size)
295 {
296    return (addr - ROMBaseMac + size) < ROMSize;
297 }
298
286   uae_u8 *REGPARAM2 rom_xlate(uaecptr addr)
287   {
288      return (uae_u8 *)(ROMBaseDiff + addr);
# Line 306 | Line 293 | uae_u8 *REGPARAM2 rom_xlate(uaecptr addr
293   static uae_u32 REGPARAM2 rom24_lget(uaecptr) REGPARAM;
294   static uae_u32 REGPARAM2 rom24_wget(uaecptr) REGPARAM;
295   static uae_u32 REGPARAM2 rom24_bget(uaecptr) REGPARAM;
309 static int REGPARAM2 rom24_check(uaecptr addr, uae_u32 size) REGPARAM;
296   static uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr) REGPARAM;
297  
298   uae_u32 REGPARAM2 rom24_lget(uaecptr addr)
# Line 328 | Line 314 | uae_u32 REGPARAM2 rom24_bget(uaecptr add
314      return (uae_u32)*(uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
315   }
316  
331 int REGPARAM2 rom24_check(uaecptr addr, uae_u32 size)
332 {
333    return ((addr & 0xffffff) - ROMBaseMac + size) < ROMSize;
334 }
335
317   uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr)
318   {
319      return (uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
# Line 360 | Line 341 | static void REGPARAM2 frame_host_565_wpu
341   static uae_u32 REGPARAM2 frame_host_888_lget(uaecptr) REGPARAM;
342   static void REGPARAM2 frame_host_888_lput(uaecptr, uae_u32) REGPARAM;
343  
363 static int REGPARAM2 frame_check(uaecptr addr, uae_u32 size) REGPARAM;
344   static uae_u8 *REGPARAM2 frame_xlate(uaecptr addr) REGPARAM;
345  
346   static uintptr FrameBaseDiff;   // MacFrameBaseHost - MacFrameBaseMac
# Line 478 | Line 458 | void REGPARAM2 frame_host_888_lput(uaecp
458      *m = l;
459   }
460  
481 int REGPARAM2 frame_check(uaecptr addr, uae_u32 size)
482 {
483    return (addr - MacFrameBaseMac + size) < MacFrameSize;
484 }
485
461   uae_u8 *REGPARAM2 frame_xlate(uaecptr addr)
462   {
463      return (uae_u8 *)(FrameBaseDiff + addr);
# Line 490 | Line 465 | uae_u8 *REGPARAM2 frame_xlate(uaecptr ad
465  
466   /* Default memory access functions */
467  
493 int REGPARAM2 default_check (uaecptr a, uae_u32 b)
494 {
495    return 0;
496 }
497
468   uae_u8 *REGPARAM2 default_xlate (uaecptr a)
469   {
470      write_log("Your Mac program just did something terribly stupid\n");
# Line 506 | Line 476 | uae_u8 *REGPARAM2 default_xlate (uaecptr
476   addrbank dummy_bank = {
477      dummy_lget, dummy_wget, dummy_bget,
478      dummy_lput, dummy_wput, dummy_bput,
479 <    default_xlate, dummy_check
479 >    default_xlate
480   };
481  
482   addrbank ram_bank = {
483      ram_lget, ram_wget, ram_bget,
484      ram_lput, ram_wput, ram_bput,
485 <    ram_xlate, ram_check
485 >    ram_xlate
486   };
487  
488   addrbank ram24_bank = {
489      ram24_lget, ram24_wget, ram24_bget,
490      ram24_lput, ram24_wput, ram24_bput,
491 <    ram24_xlate, ram24_check
491 >    ram24_xlate
492   };
493  
494   addrbank rom_bank = {
495      rom_lget, rom_wget, rom_bget,
496      rom_lput, rom_wput, rom_bput,
497 <    rom_xlate, rom_check
497 >    rom_xlate
498   };
499  
500   addrbank rom24_bank = {
501      rom24_lget, rom24_wget, rom24_bget,
502      rom_lput, rom_wput, rom_bput,
503 <    rom24_xlate, rom24_check
503 >    rom24_xlate
504   };
505  
506   addrbank frame_direct_bank = {
507      frame_direct_lget, frame_direct_wget, frame_direct_bget,
508      frame_direct_lput, frame_direct_wput, frame_direct_bput,
509 <    frame_xlate, frame_check
509 >    frame_xlate
510   };
511  
512   addrbank frame_host_555_bank = {
513      frame_host_555_lget, frame_host_555_wget, frame_direct_bget,
514      frame_host_555_lput, frame_host_555_wput, frame_direct_bput,
515 <    frame_xlate, frame_check
515 >    frame_xlate
516   };
517  
518   addrbank frame_host_565_bank = {
519      frame_host_565_lget, frame_host_565_wget, frame_direct_bget,
520      frame_host_565_lput, frame_host_565_wput, frame_direct_bput,
521 <    frame_xlate, frame_check
521 >    frame_xlate
522   };
523  
524   addrbank frame_host_888_bank = {
525      frame_host_888_lget, frame_direct_wget, frame_direct_bget,
526      frame_host_888_lput, frame_direct_wput, frame_direct_bput,
527 <    frame_xlate, frame_check
527 >    frame_xlate
528   };
529  
530   void memory_init(void)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines