home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK3 / DFUE_100 / MEGATXT.ZIP / HARDWARE.TXT < prev    next >
Text File  |  1994-02-07  |  16KB  |  441 lines

  1. Sega Genesis Hardware Internals - Revised: 04/07/1993
  2.  
  3. An up-to-date version of this file can be gotten by anonymous ftp
  4. from ftp.spd.louisville.edu, in the file "pub/sega/hardware.txt".
  5.  
  6. Please send corrections or comments to:
  7.  
  8.     Rick McTeague
  9.     sysrick@starbase.spd.louisville.edu
  10.  
  11.  
  12. Disclaimers:
  13.  
  14. The following information was extracted without the use of official
  15. information from Sega Enterprises, Ltd. I therefore offer no warranty 
  16. on the correctness of this information.  Use it at your own risk.
  17.  
  18. This information was gathered as a personal project, and is not the
  19. responsibility of my employer.
  20.  
  21. Different versions of the Genesis exist, so I won't suggest that any of
  22. this information is right for anybody's Genesis but my own.
  23.  
  24. Sega, Genesis, Sonic the Hedgehog, and Ecco the Dolphin are trademarks
  25. of Sega Enterprises, Ltd. Other trademarks are the property of their
  26. respective companies.
  27.  
  28.  
  29. The Cartridge ROM
  30. -----------------
  31.  
  32. As others on the net have observed, a standard Genesis cartridge is nothing 
  33. more than a small printed circuit board with a ROM on it. There are some
  34. cartridges which have battery-backed RAM for saving high scores, 
  35. configurations, etc., but I haven't seen these, so I don't know about them. 
  36. If you know of a particular cartridge that has RAM, let me know so
  37. I can go rent one and take it apart (shhhh!) to see what's in it.
  38.  
  39. A cartridge contains a word-wide (16 bit) ROM with up to 2 Meg words
  40. (4 Mbytes). This is based on the signal !C_CE (see below), which is used
  41. as the cartridge ROM's chip enable on the cartridges I've looked at, and
  42. which is active at addresses $000000-$3fffff.
  43.  
  44. It may be possible to have more than 4 Mbyte cartridges; if so, either
  45. they ignore the !C_CE line and do their own address decoding, or there's
  46. a register somewhere in the Genesis which changes the default address
  47. decoding scheme for !_CE.
  48.  
  49. Note that cartridges are advertised as being "8 Meg"; as far as I know,
  50. is 8 Meg _bits_, not bytes. 1 Mbyte is still pretty impressive for a 
  51. game machine.
  52.  
  53. SONIC uses a 40-pin 256Kx16 (512Kx8) ROM in word mode. 
  54.  
  55. Ecco the Dolphin uses a 42-pin 512Kx16 (1024Kx8) ROM in word mode. This one
  56. confused me because I'd never seen a 42-pin DIP before, so I thought it was
  57. 40 pins. No wonder the signals didn't look right...
  58.  
  59. Putting together a little bit of information from a Sharp data sheet for
  60. a 512 Kword ROM with a bit of conjecture based on the Sonic and Ecco
  61. cartridges, this is what I can come up with for pinouts:
  62.  
  63.           Sonic                     Ecco
  64.        (256 Kword)                  (512 Kword)
  65.  
  66.                          ------u------
  67.       ------u------                   A18    1=|          |=42   VCC?
  68. A17    1=|           |=40   A 8      A17    2=|          |=41   A 8
  69. A 7    2=|           |=39   A 9      A 7    3=|          |=40   A 9
  70. A 6    3=|           |=38   A10      A 6    4=|          |=39   A10
  71. A 5    4=|           |=37   A11      A 5    5=|          |=38   A11
  72. A 4    5=|           |=36   A12      A 4    6=|          |=37   A12
  73. A 3    6=|           |=35   A13      A 3    7=|          |=36   A13
  74. A 2    7=|           |=34   A14      A 2    8=|          |=35   A14
  75. A 1    8=|           |=33   A15      A 1    9=|          |=34   A15
  76. A 0    9=|           |=32   A16      A 0   10=|          |=33   A16
  77. !CE   10=|           |=31   !BYTE    !CE   11=|          |=32   !BYTE
  78. GND   11=|           |=30   GND      GND   12=|          |=31   GND
  79. !OE   12=|           |=29   D15      !OE   13=|          |=30   D15
  80. D 0   13=|           |=28   D 7      D 0   14=|          |=29   D 7
  81. D 8   14=|           |=27   D14      D 8   15=|          |=28   D14
  82. D 1   15=|           |=26   D 6      D 1   16=|          |=27   D 6
  83. D 9   16=|           |=25   D13      D 9   17=|          |=26   D13
  84. D 2   17=|           |=24   D 5      D 2   18=|          |=25   D 5
  85. D10   18=|           |=23   D12      D10   19=|          |=24   D12
  86. D 3   19=|           |=22   D 4      D 3   20=|          |=23   D 4
  87. D11   20=|           |=21   VCC      D11   21=|          |=22   VCC
  88.           -------------                     -------------
  89.  
  90. Note that the address line numbering is different than that of the 68000;
  91. line A0 of the ROM is really connected to the 68000's A1. This is because
  92. of the way the 68000 handles even/odd byte addressing using !UDS and !LDS.
  93.  
  94. The !BYTE line is held high. This puts the ROM chip into "word" mode,
  95. where data is accessed 16 bits at a time.
  96.  
  97. The convenient correspondence between ROM and 68000 data and address
  98. lines (ROM D0 = 68K D0, ROM D1 = 68K D1, etc..., and ROM A0 = 68K A1, 
  99. ROM A1 = 68K A2, etc...) may not exist in all cartridge designs. This
  100. is sometimes difficult to visualize, but keep in mind that the ROM 
  101. doesn't care whether its D0 is really D0, or if its A3 is really A3,
  102. etc. As long as each data line is used as the same D## line for both 
  103. programming and reading, and each address line is used as the same A## 
  104. for both programming and reading, the ROM will function properly and 
  105. the 68000 will see the right instructions. Think about it...
  106.  
  107. Why bring this up? If you remove the ROM from the cartridge PCB and try
  108. to read it with a EPROM programmer, there may be situations where you 
  109. won't see valid 68000 instructions, or things won't be in the right 
  110. place... Assuming your programmer isn't messed up, this would be because
  111. the address and data lines on the ROM aren't assigned the way you'd expect.
  112.  
  113. Why would someone make a cartridge like this? To make your life difficult,
  114. if you're wanting to hack their ROMs, or to make their life easy, by making
  115. the cartridge PCB easier to design.
  116.  
  117. Does anyone make cartridges like this? I don't know. But the possibility
  118. exists, and I thought you should know.
  119.  
  120. The easiest way to avoid this potential problem is to build an adapter 
  121. from your programmer's EPROM socket to an edge card connector into which
  122. you plug the cartridge. This is a bit safer, too, so you don't have to
  123. remove the ROM from the cartridge (or even open it up).
  124.  
  125.  
  126. The Cartridge Port
  127. ------------------
  128.  
  129. The cartridge port presents the 68000's 23 address lines, 16
  130. data lines, as well as some control signals, described below.
  131.  
  132. With the exception of the standard 68000 signals, signal names
  133. are my own and may bear no resemblance to their real (i.e., internal
  134. to Sega) names.
  135.  
  136. Active low signals are prefixed with a "!".
  137.  
  138. !C_OE drives the cartridge ROM's output enable. It's taken low on
  139. any 68000 read from locations $000000 to $0dfffff, but doesn't really 
  140. matter unless !C_CE is low.
  141.  
  142. !C_CE is the cartridge ROM's chip enable, and is taken low when the
  143. processor accesses memory locations $000000 to $3fffff.
  144.  
  145. !LO_MEM looks similar to !C_CE, but is taken low on accesses to
  146. locations $000000 to $7fffff. I haven't tried tying anything to this
  147. yet. Not used by the ROM.
  148.  
  149. CLK is the 68000's 7.67 MHz clock, being fed to the cartridge in case
  150. something might want to use it. Not used by the ROM.
  151.  
  152. There's a !DTACK at the cartridge port, but I don't know how useful it
  153. is. It looks like the Genesis has its own logic for giving !DTACK to the
  154. processor, so it's not necessary (or advisable) for the cartridge to 
  155. generate it. Perhaps there's some good reason why a cartridge might want
  156. to see the !DTACK being generated on its behalf. Directly connected to
  157. the 68000 (open collector line?). Not used by the ROM.
  158.  
  159. !AS isn't used by the cartridge ROM, but is present in case something
  160. else wants it. Direct from the 68000.
  161.  
  162. Byte reads from ROM don't need !UDS or !LDS, as the processor just
  163. ignores the unneeded bytes on the data bus. Byte writes shouldn't enable
  164. both upper and lower bytes, so the cartridge port provides a lower-
  165. byte write (!LDSW) and upper-byte-write (!UDSW) signals. These would be
  166. useful for cartridges with RAM.
  167.  
  168. !RESET is provided for cartridges with logic which needs to be reset.
  169. Direct from the 68000. Not used by the ROM.
  170.  
  171. !S_RESET is an input to the Genesis which causes a "soft" reset (see
  172. below). Not used by the ROM.
  173.  
  174. !H_RESET is an input to the Genesis which causes a "hard" reset (see
  175. below). Not used by the ROM.
  176.  
  177. !CART_IN is an input to the Genesis which lets it know that the
  178. cartridge is in place. This is used to enable the internal OS ROM
  179. and !C_CE signals. See the discussion on hard and soft resets, below.
  180.  
  181. HS_CLK is a 13.188 MHz output from the Genesis. You tell _me_ what it's
  182. for! Not used by the ROM.
  183.  
  184. VIDEO is an output which appears to be some sort of (non-NTSC?)
  185. video signal. I guess this goes with VSYNC and HSYNC, but I haven't
  186. tried to look at it.
  187.  
  188. VSYNC is a 60 Hz output - possibly the vertical sync signal for VIDEO.
  189.  
  190. HSYNC is a 16.240 KHz output - possibly the horizontal sync signal for
  191. VIDEO. This isn't NTSC... What is it? EGA?
  192.  
  193. There are four signals I haven't got a clue on:
  194.  
  195.     B1:  Goes through capacitor and resistor to IC12 pin 2.
  196.     B3:  Goes through capacitor and resistor to IC12 pin 8.
  197.     B21: This is a strange one. When the processor is halted,
  198.          this signal pulses at 60 KHz. When the processor is
  199.          running, its rate varies. Hmmm....
  200.     B31: This is an output, but it's always high and I've not
  201.          seen it go low. I know it's not an input because it
  202.          sources too much current; it's not a 5V supply because it
  203.          doesn't source enough.
  204.  
  205.  
  206. There is no R/!W line, as it's built into !UDSW and !LDSW signals.
  207.  
  208. There are no !BR, !BG, or !BGACK signals at the cartridge port.
  209.  
  210.  
  211. The cartridge port pins are numbered A1-A32 and B1-B32, left-to-right, with
  212. the A row toward the back of the Genesis and the B row toward the front.
  213.  
  214. The "i" and "o" labels describe whether a signal is an input and/or an output
  215. to/from the Genesis.
  216.  
  217. Signals with an "o" are output from the Genesis to the cartridge.
  218. Signals with an "i" are input to the Genesis from the cartridge.
  219.  
  220. Pin     Signal        Pin     Signal
  221. --------------------------------------
  222. A1  -     gnd         B1  -    ?
  223. A2  -     +5v        B2  i      !H_RESET
  224. A3  o     a8        B3  -      ?
  225. A4  o     a11        B4  o      a9
  226. A5  o     a7        B5  o      a10
  227. A6  o     a12        B6  o      a18
  228. A7  o     a6        B7  o      a19
  229. A8  o     a13        B8  o      a20
  230. A9  o     a5        B9  o      a21
  231. A10 o     a14        B10 o     a22
  232. A11 o     a4        B11 o     a23
  233. A12 o     a15        B12 o     VIDEO
  234. A13 o     a3        B13 o     VSYNC
  235. A14 o     a16        B14 o     HSYNC
  236. A15 o     a2        B15 o     HS_CLK
  237. A16 o     a17        B16 o     !C_OE
  238. A17 o     a1        B17 o     !C_CE
  239. A18 -     gnd        B18 o     !AS
  240. A19 io     d7        B19 o     CLK
  241. A20 io     d0        B20 i     !DTACK
  242. A21 io    d8        B21 o     ?
  243. A22 io     d6        B22 io     d15
  244. A23 io     d1        B23 io     d14
  245. A24 io     d9        B24 io     d13
  246. A25 io     d5        B25 io     d12
  247. A26 io     d2        B26 o     !LO_MEM
  248. A27 io     d10        B27 o     !RESET
  249. A28 io     d4        B28 o     !LDSW
  250. A29 io     d3        B29 o     !UDSW
  251. A30 io     d11        B30 i     !S_RESET
  252. A31 -     +5        B31 o     ?
  253. A32 -     gnd        B32 i     !CART_IN
  254.  
  255.  
  256. Resets and the OS ROM
  257. ---------------------
  258.  
  259. A hard reset, which happens at power-up or when the cartridge port's
  260. !H_RESET line is pulled low, enables the Genesis' internal "OS" ROM. 
  261. This is responsible for checking for a "valid" (i.e., does it say "SEGA" at
  262. location $000100?) cartridge, presenting the "Produced by or licensed from
  263. Sega Enterprises, ltd." message, enabling the cartridge ROM, and jumping
  264. to the cartridge's entry point.
  265.  
  266. This only happens if the !CART_IN signal is pulled low; if not,
  267. the internal ROM (and cartridge ROM) is disabled, the 68000 sees
  268. invalid instructions, and eventually puts its heels up and dies. A
  269. system with a CD may behave differently, but I don't have one, so I
  270. don't know.
  271.  
  272. A soft reset, which happens when you press the reset button or pull the
  273. cartridge port's !S_RESET line low, causes a 68000 reset: the
  274. processor fetches an initial stack pointer from locations $000000-$000003, 
  275. and jumps to the initial PC specified by locations $000004-$000007. This
  276. will be the entry point of the cartridge ROM, if it's enabled, or
  277. the entry point of the OS ROM if the processor is reset before the OS
  278. ROM is finished doing its business.
  279.  
  280.  
  281. The Memory Map
  282. --------------
  283.  
  284. $000000 $3fffff    Cartridge ROM, when enabled by cartridge control
  285.         register and !CART_IN.
  286.  
  287. $000000 $0007ff    Internal OS ROM, when enabled by cartridge control
  288.         register and !CART_IN.
  289.  
  290. $ff0000 $ffffff    64Kbytes scratchpad RAM
  291.         Partially decoded; RAM actually appears repeated between
  292.         $e00000 through $ffffff.
  293.  
  294. $a14101        cartridge control register
  295.         bit 0 = 0: cartridge disabled, OS ROM enabled
  296.         bit 0 = 1: cartridge enabled, OS ROM disabled
  297.  
  298. $a00000 $a????? Unknown. Audio? Controller I/O?
  299.  
  300. $c00000 $c?????    Video display controller registers
  301.  
  302.  
  303. The OS puts the top of its stack at $ffff00, and defines a "user stack
  304. pointer" at $000000 (building down through the top of RAM memory).
  305.  
  306. The Z80 processor (used for sound? controller i/o?) uses 8Kbytes of RAM.
  307. I don't know anything about how the Z80 does its work, as I haven't looked.
  308.  
  309.  
  310. Major parts
  311. -----------
  312.  
  313. I don't know what some of these are, as I'm working off a 1988 IC Master
  314. and a couple of data books. If anyone has better information, I'd love
  315. to have it.
  316.  
  317. IC1
  318.     Hitachi HD68HC000P8 - Motorola 68000-compatible CMOS microprocessor,
  319.     clock: 7.67 MHz
  320.  
  321. IC2, IC3
  322.     Motorola MCM51L832 - 32K x 8-bit pseudo-static RAM for 68000
  323.  
  324. IC4
  325.     Sega 315-5433 - glue chip ? - 160 pins
  326.     On older systems, this is a Sega 315-5364.
  327.  
  328. IC5
  329.     No such beast on newer systems. On older systems, this is
  330.     an 80 pin chip, labelled Sega 315-5309.
  331.  
  332. IC6
  333.     NEC D780C-1 - Zilog Z80-compatible microprocessor
  334.  
  335. IC7
  336.     Samsung KM6264BLS - 8K x 8 static RAM (used by the Z80)
  337.  
  338. IC8
  339.     Sega 315-5313A-01 - glue chip? - 128 pins
  340.  
  341. IC9, IC10
  342.     Hitachi HM53461ZP - 64K x 4 bit dual-port video RAM
  343.  
  344. IC11
  345.     Yamaha YM2612 - Sound chip?
  346.  
  347. IC12    Sony CXA1034P - Timer? Op-amp?
  348.  
  349. IC13
  350.     Sony CXA1145P - RGB to Composite Video encoder.
  351.  
  352. IC14
  353.     LM358 - Dual op-amp. Used for sound?
  354.     
  355. OSC1
  356.     53.6931 MHz crystal oscillator. Divided by 7 to get the 68000
  357.     clock frequency, and used elsewhere for video, sound, Z80 
  358.     clock, etc.
  359.  
  360. Printed Circuit Board
  361.     My Genesis circuit board is labelled "IC BD M5 USA".
  362.     An older (and presumably PAL) system which has an IC5 and a
  363.     different IC4 is labelled "IC BD M5 PAL".
  364.  
  365. There is no explicit OS ROM chip, nor is there a ROM chip for the Z80.
  366. My guess is that these "ROMs" are part of one or both of the glue chips,
  367. IC4 and IC8 (and IC5 on older systems).
  368.  
  369.  
  370. System Revisions
  371. ----------------
  372.  
  373. I'm aware of at least two revisions of the Genesis. Earlier models may
  374. not have had an OS ROM, so some of the above discussion is probably not
  375. valid. Specifically:
  376.  
  377.     o There is probably no Cartridge Control Register.
  378.  
  379.     o Hard and soft resets might be one-and-the-same. I don't know about
  380.       the cartridge pins used for these signals.
  381.  
  382.     o Any cartridge - not just those with "SEGA" in the right place -
  383.       will work (maybe).
  384.  
  385.     o The parts in the box are different. IC5 is present, and IC4 is
  386.       different.
  387.  
  388. How can you tell new and old ones apart without opening it up? I think
  389. that older ones don't give a "Produced..." message on power-up with a
  390. Sega-produced/licensed cartridge.
  391.  
  392. I'd like to get more complete info on this. If you happen to open your
  393. Genesis, I'd appreciate it if you'd compare it the information above and
  394. let me know if there are any differences.
  395.  
  396. One poster on netnews mentioned a "Type III" Genesis. Does anyone know
  397. anything about this?
  398.  
  399.  
  400. The Joystick Ports
  401. ------------------
  402.  
  403. Info on the joystick ports can be found in the file "pub/sega/joystick.txt"
  404. on ftp.spd.louisville.edu. See acknowledgements below.
  405.  
  406.  
  407. The Game Genie
  408. --------------
  409.  
  410. The Game Genie sits between the cartridge port and the cartridge. It
  411. watches the address bus during read accesses to the cartridge ROM, and
  412. substitutes its own data/instructions according to the Game Genie codes
  413. you've entered.
  414.  
  415. Game Genie codes are nothing more than encoded address and data.
  416.  
  417. More information on the encoding scheme, and a C program which decodes
  418. Game Genie codes can be found in "pub/sega/game_genie.txt" and
  419. "pub/sega/decoder.c".
  420.  
  421. See acknowledgements below.
  422.  
  423.  
  424. Acknowledgements
  425. ----------------
  426. Thanks to:
  427.  
  428. d91jn@efd.lth.se (Tore Nestenius) for info on older Genesis systems.
  429.  
  430. lewism@rpi.edu (Michael Lewis) for info on the Sony CXA1145 and Samsung 
  431.     KM6264 chips.
  432.  
  433. crs@crs-sys.uucp (Chris Gregors) for posting a version of the Genesis
  434.     cartridge port pinouts.
  435.  
  436. nhowland@matt.ksu.ksu.edu (Neal Howland) for information on the Joystick
  437.     port.
  438.  
  439. merlyn@digibd.com (Brian Westley) for Game Genie information and decoder
  440.     program.
  441.