/[gxemul]/trunk/src/machines/machine_dreamcast.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/machines/machine_dreamcast.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 30 by dpavlin, Mon Oct 8 16:20:40 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2006-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: machine_dreamcast.c,v 1.3 2006/07/25 21:49:14 debug Exp $   *  $Id: machine_dreamcast.c,v 1.30 2007/01/28 16:59:06 debug Exp $
29     *
30     *  Dreamcast.
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 43  Line 45 
45  MACHINE_SETUP(dreamcast)  MACHINE_SETUP(dreamcast)
46  {  {
47          machine->machine_name = "Dreamcast";          machine->machine_name = "Dreamcast";
48            machine->stable = 1;
49    
50            if (machine->emulated_hz == 0)
51                    machine->emulated_hz = 200000000;
52    
53            /*  50 MHz SH4 PCLOCK:  */
54            machine->cpus[0]->cd.sh.pclock = 50000000;
55    
56            if (!machine->use_x11)
57                    fprintf(stderr, "-------------------------------------"
58                        "------------------------------------------\n"
59                        "\n  WARNING!  You are emulating a Dreamcast without -X."
60                        "\n            You will miss graphical output!\n\n"
61                        "-------------------------------------"
62                        "------------------------------------------\n");
63    
64            /*
65             *  Physical address layout on the Dreamcast, according to a
66             *  combination of sources:  NetBSD sources, KalistOS sources,
67             *  http://www.boob.co.uk/docs/Dreamcast_memory.txt, and
68             *  http://www.ludd.luth.se/~jlo/dc/memory.txt, and possibly some
69             *  others:
70             *
71             *  0x00000000 - 0x001fffff     Boot ROM (2 MB)
72             *  0x00200000 - 0x003fffff     Flash (256 KB)
73             *  0x005f6800 - ...            G2 DMA registers
74             *  0x005f6900 - ...            ASIC registers
75             *  0x005f6c00 - ...            Maple registers (controller ports)
76             *  0x005f7000 - ...            GDROM registers
77             *  0x005f7400 - ...            ???
78             *  0x005f74e4 - ...            GDROM re-enable disabled drive (?)
79             *  0x005f7800 - ...            G2 External DMA registers
80             *  0x005f7c00 - ...            ???
81             *  0x005f8000 - 0x005f9fff     PVR registers (graphics)
82             *  0x00600400 - 0x0060047f     LAN Adapter (MB86967) registers
83             *  0x00700000 - ...            SPU registers (sound)
84             *  0x00702c00 -                Cable select and AICA (?) (*3)
85             *  0x00710000 - 0x00710007     RTC registers
86             *  0x00800000 - 0x009fffff     Sound RAM (2 MB)
87             *  0x01000000 - ...            Parallel port registers
88             *  0x02000000 - ...            CD-ROM port registers
89             *  0x04000000 - 0x047fffff     Video RAM (*)
90             *  0x05000000 - 0x057fffff     Video RAM (8 MB)
91             *  0x0c000000 - 0x0cffffff     RAM (16 MB)
92             *  0x0e000000 - 0x0effffff     Copy of RAM? (*2)
93             *  0x10000000 - ...            Tile accelerator command area
94             *  0x10800000 - ...            Write-only mirror of Video RAM (?)
95             *  0x11000000 - ...            PVR DMA area??
96             *  0x14000000 - ...            G2 (?)  Or Modem/Extension port?
97             *
98             *  (*) = with banks 0 and 1 switched; 64-bit read/write access...
99             *  (*3) = See VOUTC in Linux' drivers/video/pvr2fb.c.
100             */
101    
102            dev_ram_init(machine, 0x00702c00, 4, DEV_RAM_RAM, 0);
103    
104            /*  Sound RAM:  */
105            dev_ram_init(machine, 0x00800000, 2 * 1048576, DEV_RAM_RAM, 0);
106    
107            /*
108             *  HACK!  TODO: Remove this device at 0x00a00000 once NetBSD has
109             *  been fixed to not clear 6 MB beyound the sound RAM area.
110             */
111            dev_ram_init(machine, 0x00a00000, 6 * 1048576, DEV_RAM_RAM, 0);
112    
113            dev_ram_init(machine, 0x0c000000, 16 * 1048576, DEV_RAM_RAM, 0x0);
114    
115            /*  The "luftvarg" 4KB intro uses memory at paddr 0x0ef00000...  */
116            /*  (*2)   (TODO: Make this a _mirror_ of 0x0c000000?)  */
117            dev_ram_init(machine, 0x0e000000, 16 * 1048576, DEV_RAM_RAM, 0);
118    
119            device_add(machine, "pvr");
120    /*      device_add(machine, "mb8696x addr=0x600400 addr_mult=4");  */
121            device_add(machine, "dreamcast_asic");
122            device_add(machine, "dreamcast_g2");
123            device_add(machine, "dreamcast_gdrom");
124            device_add(machine, "dreamcast_maple");
125            device_add(machine, "dreamcast_rtc");
126    
127          if (!machine->prom_emulation)          if (!machine->prom_emulation)
128                  return;                  return;
129    
130          /*  NetBSD/dreamcast specific register contents:  */          dreamcast_machine_setup(machine);
         /*  TODO  */  
131  }  }
132    
133    
134  MACHINE_DEFAULT_CPU(dreamcast)  MACHINE_DEFAULT_CPU(dreamcast)
135  {  {
136          /*  Hitachi SH4, 200 MHz  */          /*  Hitachi SH4, 200 MHz  */
137          machine->cpu_name = strdup("SH4");          machine->cpu_name = strdup("SH7750");
138  }  }
139    
140    
141  MACHINE_DEFAULT_RAM(dreamcast)  MACHINE_DEFAULT_RAM(dreamcast)
142  {  {
143          machine->physical_ram_in_mb = 16;          /*  Note: This is the size of the boot ROM area, since the
144                Dreamcast's RAM isn't located at physical address zero.  */
145            machine->physical_ram_in_mb = 2;
146  }  }
147    
148    

Legend:
Removed from v.30  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26