ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/memory.cpp
Revision: 1.6
Committed: 2002-09-01T16:32:02Z (21 years, 9 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-12, nigel-build-13, nigel-build-16, nigel-build-15
Changes since 1.5: +3 -2 lines
Log Message:
Use B2_mutex instead of pthread mutexes when ENABLE_EXCLUSIVE_SPCFLAGS is
set. However, this is not used at the moment. Is there an advantage? People
may want to add arch-optimized SPCFLAGS_{SET,CLEAR}.

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * UAE - The Un*x Amiga Emulator
3     *
4     * Memory management
5     *
6     * (c) 1995 Bernd Schmidt
7     */
8    
9     #include <stdio.h>
10     #include <stdlib.h>
11    
12     #include "sysdeps.h"
13    
14     #include "cpu_emulation.h"
15 gbeauche 1.6 #include "main.h"
16     #include "video.h"
17    
18 cebix 1.1 #include "m68k.h"
19     #include "memory.h"
20     #include "readcpu.h"
21     #include "newcpu.h"
22    
23 gbeauche 1.3 #if !REAL_ADDRESSING && !DIRECT_ADDRESSING
24    
25 cebix 1.1 static bool illegal_mem = false;
26    
27     #ifdef SAVE_MEMORY_BANKS
28     addrbank *mem_banks[65536];
29     #else
30     addrbank mem_banks[65536];
31     #endif
32    
33 gbeauche 1.3 #ifdef WORDS_BIGENDIAN
34     # define swap_words(X) (X)
35     #else
36     # define swap_words(X) (((X) >> 16) | ((X) << 16))
37     #endif
38    
39 cebix 1.1 #ifdef NO_INLINE_MEMORY_ACCESS
40     __inline__ uae_u32 longget (uaecptr addr)
41     {
42     return call_mem_get_func (get_mem_bank (addr).lget, addr);
43     }
44     __inline__ uae_u32 wordget (uaecptr addr)
45     {
46     return call_mem_get_func (get_mem_bank (addr).wget, addr);
47     }
48     __inline__ uae_u32 byteget (uaecptr addr)
49     {
50     return call_mem_get_func (get_mem_bank (addr).bget, addr);
51     }
52     __inline__ void longput (uaecptr addr, uae_u32 l)
53     {
54     call_mem_put_func (get_mem_bank (addr).lput, addr, l);
55     }
56     __inline__ void wordput (uaecptr addr, uae_u32 w)
57     {
58     call_mem_put_func (get_mem_bank (addr).wput, addr, w);
59     }
60     __inline__ void byteput (uaecptr addr, uae_u32 b)
61     {
62     call_mem_put_func (get_mem_bank (addr).bput, addr, b);
63     }
64     #endif
65    
66     /* A dummy bank that only contains zeros */
67    
68     static uae_u32 REGPARAM2 dummy_lget (uaecptr) REGPARAM;
69     static uae_u32 REGPARAM2 dummy_wget (uaecptr) REGPARAM;
70     static uae_u32 REGPARAM2 dummy_bget (uaecptr) REGPARAM;
71     static void REGPARAM2 dummy_lput (uaecptr, uae_u32) REGPARAM;
72     static void REGPARAM2 dummy_wput (uaecptr, uae_u32) REGPARAM;
73     static void REGPARAM2 dummy_bput (uaecptr, uae_u32) REGPARAM;
74     static int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size) REGPARAM;
75    
76     uae_u32 REGPARAM2 dummy_lget (uaecptr addr)
77     {
78     if (illegal_mem)
79     write_log ("Illegal lget at %08lx\n", addr);
80    
81     return 0;
82     }
83    
84     uae_u32 REGPARAM2 dummy_wget (uaecptr addr)
85     {
86     if (illegal_mem)
87     write_log ("Illegal wget at %08lx\n", addr);
88    
89     return 0;
90     }
91    
92     uae_u32 REGPARAM2 dummy_bget (uaecptr addr)
93     {
94     if (illegal_mem)
95     write_log ("Illegal bget at %08lx\n", addr);
96    
97     return 0;
98     }
99    
100     void REGPARAM2 dummy_lput (uaecptr addr, uae_u32 l)
101     {
102     if (illegal_mem)
103     write_log ("Illegal lput at %08lx\n", addr);
104     }
105     void REGPARAM2 dummy_wput (uaecptr addr, uae_u32 w)
106     {
107     if (illegal_mem)
108     write_log ("Illegal wput at %08lx\n", addr);
109     }
110     void REGPARAM2 dummy_bput (uaecptr addr, uae_u32 b)
111     {
112     if (illegal_mem)
113     write_log ("Illegal bput at %08lx\n", addr);
114     }
115    
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    
124     /* Mac RAM (32 bit addressing) */
125    
126     static uae_u32 REGPARAM2 ram_lget(uaecptr) REGPARAM;
127     static uae_u32 REGPARAM2 ram_wget(uaecptr) REGPARAM;
128     static uae_u32 REGPARAM2 ram_bget(uaecptr) REGPARAM;
129     static void REGPARAM2 ram_lput(uaecptr, uae_u32) REGPARAM;
130     static void REGPARAM2 ram_wput(uaecptr, uae_u32) REGPARAM;
131     static void REGPARAM2 ram_bput(uaecptr, uae_u32) REGPARAM;
132     static int REGPARAM2 ram_check(uaecptr addr, uae_u32 size) REGPARAM;
133     static uae_u8 *REGPARAM2 ram_xlate(uaecptr addr) REGPARAM;
134    
135     static uae_u32 RAMBaseDiff; // RAMBaseHost - RAMBaseMac
136    
137     uae_u32 REGPARAM2 ram_lget(uaecptr addr)
138     {
139     uae_u32 *m;
140     m = (uae_u32 *)(RAMBaseDiff + addr);
141     return do_get_mem_long(m);
142     }
143    
144     uae_u32 REGPARAM2 ram_wget(uaecptr addr)
145     {
146     uae_u16 *m;
147     m = (uae_u16 *)(RAMBaseDiff + addr);
148     return do_get_mem_word(m);
149     }
150    
151     uae_u32 REGPARAM2 ram_bget(uaecptr addr)
152     {
153     return (uae_u32)*(uae_u8 *)(RAMBaseDiff + addr);
154     }
155    
156     void REGPARAM2 ram_lput(uaecptr addr, uae_u32 l)
157     {
158     uae_u32 *m;
159     m = (uae_u32 *)(RAMBaseDiff + addr);
160     do_put_mem_long(m, l);
161     }
162    
163     void REGPARAM2 ram_wput(uaecptr addr, uae_u32 w)
164     {
165     uae_u16 *m;
166     m = (uae_u16 *)(RAMBaseDiff + addr);
167     do_put_mem_word(m, w);
168     }
169    
170     void REGPARAM2 ram_bput(uaecptr addr, uae_u32 b)
171     {
172     *(uae_u8 *)(RAMBaseDiff + addr) = b;
173     }
174    
175     int REGPARAM2 ram_check(uaecptr addr, uae_u32 size)
176     {
177     return (addr - RAMBaseMac + size) < RAMSize;
178     }
179    
180     uae_u8 *REGPARAM2 ram_xlate(uaecptr addr)
181     {
182     return (uae_u8 *)(RAMBaseDiff + addr);
183     }
184    
185     /* Mac RAM (24 bit addressing) */
186    
187     static uae_u32 REGPARAM2 ram24_lget(uaecptr) REGPARAM;
188     static uae_u32 REGPARAM2 ram24_wget(uaecptr) REGPARAM;
189     static uae_u32 REGPARAM2 ram24_bget(uaecptr) REGPARAM;
190     static void REGPARAM2 ram24_lput(uaecptr, uae_u32) REGPARAM;
191     static void REGPARAM2 ram24_wput(uaecptr, uae_u32) REGPARAM;
192     static void REGPARAM2 ram24_bput(uaecptr, uae_u32) REGPARAM;
193     static int REGPARAM2 ram24_check(uaecptr addr, uae_u32 size) REGPARAM;
194     static uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr) REGPARAM;
195    
196     uae_u32 REGPARAM2 ram24_lget(uaecptr addr)
197     {
198     uae_u32 *m;
199     m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
200     return do_get_mem_long(m);
201     }
202    
203     uae_u32 REGPARAM2 ram24_wget(uaecptr addr)
204     {
205     uae_u16 *m;
206     m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
207     return do_get_mem_word(m);
208     }
209    
210     uae_u32 REGPARAM2 ram24_bget(uaecptr addr)
211     {
212     return (uae_u32)*(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
213     }
214    
215     void REGPARAM2 ram24_lput(uaecptr addr, uae_u32 l)
216     {
217     uae_u32 *m;
218     m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
219     do_put_mem_long(m, l);
220     }
221    
222     void REGPARAM2 ram24_wput(uaecptr addr, uae_u32 w)
223     {
224     uae_u16 *m;
225     m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
226     do_put_mem_word(m, w);
227     }
228    
229     void REGPARAM2 ram24_bput(uaecptr addr, uae_u32 b)
230     {
231     *(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff)) = b;
232     }
233    
234     int REGPARAM2 ram24_check(uaecptr addr, uae_u32 size)
235     {
236     return ((addr & 0xffffff) - RAMBaseMac + size) < RAMSize;
237     }
238    
239     uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr)
240     {
241     return (uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
242     }
243    
244     /* Mac ROM (32 bit addressing) */
245    
246     static uae_u32 REGPARAM2 rom_lget(uaecptr) REGPARAM;
247     static uae_u32 REGPARAM2 rom_wget(uaecptr) REGPARAM;
248     static uae_u32 REGPARAM2 rom_bget(uaecptr) REGPARAM;
249     static void REGPARAM2 rom_lput(uaecptr, uae_u32) REGPARAM;
250     static void REGPARAM2 rom_wput(uaecptr, uae_u32) REGPARAM;
251     static void REGPARAM2 rom_bput(uaecptr, uae_u32) REGPARAM;
252     static int REGPARAM2 rom_check(uaecptr addr, uae_u32 size) REGPARAM;
253     static uae_u8 *REGPARAM2 rom_xlate(uaecptr addr) REGPARAM;
254    
255     static uae_u32 ROMBaseDiff; // ROMBaseHost - ROMBaseMac
256    
257     uae_u32 REGPARAM2 rom_lget(uaecptr addr)
258     {
259     uae_u32 *m;
260     m = (uae_u32 *)(ROMBaseDiff + addr);
261     return do_get_mem_long(m);
262     }
263    
264     uae_u32 REGPARAM2 rom_wget(uaecptr addr)
265     {
266     uae_u16 *m;
267     m = (uae_u16 *)(ROMBaseDiff + addr);
268     return do_get_mem_word(m);
269     }
270    
271     uae_u32 REGPARAM2 rom_bget(uaecptr addr)
272     {
273     return (uae_u32)*(uae_u8 *)(ROMBaseDiff + addr);
274     }
275    
276     void REGPARAM2 rom_lput(uaecptr addr, uae_u32 b)
277     {
278     if (illegal_mem)
279     write_log ("Illegal ROM lput at %08lx\n", addr);
280     }
281    
282     void REGPARAM2 rom_wput(uaecptr addr, uae_u32 b)
283     {
284     if (illegal_mem)
285     write_log ("Illegal ROM wput at %08lx\n", addr);
286     }
287    
288     void REGPARAM2 rom_bput(uaecptr addr, uae_u32 b)
289     {
290     if (illegal_mem)
291     write_log ("Illegal ROM bput at %08lx\n", addr);
292     }
293    
294     int REGPARAM2 rom_check(uaecptr addr, uae_u32 size)
295     {
296     return (addr - ROMBaseMac + size) < ROMSize;
297     }
298    
299     uae_u8 *REGPARAM2 rom_xlate(uaecptr addr)
300     {
301     return (uae_u8 *)(ROMBaseDiff + addr);
302     }
303    
304     /* Mac ROM (24 bit addressing) */
305    
306     static uae_u32 REGPARAM2 rom24_lget(uaecptr) REGPARAM;
307     static uae_u32 REGPARAM2 rom24_wget(uaecptr) REGPARAM;
308     static uae_u32 REGPARAM2 rom24_bget(uaecptr) REGPARAM;
309     static int REGPARAM2 rom24_check(uaecptr addr, uae_u32 size) REGPARAM;
310     static uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr) REGPARAM;
311    
312     uae_u32 REGPARAM2 rom24_lget(uaecptr addr)
313     {
314     uae_u32 *m;
315     m = (uae_u32 *)(ROMBaseDiff + (addr & 0xffffff));
316     return do_get_mem_long(m);
317     }
318    
319     uae_u32 REGPARAM2 rom24_wget(uaecptr addr)
320     {
321     uae_u16 *m;
322     m = (uae_u16 *)(ROMBaseDiff + (addr & 0xffffff));
323     return do_get_mem_word(m);
324     }
325    
326     uae_u32 REGPARAM2 rom24_bget(uaecptr addr)
327     {
328     return (uae_u32)*(uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
329     }
330    
331     int REGPARAM2 rom24_check(uaecptr addr, uae_u32 size)
332     {
333     return ((addr & 0xffffff) - ROMBaseMac + size) < ROMSize;
334     }
335    
336     uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr)
337     {
338     return (uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
339     }
340    
341     /* Frame buffer */
342    
343     static uae_u32 REGPARAM2 frame_direct_lget(uaecptr) REGPARAM;
344     static uae_u32 REGPARAM2 frame_direct_wget(uaecptr) REGPARAM;
345     static uae_u32 REGPARAM2 frame_direct_bget(uaecptr) REGPARAM;
346     static void REGPARAM2 frame_direct_lput(uaecptr, uae_u32) REGPARAM;
347     static void REGPARAM2 frame_direct_wput(uaecptr, uae_u32) REGPARAM;
348     static void REGPARAM2 frame_direct_bput(uaecptr, uae_u32) REGPARAM;
349    
350     static uae_u32 REGPARAM2 frame_host_555_lget(uaecptr) REGPARAM;
351     static uae_u32 REGPARAM2 frame_host_555_wget(uaecptr) REGPARAM;
352     static void REGPARAM2 frame_host_555_lput(uaecptr, uae_u32) REGPARAM;
353     static void REGPARAM2 frame_host_555_wput(uaecptr, uae_u32) REGPARAM;
354    
355     static uae_u32 REGPARAM2 frame_host_565_lget(uaecptr) REGPARAM;
356     static uae_u32 REGPARAM2 frame_host_565_wget(uaecptr) REGPARAM;
357     static void REGPARAM2 frame_host_565_lput(uaecptr, uae_u32) REGPARAM;
358     static void REGPARAM2 frame_host_565_wput(uaecptr, uae_u32) REGPARAM;
359    
360     static uae_u32 REGPARAM2 frame_host_888_lget(uaecptr) REGPARAM;
361     static void REGPARAM2 frame_host_888_lput(uaecptr, uae_u32) REGPARAM;
362    
363     static int REGPARAM2 frame_check(uaecptr addr, uae_u32 size) REGPARAM;
364     static uae_u8 *REGPARAM2 frame_xlate(uaecptr addr) REGPARAM;
365    
366     static uae_u32 FrameBaseDiff; // MacFrameBaseHost - MacFrameBaseMac
367    
368     uae_u32 REGPARAM2 frame_direct_lget(uaecptr addr)
369     {
370     uae_u32 *m;
371     m = (uae_u32 *)(FrameBaseDiff + addr);
372     return do_get_mem_long(m);
373     }
374    
375     uae_u32 REGPARAM2 frame_direct_wget(uaecptr addr)
376     {
377     uae_u16 *m;
378     m = (uae_u16 *)(FrameBaseDiff + addr);
379     return do_get_mem_word(m);
380     }
381    
382     uae_u32 REGPARAM2 frame_direct_bget(uaecptr addr)
383     {
384     return (uae_u32)*(uae_u8 *)(FrameBaseDiff + addr);
385     }
386    
387     void REGPARAM2 frame_direct_lput(uaecptr addr, uae_u32 l)
388     {
389     uae_u32 *m;
390     m = (uae_u32 *)(FrameBaseDiff + addr);
391     do_put_mem_long(m, l);
392     }
393    
394     void REGPARAM2 frame_direct_wput(uaecptr addr, uae_u32 w)
395     {
396     uae_u16 *m;
397     m = (uae_u16 *)(FrameBaseDiff + addr);
398     do_put_mem_word(m, w);
399     }
400    
401     void REGPARAM2 frame_direct_bput(uaecptr addr, uae_u32 b)
402     {
403     *(uae_u8 *)(FrameBaseDiff + addr) = b;
404     }
405    
406     uae_u32 REGPARAM2 frame_host_555_lget(uaecptr addr)
407     {
408     uae_u32 *m, l;
409     m = (uae_u32 *)(FrameBaseDiff + addr);
410     l = *m;
411 gbeauche 1.3 return swap_words(l);
412 cebix 1.1 }
413    
414     uae_u32 REGPARAM2 frame_host_555_wget(uaecptr addr)
415     {
416     uae_u16 *m;
417     m = (uae_u16 *)(FrameBaseDiff + addr);
418     return *m;
419     }
420    
421     void REGPARAM2 frame_host_555_lput(uaecptr addr, uae_u32 l)
422     {
423     uae_u32 *m;
424     m = (uae_u32 *)(FrameBaseDiff + addr);
425 gbeauche 1.3 *m = swap_words(l);
426 cebix 1.1 }
427    
428     void REGPARAM2 frame_host_555_wput(uaecptr addr, uae_u32 w)
429     {
430     uae_u16 *m;
431     m = (uae_u16 *)(FrameBaseDiff + addr);
432     *m = w;
433     }
434    
435     uae_u32 REGPARAM2 frame_host_565_lget(uaecptr addr)
436     {
437     uae_u32 *m, l;
438     m = (uae_u32 *)(FrameBaseDiff + addr);
439     l = *m;
440     l = (l & 0x001f001f) | ((l >> 1) & 0x7fe07fe0);
441 gbeauche 1.3 return swap_words(l);
442 cebix 1.1 }
443    
444     uae_u32 REGPARAM2 frame_host_565_wget(uaecptr addr)
445     {
446     uae_u16 *m, w;
447     m = (uae_u16 *)(FrameBaseDiff + addr);
448     w = *m;
449     return (w & 0x1f) | ((w >> 1) & 0x7fe0);
450     }
451    
452     void REGPARAM2 frame_host_565_lput(uaecptr addr, uae_u32 l)
453     {
454     uae_u32 *m;
455     m = (uae_u32 *)(FrameBaseDiff + addr);
456     l = (l & 0x001f001f) | ((l << 1) & 0xffc0ffc0);
457 gbeauche 1.3 *m = swap_words(l);
458 cebix 1.1 }
459    
460     void REGPARAM2 frame_host_565_wput(uaecptr addr, uae_u32 w)
461     {
462     uae_u16 *m;
463     m = (uae_u16 *)(FrameBaseDiff + addr);
464     *m = (w & 0x1f) | ((w << 1) & 0xffc0);
465     }
466    
467     uae_u32 REGPARAM2 frame_host_888_lget(uaecptr addr)
468     {
469     uae_u32 *m, l;
470     m = (uae_u32 *)(FrameBaseDiff + addr);
471     return *m;
472     }
473    
474     void REGPARAM2 frame_host_888_lput(uaecptr addr, uae_u32 l)
475     {
476     uae_u32 *m;
477     m = (uae_u32 *)(MacFrameBaseHost + addr - MacFrameBaseMac);
478     *m = l;
479     }
480    
481     int REGPARAM2 frame_check(uaecptr addr, uae_u32 size)
482     {
483     return (addr - MacFrameBaseMac + size) < MacFrameSize;
484     }
485    
486     uae_u8 *REGPARAM2 frame_xlate(uaecptr addr)
487     {
488     return (uae_u8 *)(FrameBaseDiff + addr);
489     }
490    
491     /* Default memory access functions */
492    
493     int REGPARAM2 default_check (uaecptr a, uae_u32 b)
494     {
495     return 0;
496     }
497    
498     uae_u8 *REGPARAM2 default_xlate (uaecptr a)
499     {
500     write_log("Your Mac program just did something terribly stupid\n");
501     return NULL;
502     }
503    
504     /* Address banks */
505    
506     addrbank dummy_bank = {
507     dummy_lget, dummy_wget, dummy_bget,
508     dummy_lput, dummy_wput, dummy_bput,
509     default_xlate, dummy_check
510     };
511    
512     addrbank ram_bank = {
513     ram_lget, ram_wget, ram_bget,
514     ram_lput, ram_wput, ram_bput,
515     ram_xlate, ram_check
516     };
517    
518     addrbank ram24_bank = {
519     ram24_lget, ram24_wget, ram24_bget,
520     ram24_lput, ram24_wput, ram24_bput,
521     ram24_xlate, ram24_check
522     };
523    
524     addrbank rom_bank = {
525     rom_lget, rom_wget, rom_bget,
526     rom_lput, rom_wput, rom_bput,
527     rom_xlate, rom_check
528     };
529    
530     addrbank rom24_bank = {
531     rom24_lget, rom24_wget, rom24_bget,
532     rom_lput, rom_wput, rom_bput,
533     rom24_xlate, rom24_check
534     };
535    
536     addrbank frame_direct_bank = {
537     frame_direct_lget, frame_direct_wget, frame_direct_bget,
538     frame_direct_lput, frame_direct_wput, frame_direct_bput,
539     frame_xlate, frame_check
540     };
541    
542     addrbank frame_host_555_bank = {
543     frame_host_555_lget, frame_host_555_wget, frame_direct_bget,
544     frame_host_555_lput, frame_host_555_wput, frame_direct_bput,
545     frame_xlate, frame_check
546     };
547    
548     addrbank frame_host_565_bank = {
549     frame_host_565_lget, frame_host_565_wget, frame_direct_bget,
550     frame_host_565_lput, frame_host_565_wput, frame_direct_bput,
551     frame_xlate, frame_check
552     };
553    
554     addrbank frame_host_888_bank = {
555     frame_host_888_lget, frame_direct_wget, frame_direct_bget,
556     frame_host_888_lput, frame_direct_wput, frame_direct_bput,
557     frame_xlate, frame_check
558     };
559    
560     void memory_init(void)
561     {
562 cebix 1.4 for(long i=0; i<65536; i++)
563 cebix 1.1 put_mem_bank(i<<16, &dummy_bank);
564    
565     // Limit RAM size to not overlap ROM
566     uint32 ram_size = RAMSize > ROMBaseMac ? ROMBaseMac : RAMSize;
567    
568 cebix 1.2 RAMBaseDiff = (uae_u32)RAMBaseHost - (uae_u32)RAMBaseMac;
569     ROMBaseDiff = (uae_u32)ROMBaseHost - (uae_u32)ROMBaseMac;
570     FrameBaseDiff = (uae_u32)MacFrameBaseHost - (uae_u32)MacFrameBaseMac;
571    
572     // Map RAM and ROM
573 cebix 1.1 if (TwentyFourBitAddressing) {
574     map_banks(&ram24_bank, RAMBaseMac >> 16, ram_size >> 16);
575     map_banks(&rom24_bank, ROMBaseMac >> 16, ROMSize >> 16);
576     } else {
577     map_banks(&ram_bank, RAMBaseMac >> 16, ram_size >> 16);
578     map_banks(&rom_bank, ROMBaseMac >> 16, ROMSize >> 16);
579     }
580    
581 cebix 1.2 // Map frame buffer
582 cebix 1.1 switch (MacFrameLayout) {
583     case FLAYOUT_DIRECT:
584     map_banks(&frame_direct_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
585     break;
586     case FLAYOUT_HOST_555:
587     map_banks(&frame_host_555_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
588     break;
589     case FLAYOUT_HOST_565:
590     map_banks(&frame_host_565_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
591     break;
592     case FLAYOUT_HOST_888:
593     map_banks(&frame_host_888_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
594     break;
595     }
596     }
597    
598     void map_banks(addrbank *bank, int start, int size)
599     {
600     int bnr;
601     unsigned long int hioffs = 0, endhioffs = 0x100;
602    
603     if (start >= 0x100) {
604     for (bnr = start; bnr < start + size; bnr++)
605     put_mem_bank (bnr << 16, bank);
606     return;
607     }
608     if (TwentyFourBitAddressing) endhioffs = 0x10000;
609     for (hioffs = 0; hioffs < endhioffs; hioffs += 0x100)
610     for (bnr = start; bnr < start+size; bnr++)
611     put_mem_bank((bnr + hioffs) << 16, bank);
612     }
613 gbeauche 1.3
614     #endif /* !REAL_ADDRESSING && !DIRECT_ADDRESSING */
615