|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
1.1.1.3 ! root 4: * AutoConfig (tm) Expansions (ZorroII/III)
! 5: *
! 6: * Copyright 1996,1997 Stefan Reinauer <[email protected]>
! 7: * Copyright 1997 Brian King <[email protected]>
! 8: * - added gfxcard code
! 9: *
1.1 root 10: */
11:
12: #include "sysconfig.h"
13: #include "sysdeps.h"
14:
15: #include "config.h"
16: #include "options.h"
1.1.1.3 ! root 17: #include "uae.h"
1.1 root 18: #include "memory.h"
19: #include "autoconf.h"
1.1.1.3 ! root 20: #include "picasso96.h"
1.1 root 21:
1.1.1.3 ! root 22: #define MAX_EXPANSION_BOARDS 8
1.1 root 23:
1.1.1.3 ! root 24: /* ********************************************************** */
1.1 root 25: /* 00 / 02 */
1.1.1.3 ! root 26: /* er_Type */
! 27:
! 28: #define Z2_MEM_8MB 0x00 /* Size of Memory Block */
! 29: #define Z2_MEM_4MB 0x07
! 30: #define Z2_MEM_2MB 0x06
! 31: #define Z2_MEM_1MB 0x05
! 32: #define Z2_MEM_512KB 0x04
! 33: #define Z2_MEM_256KB 0x03
! 34: #define Z2_MEM_128KB 0x02
! 35: #define Z2_MEM_64KB 0x01
! 36: /* extended definitions */
! 37: #define Z2_MEM_16MB 0x00
! 38: #define Z2_MEM_32MB 0x01
! 39: #define Z2_MEM_64MB 0x02
! 40: #define Z2_MEM_128MB 0x03
! 41: #define Z2_MEM_256MB 0x04
! 42: #define Z2_MEM_512MB 0x05
! 43: #define Z2_MEM_1GB 0x06
! 44:
! 45: #define chainedconfig 0x08 /* Next config is part of the same card */
! 46: #define rom_card 0x10 /* ROM vector is valid */
! 47: #define add_memory 0x20 /* Link RAM into free memory list */
1.1 root 48:
1.1.1.3 ! root 49: #define zorroII 0xc0 /* Type of Expansion Card */
! 50: #define zorroIII 0x80
1.1 root 51:
52: /* ********************************************************** */
1.1.1.3 ! root 53: /* 04 - 06 & 10-16 */
1.1 root 54:
1.1.1.3 ! root 55: /* Manufacturer */
! 56: #define commodore_g 513 /* Commodore Braunschweig (Germany) */
! 57: #define commodore 514 /* Commodore West Chester */
! 58: #define gvp 2017 /* GVP */
! 59: #define ass 2102 /* Advanced Systems & Software */
! 60: #define hackers_id 2011 /* Special ID for test cards */
! 61:
! 62: /* Card Type */
! 63: #define commodore_a2091 3 /* A2091 / A590 Card from C= */
! 64: #define commodore_a2091_ram 10 /* A2091 / A590 Ram on HD-Card */
! 65: #define commodore_a2232 70 /* A2232 Multiport Expansion */
! 66: #define ass_nexus_scsi 1 /* Nexus SCSI Controller */
1.1 root 67:
1.1.1.3 ! root 68: #define gvp_series_2_scsi 11
! 69: #define gvp_iv_24_gfx 32
1.1 root 70:
1.1.1.3 ! root 71: /* ********************************************************** */
! 72: /* 08 - 0A */
! 73: /* er_Flags */
! 74: #define Z3_MEM_64KB 0x02
! 75: #define Z3_MEM_128KB 0x03
! 76: #define Z3_MEM_256KB 0x04
! 77: #define Z3_MEM_512KB 0x05
! 78: #define Z3_MEM_1MB 0x06 /* Zorro III card subsize */
! 79: #define Z3_MEM_2MB 0x07
! 80: #define Z3_MEM_4MB 0x08
! 81: #define Z3_MEM_6MB 0x09
! 82: #define Z3_MEM_8MB 0x0a
! 83: #define Z3_MEM_10MB 0x0b
! 84: #define Z3_MEM_12MB 0x0c
! 85: #define Z3_MEM_14MB 0x0d
! 86: #define Z3_MEM_16MB 0x00
! 87: #define Z3_MEM_AUTO 0x01
! 88: #define Z3_MEM_defunct1 0x0e
! 89: #define Z3_MEM_defunct2 0x0f
! 90:
! 91: #define force_z3 0x10 /* *MUST* be set if card is Z3 */
! 92: #define ext_size 0x20 /* Use extended size table for bits 0-2 of er_Type */
! 93: #define no_shutup 0x40 /* Card cannot receive Shut_up_forever */
! 94: #define care_addr 0x80 /* Adress HAS to be $200000-$9fffff */
1.1 root 95:
96: /* ********************************************************** */
1.1.1.3 ! root 97: /* 40-42 */
! 98: /* ec_interrupt (unused) */
1.1 root 99:
1.1.1.3 ! root 100: #define enable_irq 0x01 /* enable Interrupt */
! 101: #define reset_card 0x04 /* Reset of Expansion Card - must be 0 */
! 102: #define card_int2 0x10 /* READ ONLY: IRQ 2 active */
! 103: #define card_irq6 0x20 /* READ ONLY: IRQ 6 active */
! 104: #define card_irq7 0x40 /* READ ONLY: IRQ 7 active */
! 105: #define does_irq 0x80 /* READ ONLY: Card currently throws IRQ */
1.1 root 106:
107: /* ********************************************************** */
108:
1.1.1.3 ! root 109: /* ROM defines (DiagVec) */
! 110:
! 111: #define rom_4bit (0x00<<14) /* ROM width */
! 112: #define rom_8bit (0x01<<14)
! 113: #define rom_16bit (0x02<<14)
! 114:
! 115: #define rom_never (0x00<<12) /* Never run Boot Code */
! 116: #define rom_install (0x01<<12) /* run code at install time */
! 117: #define rom_binddrv (0x02<<12) /* run code with binddrivers */
! 118:
! 119: uaecptr ROM_filesys_resname = 0, ROM_filesys_resid = 0;
! 120: uaecptr ROM_filesys_diagentry = 0;
! 121: uaecptr ROM_hardfile_resname = 0, ROM_hardfile_resid = 0;
! 122: uaecptr ROM_hardfile_init = 0;
1.1 root 123:
124: /* ********************************************************** */
125:
1.1.1.3 ! root 126: static void (*card_init[MAX_EXPANSION_BOARDS]) (void);
! 127: static void (*card_map[MAX_EXPANSION_BOARDS]) (void);
1.1 root 128:
1.1.1.3 ! root 129: static int ecard = 0;
1.1 root 130:
131: /* ********************************************************** */
132:
1.1.1.3 ! root 133: /* Please note: ZorroIII implementation seems to work different
! 134: * than described in the HRM. This claims that ZorroIII config
! 135: * address is 0xff000000 while the ZorroII config space starts
! 136: * at 0x00e80000. In reality, both, Z2 and Z3 cards are
! 137: * configured in the ZorroII config space. Kickstart 3.1 doesn't
! 138: * even do a single read or write access to the ZorroIII space.
! 139: * The original Amiga include files tell the same as the HRM.
! 140: * ZorroIII: If you set ext_size in er_Flags and give a Z2-size
! 141: * in er_Type you can very likely add some ZorroII address space
! 142: * to a ZorroIII card on a real Amiga. This is not implemented
! 143: * yet.
! 144: * -- Stefan
! 145: *
! 146: * Surprising that 0xFF000000 isn't used. Maybe it depends on the
! 147: * ROM. Anyway, the HRM says that Z3 cards may appear in Z2 config
! 148: * space, so what we are doing here is correct.
! 149: * -- Bernd
! 150: */
1.1 root 151:
1.1.1.3 ! root 152: /* Autoconfig address space at 0xE80000 */
! 153: static uae_u8 expamem[65536];
1.1 root 154:
1.1.1.3 ! root 155: static uae_u8 expamem_lo;
! 156: static uae_u16 expamem_hi;
1.1 root 157:
1.1.1.2 root 158: /*
1.1.1.3 ! root 159: * Dummy entries to show that there's no card in a slot
1.1.1.2 root 160: */
1.1 root 161:
1.1.1.3 ! root 162: static void expamem_map_clear (void)
! 163: {
! 164: fprintf (stderr, "expamem_map_clear() got called. Shouldn't happen.\n");
! 165: }
! 166:
! 167: static void expamem_init_clear (void)
! 168: {
! 169: memset (expamem, 0xff, sizeof expamem);
! 170: }
1.1 root 171:
1.1.1.3 ! root 172: static uae_u32 expamem_lget(uaecptr) REGPARAM;
! 173: static uae_u32 expamem_wget(uaecptr) REGPARAM;
! 174: static uae_u32 expamem_bget(uaecptr) REGPARAM;
! 175: static void expamem_lput(uaecptr, uae_u32) REGPARAM;
! 176: static void expamem_wput(uaecptr, uae_u32) REGPARAM;
! 177: static void expamem_bput(uaecptr, uae_u32) REGPARAM;
1.1 root 178:
1.1.1.3 ! root 179: addrbank expamem_bank = {
! 180: expamem_lget, expamem_wget, expamem_bget,
! 181: expamem_lput, expamem_wput, expamem_bput,
! 182: default_xlate, default_check
! 183: };
1.1 root 184:
1.1.1.3 ! root 185: static uae_u32 REGPARAM2 expamem_lget(uaecptr addr)
1.1 root 186: {
1.1.1.3 ! root 187: sprintf (warning_buffer, "warning: READ.L from address $%lx \n", addr);
! 188: write_log (warning_buffer);
! 189: return 0xfffffffful;
1.1 root 190: }
191:
1.1.1.3 ! root 192: static uae_u32 REGPARAM2 expamem_wget(uaecptr addr)
1.1 root 193: {
1.1.1.3 ! root 194: sprintf (warning_buffer, "warning: READ.W from address $%lx \n", addr);
! 195: write_log (warning_buffer);
! 196: return 0xffff;
! 197: }
! 198:
! 199: static uae_u32 REGPARAM2 expamem_bget(uaecptr addr)
! 200: {
! 201: uae_u8 value;
! 202: addr &= 0xFFFF;
! 203: return expamem[addr];
1.1 root 204: }
205:
1.1.1.3 ! root 206: static void REGPARAM2 expamem_write (uaecptr addr, uae_u32 value)
1.1 root 207: {
1.1.1.3 ! root 208: addr &= 0xffff;
! 209: if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) {
! 210: expamem[addr] = (value & 0xf0);
! 211: expamem[addr + 2] = (value & 0x0f) << 4;
! 212: } else {
! 213: expamem[addr] = ~(value & 0xf0);
! 214: expamem[addr + 2] = ~((value & 0x0f) << 4);
! 215: }
! 216: }
! 217:
! 218: static int REGPARAM2 expamem_type(void)
! 219: {
! 220: return ((expamem[0] | expamem[2] >> 4) & 0xc0);
! 221: }
! 222:
! 223: static void REGPARAM2 expamem_lput(uaecptr addr, uae_u32 value)
! 224: {
! 225: fprintf (stderr, "warning: WRITE.L to address $%lx : value $%lx\n", addr, value);
! 226: }
! 227:
! 228: static void REGPARAM2 expamem_wput(uaecptr addr, uae_u32 value)
! 229: {
! 230: static char buffer[80];
! 231:
! 232: if (expamem_type() != zorroIII)
! 233: fprintf (stderr, "warning: WRITE.W to address $%lx : value $%x\n", addr, value);
! 234: else {
! 235: switch (addr & 0xff) {
! 236: case 0x44:
! 237: if (expamem_type() == zorroIII) {
! 238: expamem_hi = value;
! 239: (*card_map[ecard]) ();
! 240: sprintf (buffer, " Card %d (Zorro%s) done.\n", ecard + 1, expamem_type() == 0xc0 ? "II" : "III");
! 241: write_log (buffer);
! 242: ++ecard;
! 243: if (ecard <= MAX_EXPANSION_BOARDS)
! 244: (*card_init[ecard]) ();
! 245: else
! 246: expamem_init_clear ();
! 247: }
! 248: break;
! 249: }
! 250: }
! 251: }
! 252:
! 253: static void REGPARAM2 expamem_bput(uaecptr addr, uae_u32 value)
! 254: {
! 255: static char buffer[80];
! 256:
! 257: switch (addr & 0xff) {
! 258: case 0x30:
! 259: case 0x32:
! 260: expamem_hi = 0;
! 261: expamem_lo = 0;
! 262: expamem_write (0x48, 0x00);
! 263: break;
! 264:
! 265: case 0x48:
! 266: if (expamem_type () == zorroII) {
! 267: expamem_hi = value & 0xFF;
! 268: (*card_map[ecard]) ();
! 269: sprintf (buffer, " Card %d (Zorro%s) done.\n", ecard + 1, expamem_type() == 0xc0 ? "II" : "III");
! 270: write_log (buffer);
! 271: ++ecard;
! 272: if (ecard <= MAX_EXPANSION_BOARDS)
! 273: (*card_init[ecard]) ();
! 274: else
! 275: expamem_init_clear ();
! 276: } else if (expamem_type() == zorroIII)
! 277: expamem_lo = value;
! 278: break;
! 279:
! 280: case 0x4a:
! 281: if (expamem_type () == zorroII)
! 282: expamem_lo = value;
! 283: break;
! 284:
! 285: case 0x4c:
! 286: sprintf (buffer, " Card %d (Zorro %s) had no success.\n", ecard + 1, expamem_type() == 0xc0 ? "II" : "III");
! 287: write_log (buffer);
! 288: ++ecard;
! 289: if (ecard <= MAX_EXPANSION_BOARDS)
! 290: (*card_init[ecard]) ();
! 291: else
! 292: expamem_init_clear ();
! 293: break;
! 294: }
! 295: }
! 296:
! 297: /* ********************************************************** */
! 298:
! 299: /*
! 300: * Fast Memory
! 301: */
! 302:
! 303: static uae_u32 fastmem_mask;
! 304:
! 305: static uae_u32 fastmem_lget(uaecptr) REGPARAM;
! 306: static uae_u32 fastmem_wget(uaecptr) REGPARAM;
! 307: static uae_u32 fastmem_bget(uaecptr) REGPARAM;
! 308: static void fastmem_lput(uaecptr, uae_u32) REGPARAM;
! 309: static void fastmem_wput(uaecptr, uae_u32) REGPARAM;
! 310: static void fastmem_bput(uaecptr, uae_u32) REGPARAM;
! 311: static int fastmem_check(uaecptr addr, uae_u32 size) REGPARAM;
! 312: static uae_u8 *fastmem_xlate(uaecptr addr) REGPARAM;
! 313:
! 314: static uae_u32 fastmem_start; /* Determined by the OS */
! 315: static uae_u8 *fastmemory = NULL;
! 316:
! 317: uae_u32 REGPARAM2 fastmem_lget(uaecptr addr)
! 318: {
! 319: uae_u8 *m;
1.1 root 320: addr -= fastmem_start & fastmem_mask;
321: addr &= fastmem_mask;
322: m = fastmemory + addr;
1.1.1.3 ! root 323: return do_get_mem_long ((uae_u32 *)m);
1.1 root 324: }
325:
1.1.1.3 ! root 326: uae_u32 REGPARAM2 fastmem_wget(uaecptr addr)
1.1 root 327: {
1.1.1.3 ! root 328: uae_u8 *m;
1.1 root 329: addr -= fastmem_start & fastmem_mask;
330: addr &= fastmem_mask;
331: m = fastmemory + addr;
1.1.1.3 ! root 332: return do_get_mem_word ((uae_u16 *)m);
1.1 root 333: }
334:
1.1.1.3 ! root 335: uae_u32 REGPARAM2 fastmem_bget(uaecptr addr)
1.1 root 336: {
337: addr -= fastmem_start & fastmem_mask;
338: addr &= fastmem_mask;
339: return fastmemory[addr];
340: }
341:
1.1.1.3 ! root 342: void REGPARAM2 fastmem_lput(uaecptr addr, uae_u32 l)
1.1 root 343: {
1.1.1.3 ! root 344: uae_u8 *m;
1.1 root 345: addr -= fastmem_start & fastmem_mask;
346: addr &= fastmem_mask;
347: m = fastmemory + addr;
1.1.1.3 ! root 348: do_put_mem_long ((uae_u32 *)m, l);
1.1 root 349: }
350:
1.1.1.3 ! root 351: void REGPARAM2 fastmem_wput(uaecptr addr, uae_u32 w)
1.1 root 352: {
1.1.1.3 ! root 353: uae_u8 *m;
1.1 root 354: addr -= fastmem_start & fastmem_mask;
355: addr &= fastmem_mask;
356: m = fastmemory + addr;
1.1.1.3 ! root 357: do_put_mem_word ((uae_u16 *)m, w);
1.1 root 358: }
359:
1.1.1.3 ! root 360: void REGPARAM2 fastmem_bput(uaecptr addr, uae_u32 b)
1.1 root 361: {
362: addr -= fastmem_start & fastmem_mask;
363: addr &= fastmem_mask;
364: fastmemory[addr] = b;
365: }
366:
1.1.1.3 ! root 367: static int REGPARAM2 fastmem_check(uaecptr addr, uae_u32 size)
1.1 root 368: {
369: addr -= fastmem_start & fastmem_mask;
370: addr &= fastmem_mask;
371: return (addr + size) < fastmem_size;
372: }
373:
1.1.1.3 ! root 374: static uae_u8 REGPARAM2 *fastmem_xlate(uaecptr addr)
1.1 root 375: {
376: addr -= fastmem_start & fastmem_mask;
377: addr &= fastmem_mask;
378: return fastmemory + addr;
379: }
380:
381: addrbank fastmem_bank = {
382: fastmem_lget, fastmem_wget, fastmem_bget,
383: fastmem_lput, fastmem_wput, fastmem_bput,
384: fastmem_xlate, fastmem_check
385: };
386:
387:
388: /*
389: * Filesystem device ROM
1.1.1.3 ! root 390: * This is very simple, the Amiga shouldn't be doing things with it.
1.1 root 391: */
392:
1.1.1.3 ! root 393: static uae_u32 filesys_lget(uaecptr) REGPARAM;
! 394: static uae_u32 filesys_wget(uaecptr) REGPARAM;
! 395: static uae_u32 filesys_bget(uaecptr) REGPARAM;
! 396: static void filesys_lput(uaecptr, uae_u32) REGPARAM;
! 397: static void filesys_wput(uaecptr, uae_u32) REGPARAM;
! 398: static void filesys_bput(uaecptr, uae_u32) REGPARAM;
1.1 root 399:
1.1.1.3 ! root 400: static uae_u32 filesys_start; /* Determined by the OS */
! 401: uae_u8 filesysory[65536];
1.1 root 402:
1.1.1.3 ! root 403: uae_u32 REGPARAM2 filesys_lget(uaecptr addr)
1.1 root 404: {
1.1.1.3 ! root 405: uae_u8 *m;
1.1 root 406: addr -= filesys_start & 65535;
407: addr &= 65535;
408: m = filesysory + addr;
1.1.1.3 ! root 409: return do_get_mem_long ((uae_u32 *)m);
1.1 root 410: }
411:
1.1.1.3 ! root 412: uae_u32 REGPARAM2 filesys_wget(uaecptr addr)
1.1 root 413: {
1.1.1.3 ! root 414: uae_u8 *m;
1.1 root 415: addr -= filesys_start & 65535;
416: addr &= 65535;
417: m = filesysory + addr;
1.1.1.3 ! root 418: return do_get_mem_word ((uae_u16 *)m);
1.1 root 419: }
420:
1.1.1.3 ! root 421: uae_u32 REGPARAM2 filesys_bget(uaecptr addr)
1.1 root 422: {
423: addr -= filesys_start & 65535;
424: addr &= 65535;
425: return filesysory[addr];
426: }
427:
1.1.1.3 ! root 428: static void REGPARAM2 filesys_lput(uaecptr addr, uae_u32 l)
1.1 root 429: {
1.1.1.3 ! root 430: write_log ("filesys_lput called\n");
1.1 root 431: }
432:
1.1.1.3 ! root 433: static void REGPARAM2 filesys_wput(uaecptr addr, uae_u32 w)
1.1 root 434: {
1.1.1.3 ! root 435: write_log ("filesys_wput called\n");
1.1 root 436: }
437:
1.1.1.3 ! root 438: static void REGPARAM2 filesys_bput(uaecptr addr, uae_u32 b)
1.1 root 439: {
1.1.1.3 ! root 440: fprintf (stderr, "filesys_bput called. This usually means that you are using\n");
! 441: fprintf (stderr, "Kickstart 1.2. Please give UAE the \"-a\" option next time\n");
! 442: fprintf (stderr, "you start it. If you are _not_ using Kickstart 1.2, then\n");
! 443: fprintf (stderr, "there's a bug somewhere.\n");
! 444: fprintf (stderr, "Exiting...\n");
! 445: uae_quit ();
1.1 root 446: }
447:
448: addrbank filesys_bank = {
449: filesys_lget, filesys_wget, filesys_bget,
450: filesys_lput, filesys_wput, filesys_bput,
451: default_xlate, default_check
452: };
453:
1.1.1.3 ! root 454: /*
! 455: * Z3fastmem Memory
! 456: */
1.1 root 457:
458:
1.1.1.3 ! root 459: static uae_u32 z3fastmem_mask;
1.1 root 460:
1.1.1.3 ! root 461: static uae_u32 z3fastmem_lget(uaecptr) REGPARAM;
! 462: static uae_u32 z3fastmem_wget(uaecptr) REGPARAM;
! 463: static uae_u32 z3fastmem_bget(uaecptr) REGPARAM;
! 464: static void z3fastmem_lput(uaecptr, uae_u32) REGPARAM;
! 465: static void z3fastmem_wput(uaecptr, uae_u32) REGPARAM;
! 466: static void z3fastmem_bput(uaecptr, uae_u32) REGPARAM;
! 467: static int z3fastmem_check(uaecptr addr, uae_u32 size) REGPARAM;
! 468: static uae_u8 *z3fastmem_xlate(uaecptr addr) REGPARAM;
! 469:
! 470: static uae_u32 z3fastmem_start; /* Determined by the OS */
! 471: static uae_u8 *z3fastmem = NULL;
1.1 root 472:
1.1.1.3 ! root 473: uae_u32 REGPARAM2 z3fastmem_lget(uaecptr addr)
1.1 root 474: {
1.1.1.3 ! root 475: uae_u8 *m;
! 476: addr -= z3fastmem_start & z3fastmem_mask;
! 477: addr &= z3fastmem_mask;
! 478: m = z3fastmem + addr;
! 479: return do_get_mem_long ((uae_u32 *)m);
1.1 root 480: }
481:
1.1.1.3 ! root 482: uae_u32 REGPARAM2 z3fastmem_wget(uaecptr addr)
1.1 root 483: {
1.1.1.3 ! root 484: uae_u8 *m;
! 485: addr -= z3fastmem_start & z3fastmem_mask;
! 486: addr &= z3fastmem_mask;
! 487: m = z3fastmem + addr;
! 488: return do_get_mem_word ((uae_u16 *)m);
1.1 root 489: }
490:
1.1.1.3 ! root 491: uae_u32 REGPARAM2 z3fastmem_bget(uaecptr addr)
1.1 root 492: {
1.1.1.3 ! root 493: addr -= z3fastmem_start & z3fastmem_mask;
! 494: addr &= z3fastmem_mask;
! 495: return z3fastmem[addr];
1.1 root 496: }
497:
1.1.1.3 ! root 498: void REGPARAM2 z3fastmem_lput(uaecptr addr, uae_u32 l)
1.1 root 499: {
1.1.1.3 ! root 500: uae_u8 *m;
! 501: addr -= z3fastmem_start & z3fastmem_mask;
! 502: addr &= z3fastmem_mask;
! 503: m = z3fastmem + addr;
! 504: do_put_mem_long ((uae_u32 *)m, l);
1.1 root 505: }
506:
1.1.1.3 ! root 507: void REGPARAM2 z3fastmem_wput(uaecptr addr, uae_u32 w)
1.1 root 508: {
1.1.1.3 ! root 509: uae_u8 *m;
! 510: addr -= z3fastmem_start & z3fastmem_mask;
! 511: addr &= z3fastmem_mask;
! 512: m = z3fastmem + addr;
! 513: do_put_mem_word ((uae_u16 *)m, w);
1.1 root 514: }
515:
1.1.1.3 ! root 516: void REGPARAM2 z3fastmem_bput(uaecptr addr, uae_u32 b)
1.1 root 517: {
1.1.1.3 ! root 518: addr -= z3fastmem_start & z3fastmem_mask;
! 519: addr &= z3fastmem_mask;
! 520: z3fastmem[addr] = b;
1.1 root 521: }
522:
1.1.1.3 ! root 523: static int REGPARAM2 z3fastmem_check(uaecptr addr, uae_u32 size)
1.1 root 524: {
1.1.1.3 ! root 525: addr -= z3fastmem_start & z3fastmem_mask;
! 526: addr &= z3fastmem_mask;
! 527: return (addr + size) < z3fastmem_size;
1.1 root 528: }
529:
1.1.1.3 ! root 530: static uae_u8 REGPARAM2 *z3fastmem_xlate(uaecptr addr)
1.1 root 531: {
1.1.1.3 ! root 532: addr -= z3fastmem_start & z3fastmem_mask;
! 533: addr &= z3fastmem_mask;
! 534: return z3fastmem + addr;
! 535: }
1.1 root 536:
1.1.1.3 ! root 537: addrbank z3fastmem_bank = {
! 538: z3fastmem_lget, z3fastmem_wget, z3fastmem_bget,
! 539: z3fastmem_lput, z3fastmem_wput, z3fastmem_bput,
! 540: z3fastmem_xlate, z3fastmem_check
! 541: };
1.1 root 542:
1.1.1.3 ! root 543: /* Z3-based UAEGFX-card */
! 544: uae_u32 gfxmem_mask; /* for memory.c */
! 545: uae_u8 *gfxmemory;
! 546: uae_u32 gfxmem_start;
1.1 root 547:
1.1.1.3 ! root 548: /* ********************************************************** */
1.1 root 549:
1.1.1.2 root 550: /*
1.1 root 551: * Expansion Card (ZORRO II) for 1/2/4/8 MB of Fast Memory
1.1.1.2 root 552: */
1.1 root 553:
1.1.1.3 ! root 554: static void expamem_map_fastcard (void)
1.1 root 555: {
1.1.1.3 ! root 556: char buffer[80];
! 557: fastmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
1.1 root 558: map_banks (&fastmem_bank, fastmem_start >> 16, fastmem_size >> 16);
1.1.1.3 ! root 559: sprintf (buffer, "Fastcard: mapped @$%lx: %dMB fast memory\n", fastmem_start, fastmem_size >> 20);
! 560: write_log (buffer);
1.1 root 561: }
562:
1.1.1.3 ! root 563: static void expamem_init_fastcard (void)
1.1 root 564: {
565: expamem_init_clear();
1.1.1.3 ! root 566: if (fastmem_size == 0x100000)
! 567: expamem_write (0x00, Z2_MEM_1MB + add_memory + zorroII);
! 568: else if (fastmem_size == 0x200000)
! 569: expamem_write (0x00, Z2_MEM_2MB + add_memory + zorroII);
! 570: else if (fastmem_size == 0x400000)
! 571: expamem_write (0x00, Z2_MEM_4MB + add_memory + zorroII);
! 572: else if (fastmem_size == 0x800000)
! 573: expamem_write (0x00, Z2_MEM_8MB + add_memory + zorroII);
1.1 root 574:
575: expamem_write (0x08, care_addr);
576:
577: expamem_write (0x04, 1);
1.1.1.3 ! root 578:
1.1 root 579: expamem_write (0x10, hackers_id >> 8);
1.1.1.3 ! root 580: expamem_write (0x14, hackers_id & 0xff);
1.1 root 581:
582: expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
583: expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
584: expamem_write (0x20, 0x00); /* ser.no. Byte 2 */
585: expamem_write (0x24, 0x01); /* ser.no. Byte 3 */
586:
1.1.1.3 ! root 587: expamem_write (0x28, 0x00); /* Rom-Offset hi */
! 588: expamem_write (0x2c, 0x00); /* ROM-Offset lo */
1.1 root 589:
590: expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/
591: }
592:
1.1.1.3 ! root 593: /* ********************************************************** */
! 594:
1.1 root 595: /*
596: * Filesystem device
597: */
598:
1.1.1.3 ! root 599: static void expamem_map_filesys (void)
1.1 root 600: {
1.1.1.3 ! root 601: uaecptr a;
! 602:
! 603: filesys_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
! 604: map_banks (&filesys_bank, filesys_start >> 16, 1);
! 605: write_log ("Filesystem: mapped memory.\n");
! 606: /* 68k code needs to know this. */
! 607: a = here ();
! 608: org (0xF0FFFC);
! 609: dl (filesys_start + 0x2000);
! 610: org (a);
1.1 root 611: }
612:
1.1.1.3 ! root 613: static void expamem_init_filesys (void)
1.1 root 614: {
1.1.1.3 ! root 615: uae_u8 diagarea[] = { 0x90, 0x00, 0x01, 0x0C, 0x01, 0x00, 0x01, 0x06 };
1.1 root 616:
617: expamem_init_clear();
1.1.1.3 ! root 618: expamem_write (0x00, Z2_MEM_64KB | rom_card | zorroII);
1.1 root 619:
1.1.1.3 ! root 620: expamem_write (0x08, no_shutup);
1.1 root 621:
622: expamem_write (0x04, 2);
623: expamem_write (0x10, hackers_id >> 8);
1.1.1.3 ! root 624: expamem_write (0x14, hackers_id & 0xff);
1.1 root 625:
626: expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
627: expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
628: expamem_write (0x20, 0x00); /* ser.no. Byte 2 */
629: expamem_write (0x24, 0x01); /* ser.no. Byte 3 */
630:
1.1.1.3 ! root 631: expamem_write (0x28, 0x10); /* Rom-Offset hi */
! 632: expamem_write (0x2c, 0x00); /* ROM-Offset lo */
1.1 root 633:
634: expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/
635:
636: /* Build a DiagArea */
1.1.1.3 ! root 637: memcpy (expamem + 0x1000, diagarea, sizeof diagarea);
! 638:
1.1 root 639: /* Call DiagEntry */
1.1.1.3 ! root 640: do_put_mem_word ((uae_u16 *)(expamem + 0x1100), 0x4EF9); /* JMP */
! 641: do_put_mem_long ((uae_u32 *)(expamem + 0x1102), ROM_filesys_diagentry);
! 642:
1.1 root 643: /* What comes next is a plain bootblock */
1.1.1.3 ! root 644: do_put_mem_word ((uae_u16 *)(expamem + 0x1106), 0x4EF9); /* JMP */
! 645: do_put_mem_long ((uae_u32 *)(expamem + 0x1108), EXPANSION_bootcode);
! 646:
! 647: memcpy (filesysory, expamem, 0x3000);
1.1 root 648: }
649:
1.1.1.2 root 650: /*
1.1.1.3 ! root 651: * Zorro III expansion memory
1.1.1.2 root 652: */
1.1 root 653:
1.1.1.3 ! root 654: static void expamem_map_z3fastmem (void)
1.1 root 655: {
1.1.1.3 ! root 656: char buffer[80];
! 657: z3fastmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
! 658: map_banks (&z3fastmem_bank, z3fastmem_start >> 16, z3fastmem_size >> 16);
! 659:
! 660: sprintf (buffer, "Fastmem (32bit): mapped @$%lx: %d MB Zorro III fast memory \n",
! 661: z3fastmem_start, z3fastmem_size / 0x100000);
! 662: write_log (buffer);
! 663: }
! 664:
! 665: static void expamem_init_z3fastmem (void)
! 666: {
! 667: int code = (z3fastmem_size == 0x100000 ? Z2_MEM_1MB
! 668: : z3fastmem_size == 0x200000 ? Z2_MEM_2MB
! 669: : z3fastmem_size == 0x400000 ? Z2_MEM_4MB
! 670: : z3fastmem_size == 0x800000 ? Z2_MEM_8MB
! 671: : z3fastmem_size == 0x1000000 ? Z2_MEM_16MB
! 672: : z3fastmem_size == 0x2000000 ? Z2_MEM_32MB
! 673: : z3fastmem_size == 0x4000000 ? Z2_MEM_64MB
! 674: : z3fastmem_size == 0x8000000 ? Z2_MEM_128MB
! 675: : z3fastmem_size == 0x10000000 ? Z2_MEM_256MB
! 676: : z3fastmem_size == 0x20000000 ? Z2_MEM_512MB
! 677: : Z2_MEM_1GB);
! 678: expamem_init_clear();
! 679: expamem_write (0x00, add_memory | zorroIII | code);
! 680:
! 681: expamem_write (0x08, no_shutup | force_z3 | (z3fastmem_size > 0x800000 ? ext_size : Z3_MEM_AUTO));
! 682:
! 683: expamem_write (0x04, 3);
! 684:
! 685: expamem_write (0x10, hackers_id >> 8);
! 686: expamem_write (0x14, hackers_id & 0xff);
! 687:
! 688: expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
! 689: expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
! 690: expamem_write (0x20, 0x00); /* ser.no. Byte 2 */
! 691: expamem_write (0x24, 0x01); /* ser.no. Byte 3 */
! 692:
! 693: expamem_write (0x28, 0x00); /* Rom-Offset hi */
! 694: expamem_write (0x2c, 0x00); /* ROM-Offset lo */
! 695:
! 696: expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/
! 697:
1.1 root 698: }
699:
1.1.1.3 ! root 700: #ifdef PICASSO96
! 701: /*
! 702: * Fake Graphics Card (ZORRO III) - BDK
! 703: */
! 704:
! 705: static void expamem_map_gfxcard (void)
1.1 root 706: {
1.1.1.3 ! root 707: char buffer[80];
! 708: gfxmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
! 709: map_banks (&gfxmem_bank, gfxmem_start >> 16, gfxmem_size >> 16);
! 710: sprintf (buffer, "UAEGFX-card: mapped @$%lx \n", gfxmem_start);
! 711: write_log (buffer);
1.1 root 712: }
1.1.1.3 ! root 713:
! 714: static void expamem_init_gfxcard (void)
! 715: {
! 716: expamem_init_clear();
! 717: expamem_write (0x00, zorroIII);
! 718:
! 719: switch (gfxmem_size) {
! 720: case 0x00100000:
! 721: expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_1MB);
! 722: break;
! 723: case 0x00200000:
! 724: expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_2MB);
! 725: break;
! 726: case 0x00400000:
! 727: expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_4MB);
! 728: break;
! 729: case 0x00800000:
! 730: expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_8MB);
! 731: break;
! 732: }
! 733:
! 734: expamem_write (0x04, 96);
! 735:
! 736: expamem_write (0x10, hackers_id >> 8);
! 737: expamem_write (0x14, hackers_id & 0xff);
! 738:
! 739: expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
! 740: expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
! 741: expamem_write (0x20, 0x00); /* ser.no. Byte 2 */
! 742: expamem_write (0x24, 0x01); /* ser.no. Byte 3 */
! 743:
! 744: expamem_write (0x28, 0x00); /* Rom-Offset hi */
! 745: expamem_write (0x2c, 0x00); /* ROM-Offset lo */
! 746:
! 747: expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/
! 748: }
! 749: #endif
! 750:
! 751: void expamem_reset()
! 752: {
! 753: int cardno = 0;
! 754: ecard = 0;
! 755:
! 756: if (fastmemory != NULL) {
! 757: card_init[cardno] = expamem_init_fastcard;
! 758: card_map[cardno++] = expamem_map_fastcard;
! 759: }
! 760: if (z3fastmem != NULL) {
! 761: card_init[cardno] = expamem_init_z3fastmem;
! 762: card_map[cardno++] = expamem_map_z3fastmem;
! 763: }
! 764: #ifdef PICASSO96
! 765: if (gfxmemory != NULL) {
! 766: card_init[cardno] = expamem_init_gfxcard;
! 767: card_map[cardno++] = expamem_map_gfxcard;
! 768: }
! 769: #endif
! 770: if (currprefs.automount_uaedev && !ersatzkickfile) {
! 771: card_init[cardno] = expamem_init_filesys;
! 772: card_map[cardno++] = expamem_map_filesys;
! 773: }
! 774: while (cardno < MAX_EXPANSION_BOARDS) {
! 775: card_init[cardno] = expamem_init_clear;
! 776: card_map[cardno++] = expamem_map_clear;
! 777: }
! 778:
! 779: (*card_init[0]) ();
! 780: }
! 781:
! 782: void expansion_init(void)
! 783: {
! 784: if (fastmem_size > 0) {
! 785: do {
! 786: fastmem_mask = fastmem_size - 1;
! 787: fastmemory = (uae_u8 *)malloc(fastmem_size);
! 788: if (!fastmemory)
! 789: fastmem_size >>= 1;
! 790: } while (!fastmemory && fastmem_size >= 1024 * 1024);
! 791: if (fastmemory == NULL) {
! 792: write_log ("Out of memory for fastmem card.\n");
! 793: }
! 794: }
! 795: if (z3fastmem_size > 0) {
! 796: z3fastmem_mask = z3fastmem_size - 1;
! 797: z3fastmem = (uae_u8 *)malloc(z3fastmem_size);
! 798: if (z3fastmem == NULL) {
! 799: write_log ("Out of memory for Fastmem.(32bit)\n");
! 800: }
! 801: }
! 802: if (gfxmem_size > 0) {
! 803: gfxmem_mask = gfxmem_size - 1;
! 804: gfxmemory = (uae_u8 *)malloc(gfxmem_size);
! 805: if (!gfxmemory) {
! 806: write_log ("Out of memory for UAEGFX-card.\n");
! 807: }
! 808: }
! 809: }
! 810:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.