PlayStation PAD/Memory Interface Protocol
 mail : HFB03536@nifty-serve.or.jp

=============================== 注意 ========================================
 この情報は個人で解析したモノであり信頼性は保証いたしかねます.
 この情報を個人で使用する目的以外(投稿等)には、メールで一報入れるか、参考
文献としてその旨を明記して下さい。
============================================================================

1.pin assign

                * memory card
         ______________________________ 
        |                              |
        | [#][#][#]  [#][#][#]  [#][#] |   (front view)
        |______________________________|
 pin No.   9  7  6    5  4  3    2  1   

                  PAD
        ----------------------- 
       | o o o | o o o | o o o |           (front view)
        \______|_______|______/ 
 pin No. 9 8 7   6 5 4   3 2 1

  pin  signal
  No.   name  direction  logic      function
-----------------------------------------------------------------------
   1    DAT      in      positive   Serial Output data(open drain)
   2    CMD      out     positive   Serial Command data
   3    +7V      -       -          +7.6V CD-ROM Drive Power
   4    GND      -       -          Signal Ground
   5    +3V      -       -          +3.5V System Power
   6    SEL-     out     negative   pad/memory select
   7    CLK-     out     negative   Serial Clock
   8    -        -       -          no use
   9    ACK-     in      negative   Acknowledge(open drain)
-----------------------------------------------------------------------

 note.1 : 3/5pin Power is 20mA Fuse
	: 2pin CD-ROM power 7.2V - 7.8V


* slot 1 or 2 pad/memory connetor

		     slot 1	     slot2
		  pad	 mem	  pad	 mem
       DAT	  (1) -- (1) ---- (1) -- (1) ------ to   PS(common)
       CMD	  (2) -- (2) ---- (2) -- (2) ------ from PS(common)
       +7V	  (3) -- (3) ---- (3) -- (3) ------ from PS(common)
       GND	  (4) -- (4) ---- (4) -- (4) ------ from PS(common)
       +3V	  (5) -- (5) ---- (5) -- (5) ------ from PS(common)
   slot1 SEL-	  (6) -- (6) ---------------------- from PS(separate)
   slot2 SEL-	                  (6) -- (6) ------ from PS(separate)
       CLK-       (7) -- (7) ---- (7) -- (7) ------ from PS(common)
        - 	  (8) ----------- (8) ------------- from PS(common)
       ACK-       (9) -- (9) ---- (9) -- (9) ------ from PS(common)

------------------------------------------------------------------------------

2.accesse timing

* the whole(example PAD)
      ____                                                              _____
 SEL-     |____________________________________________________________|     
      ______        ____        ____        ____        ____        _________
 CLK        ||||||||    ||||||||    ||||||||    ||||||||    ||||||||         
      _______________________________________________________________________
 CMD       X  01h   XXXX  42h   XXXX  00h   XXXX  00h   XXXX  00h   XXXX     
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
           _____________________________________________________________     
 DAT  -----XXXXXXXXXXXXX   ID   XXXX   5Ah  XXXX  key1  XXXX  key2  XXXX-----
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     

 ACK- ---------------|_|---------|_|---------|_|---------|_|-----------------


* details (start Condition)
      ____                                                                   
 SEL-     |__________________________________________________________________
      ______   _   _   _   _   _   _   _   __________________   _   _   _   _
 CLK        |_| |_| |_| |_| |_| |_| |_| |_|                  |_| |_| |_| |_| 
      __________                                                  ___        
 CMD            |________________________________________________|   |_______
                                                             ____            
 DAT  -----XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    |___________
                                                                             
 ACK- ----------------------------------------------|___|--------------------

      X = H or L , - = High-Z
 
	command :  PAD = 01h , Memory Card = 81h

* data/command byte format
     LSB                         MSB
    +---+---+---+---+---+---+---+---+
bit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
    +---+---+---+---+---+---+---+---+
     1st 2nd 3rd 4th 5th 6th 7th 8th

* byte format(for example)
  DATA = 4Ah
         LSB                         MSB
        +---+---+---+---+---+---+---+---+
    bit | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
        +---+---+---+---+---+---+---+---+
         1st 2nd 3rd 4th 5th 6th 7th 8th
      __     ___     ___         ___     ____
 DAT  __|___|   |___|   |_______|   |___|____
      __   _   _   _   _   _   _   _   ______
 CLK    |_| |_| |_| |_| |_| |_| |_| |_|      

* data/command bit detail
	        ___   ___________________________   ____
	  data     \ /                           \ /    
	    /       X                             X     
	command ___/ \___________________________/ \____
                ___                  ____________       
                   \                /            \      
	clock       \              /              \     
                     \____________/                \____
		    |				  |
		    |				  |
		    |		tck		  |
		    |<--------------------------->|

	+---------+--------+--------+--------+
	|         |   min  |  typ   |  max   |
	+---------+--------+--------+--------+
	|   tck   |   1us  |  4us   |   -    |  clock cycle time
	+---------+--------+--------+--------+

* ack timing
      ____                                               
 SEL-     |______________________________________________
      ______        __________        ___________        
 CLK        ||||||||          ||||||||           ||||||||
                   |                 |
 ACK- -----------------------|_|-------------|_|---------
		   |   ta1   | |     |  ta2  |
		   |<------->| |     |<----->|
			     | |  ap
			    >|-|<-----

	+---------+--------+--------+--------+
	|         |   min  |  typ   |  max   |
	+---------+--------+--------+--------+
	|   ta1   |   0us  |   -    |  100us |  command to ack 1st
	+---------+--------+--------+--------+
	|   ta2   |        |  10us  |   1ms  |  other
	+---------+--------+--------+--------+
	|    ap   |   2us  |        |        |  ack width
	+---------+--------+--------+--------+

* timing

            0ms             16ms            32ms            64ms
  time ------|<     16ms    >|---------------|---------------|---------------|
       ______    _          _    ____________    _         __    ____________ 
  SEL        |__| |________| |__|            |__| |_______|  |__|            |
                                         
    note : 

------------------------------------------------------------------------------

3.interface circuit

* PAD example

			/|        200ohm
	PAD SEL-  ----o< |--------\/\/\/-- PS SEL-	
			\|    				
		      74HC14
			/|        200ohm
	PAD CMD-  ----o< |--------\/\/\/-- PS CMD-	
			\|    				
		      74HC14
			/|        200ohm
	PAD CLK-  ----o< |--------\/\/\/-- PS CLK-	
			\|    				
		      74HC14
	PAD DAT   _________				
			   |				
			 |\o 				
		    -----| > ------------- PS DAT	
		   | 	 |/ 				
		  GND  	HC125	 			
	PAD ACK-  _________				
			   |				
			 |\o 				
		    -----| > ------------- PS ACK-	
		   | 	 |/ 				
		  GND  	HC125	 			

  DAT & ACK- signal = open drain

------------------------------------------------------------------------------

4.pad transfer format

  pad start command = '01h'

  pad id : 7-4 = controller type
	 : 3-0 = transfer byte(normal pad = 1)

 * example (normal pad)                 time --->

	 10000000 01000010 01011010 01234567 01234567
	|--------|--------|--------|--------|--------|
 CMD	|   01h  |  42h   |   00h  |   00h  |   00h  |
	|--------|--------|--------|--------|--------|
         xxxxxxxx 10000010 10100101 01234567 01234567
	|--------|--------|--------|--------|--------|
 DAT	|  ----  |  41h   |   5ah  |  SW.1  |  SW.2  |
	|--------|--------|--------|--------|--------|
		             'Z'

	controller type : 4            
 	trabsfer byte   : 5 (3 + 1 * 2)
			         ~     

	switch data =  0 : push
		       1

 * SCPH-1010(normal pad)
	+----------+--------+----+----+----+----+----+----+----+----+
	|  byte    |command | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+========+====+====+====+====+====+====+====+====+
	| 1st byte |  0x01  |               -----                   | 
	+----------+--------+---------------------------------------+
	| 2nd byte |  0x42  |                0x41                   | 'A'
	+----------+--------+---------------------------------------+
	| 3rd byte |  0x00  |                0x5a                   | 'Z'
	+----------+--------+----+----+----+----+----+----+----+----+
	| 4th byte |  0x00  | L  | DW | R  | UP | ST |  1 |  1 |SEL |
	+----------+--------+----+----+----+----+----+----+----+----+
	| 5th byte |  0x00  | [] |  X |  O | <| | R1 | L1 | R2 | L2 |
	+----------+--------+----+----+----+----+----+----+----+----+

 * SLPH-0001(nejicon)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x23                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | L  | DW | R  | UP | ST |  1 |  1 |SEL |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte |  1 |  1 | A  | B  | R  |  1 |  1 |  1 |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | twist  ADC data left:00h,center:80h   |
	+----------+---------------------------------------+
	| 7th byte |  I switch ADC data (8bit unsigned)    |  00h - FFh
	+----------+---------------------------------------+
	| 8th byte |       II switch ADC data              |  00h - FFh
	+----------+---------------------------------------+
	| 9th byte |       L  switch ADC data              |  00h - FFh
	+----------+---------------------------------------+

 * SLPH-0007(nasca pachinco handle)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x23                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | 1  | 1  | 1  | 1  | 1  | 1  | 1  | 1  |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | 1  | 1  | 1  | TW | 1  | 1  | 1  | 1  |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | twist ADC data home:00h, right:7fh    |
	+----------+---------------------------------------+
	| 7th byte |                0x00                   |
	+----------+---------------------------------------+
	| 8th byte |                0x00                   |
	+----------+---------------------------------------+
	| 9th byte |                0x00                   | 
	+----------+---------------------------------------+
	 5th byte : TW = twist on : 0

 * SLPH-0015(volume controller)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x23                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | 1  | 1  | 1  | 1  | A  | 1  | 1  | 1  |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | 1  | 1  | B  | 1  | 1  | 1  | 1  | 1  |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | rotation ADC datra left:00h,right:FFh |
	+----------+---------------------------------------+
	| 7th byte |                00h                    |
	+----------+---------------------------------------+
	| 8th byte |                00h                    |
	+----------+---------------------------------------+
	| 9th byte |                00h                    |
	+----------+---------------------------------------+

  * SCPH-1030(mouse)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x12                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | 1  | 1  | 1  | 1  | 1  | 1  | 1  | 1  |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | 1  | 1  | 1  | 1  |L.sw|R.sw| 0  | 0  |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | Y     8bitSigned up:+,down:-,fixed:00 |
	+----------+---------------------------------------+
	| 7th byte | X     8bitSigned up:+,down:-,fixed:00 |
	+----------+---------------------------------------+
		     X Y = orientation

 * SCPH-1110(analog stick : analog mode)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x53                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | L  | DW | R  | UP | ST |  1 |  1 |SEL |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | [] |  X |  O | <| | R1 | L1 | R2 | L2 |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | r handle L<->R  L:00h,C:80h,R:FFh     | left,right
	+----------+---------------------------------------+
	| 7th byte | r handle U<->D  U:00h,C:80h,D:FFh     | up,down
	+----------+---------------------------------------+
	| 8th byte | l handle L<->R  L:00h,C:80h,R:FFh     | left,right
	+----------+---------------------------------------+
	| 9th byte | l handle U<->D  U:00h,C:80h,D:FFh     | up,down
	+----------+---------------------------------------+

 * SCPH-1110(analog stick : digital mode)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x41                   | 'A'
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | L  | DW | R  | UP | ST |  1 |  1 |SEL |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | [] |  X |  O | <| | R1 | L1 | R2 | L2 |
	+----------+----+----+----+----+----+----+----+----+


 * SCPH-1150(analog controller)

	3pin = vibration motor power

	digital mode (LED = off)
	+----------+--------+----+----+----+----+----+----+----+----+
	|  byte    |command | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+========+====+====+====+====+====+====+====+====+
	| 1st byte |  0x01  |               -----                   |
	+----------+--------+---------------------------------------+
	| 2nd byte |  0x42  |                0x41                   | 'A'
	+----------+--------+---------------------------------------+
	| 3rd byte |  0x00  |                0x5a                   | 'Z'
	+----------+--------+----+----+----+----+----+----+----+----+
	| 4th byte | motor  | L  | DW | R  | UP | ST |  1 |  1 |SEL |
	+----------+--------+----+----+----+----+----+----+----+----+
	| 5th byte | motor  | [] |  X |  O | <| | R1 | L1 | R2 | L2 |
	+----------+--------+----+----+----+----+----+----+----+----+

	analog mode(LED = red)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x73                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | L  | DW | R  | UP | ST |r.sw|l.sw|SEL |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | [] |  X |  O | <| | R1 | L1 | R2 | L2 |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | r handle L<->R  L:00h,C:80h,R:FFh     | left,right
	+----------+---------------------------------------+
	| 7th byte | r handle U<->D  U:00h,C:80h,D:FFh     | up,down
	+----------+---------------------------------------+
	| 8th byte | l handle L<->R  L:00h,C:80h,R:FFh     | left,right
	+----------+---------------------------------------+
	| 9th byte | l handle U<->D  U:00h,C:80h,D:FFh     | up,down
	+----------+---------------------------------------+

	analog mode II(LED = green)
	+----------+----+----+----+----+----+----+----+----+
	|  byte    | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
	+==========+====+====+====+====+====+====+====+====+
	| 1st byte |               -----                   |
	+----------+---------------------------------------+
	| 2nd byte |                0x53                   |
	+----------+---------------------------------------+
	| 3rd byte |                0x5a                   | 'Z'
	+----------+----+----+----+----+----+----+----+----+
	| 4th byte | L  | DW | R  | UP | ST | 1  | 1  |SEL |
	+----------+----+----+----+----+----+----+----+----+
	| 5th byte | [] |  X |  O | <| | R1 | L1 | R2 | L2 |
	+----------+----+----+----+----+----+----+----+----+
	| 6th byte | r handle L<->R  L:00h,C:80h,R:FFh     | left,right
	+----------+---------------------------------------+
	| 7th byte | r handle U<->D  U:00h,C:80h,D:FFh     | up,down
	+----------+---------------------------------------+
	| 8th byte | l handle L<->R  L:00h,C:80h,R:FFh     | left,right
	+----------+---------------------------------------+
	| 9th byte | l handle U<->D  U:00h,C:80h,D:FFh     | up,down
	+----------+---------------------------------------+

 * SCPH-1070(multi tap)
	+----------+----+----+----+----+----+----+----+----+
	+----------+----+----+----+----+----+----+----+----+

------------------------------------------------------------------------------

4.memory card format

  memory start command = '81h'

4.1.write command

    fuction		count	
    ----------------------------
    command header        4	
    write address	  2	
    data block		128	
    XOR code		  1	
    write end mark	  2	
    write end flag	  1	
    ----------------------------

     command header			    address        
    |--------|--------|--------|--------|  |--------|--------|
CMD |   81h  | 57h 'W'|   00h  |   00h  |  | adrs H | adrs L |
    |--------|--------|--------|--------|  |--------|--------|
DAT |  ----  |*  00h  | 5Ah 'Z'| 5Dh ']'|  |* 00h   |*adrs H |
    |--------|--------|--------|--------|  |--------|--------|

     data block    				     XOR code
    |--------|--------|--------|--------|--------|  |--------|  
CMD |  dt 1  |  dt 2  |  ....  | dt 127 | dt 128 |  |   xor  |  
    |--------|--------|--------|--------|--------|  |--------|  
DAT |*adrs L |* dt 1  |* ....  |*dt 126 |*dt 127 |  |*dt 128 |  
    |--------|--------|--------|--------|--------|  |--------|  

     end mark      	 end flag   	     end flag(error)
    |--------|--------|	|--------|		|--------|
CMD |   00h  |   00h  |	|   00h  |		|   00h  |
    |--------|--------|	|--------|		|--------|
DAT | 5Ch '\'| 5Dh ']'|	| 47h 'G'|		| 4Eh 'N'|
    |--------|--------|	|--------|		|--------|

    XOR CODE = (adrs H or L + data block) ex-or

   '*' = ignor data

 * write data example

	from PS data
	+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F   ASCII
   +00  81 57 00 00 00 80 53 43 11 01 82 71 82 68 82 63   .W....SC..RID
   +10  82 66 82 64 81 40 82 71 82 60 82 62 82 64 82 71   GE RACER
   +20  81 40 83 5E 83 43 83 80 83 65 81 5B 83 75 83 8B    タイムテーブル
   +30  00 CD 7B 7B 77 7B FB C7 FB D7 FB DB FB DB DD DB   .ヘ{{w{........ンロ
   +40  DB DB DB DB 7D C7 CB CD FD FD FF FC B7 CC FD DC   ロロロロ}ヌヒヘ.....フ.ワ
   +50  FF DE FF FC FF FC DB FF DD FD DD FD FD DF C7 77   .゙......ン.ン..゚ヌw
   +60  C7 77 B7 77 B7 77 BC F7 7A EF 38 EB F5 E2 B3 DE   ヌwキwキwシ...8..箋゙
   +70  71 D6 4F D2 EC C5 8A B9 48 AD E6 A0 DD D2 5D C6   qヨOメ..柑Hュ譬ンメ]ニ
   +80  FE B9 7C AD 1A A1 1A 00 00 00                     .ケ|ュ.。....      

	to memory
	+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F   ASCII
   +00  01 00 5A 5D 00 00 80 53 43 11 01 82 71 82 68 82   ..Z]...SC..RID
   +10  63 82 66 82 64 81 40 82 71 82 60 82 62 82 64 82    GE RACER
   +20  71 81 40 83 5E 83 43 83 80 83 65 81 5B 83 75 83     タイムテーブル
   +30  8B 00 CD 7B 7B 77 7B FB C7 FB D7 FB DB FB DB DD    .ヘ{{w{........ン 
   +40  DB DB DB DB DB 7D C7 CB CD FD FD FF FC B7 CC FD   ロロロロロ}ヌヒヘ.....フ. 
   +50  DC FF DE FF FC FF FC DB FF DD FD DD FD FD DF C7   ワ.゙......ン.ン..゚ヌ 
   +60  77 C7 77 B7 77 B7 77 BC F7 7A EF 38 EB F5 E2 B3   wヌwキwキwシ...8..箋 
   +70  DE 71 D6 4F D2 EC C5 8A B9 48 AD E6 A0 DD D2 5D   ゙qヨOメ..柑Hュ譬ンメ] 
   +80  C6 FE B9 7C AD 1A A1 5C 5D 47                     ニ.ケ|ュ.。\]G       

4.2.read command

    fuction		count	
    ----------------------------
    command header        4	
    read address	  2	
    command acknowledge   1     
    data header           1     
    data address	  2     
    data block		128	
    XOR code		  1	
    read end flag	  1	
    ----------------------------

     command header			    address       	command ack
    |--------|--------|--------|--------|  |--------|--------|	|--------|
CMD |   81h  | 52h 'R'|   00h  |   00h  |  | adrs H | adrs L |	|   00h  |
    |--------|--------|--------|--------|  |--------|--------|	|--------|
DAT |  ----  |*  00h  | 5Ah 'Z'| 5Dh ']'|  |*  00h  |*adrs H |	| 5Ch '\'|
    |--------|--------|--------|--------|  |--------|--------|	|--------|

     data header     data address
    |--------|	    |--------|--------|
CMD |   00h  |	    |   00h  |   00h  |
    |--------|	    |--------|--------|
DAT | 5Dh ']'|	    | adrs H | adrs L |
    |--------|	    |--------|--------|

     data block					    XOR CODE      END FLAG
    |--------|--------|--------|--------|--------|  |--------|    |--------|
CMD |   00h  |   00h  |  ....  |   00h  |   00h  |  |   00h  |    |   00h  |
    |--------|--------|--------|--------|--------|  |--------|    |--------|
DAT |  dt 1  |  dt 2  |  ....  | dt 127 | dt 128 |  |   xor  |    | 47h 'G'|
    |--------|--------|--------|--------|--------|  |--------|    |--------|

    XOR CODE = (dara adrs H or L + data block) ex-or

    '*' = ignor data

 * read data example

	from PS
	+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F   ASCII
   +00  81 52 00 00 00 80 00 00 00 00 00 00 00 00 00 00   .R.............. 
   +10  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +20  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +30  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +40  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +50  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +60  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +70  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ 
   +80  00 00 00 00 00 00 00 00 00 00 00 00               ............     

	to PS
	+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F   ASCII
   +00  01 00 5A 5D 00 00 5C 5D 00 80 53 43 11 01 82 71   ..Z]..\]..SC..R 
   +10  82 68 82 63 82 66 82 64 81 40 82 71 82 60 82 62   IDGE RAC 
   +20  82 64 82 71 81 40 83 5E 83 43 83 80 83 65 81 5B   ER タイムテー 
   +30  83 75 83 8B 00 CD 7B 7B 77 7B FB C7 FB D7 FB DB   ブル.ヘ{{w{...... 
   +40  FB DB DD DB DB DB DB DB 7D C7 CB CD FD FD FF FC   ..ンロロロロロ}ヌヒヘ.... 
   +50  B7 CC FD DC FF DE FF FC FF FC DB FF DD FD DD FD   .フ.ワ.゙......ン.ン. 
   +60  FD DF C7 77 C7 77 B7 77 B7 77 BC F7 7A EF 38 EB   .゚ヌwヌwキwキwシ...8. 
   +70  F5 E2 B3 DE 71 D6 4F D2 EC C5 8A B9 48 AD E6 A0   .箋゙qヨOメ..柑Hュ譬 
   +80  DD D2 5D C6 FE B9 7C AD 1A A1 1A 47               ンメ]ニ.ケ|ュ.。.G     

4.3.memory card connector

  20pin card edge connector

	figure
	 ___ ___     ___ ___ ___     ___ ___ ___ 
	#   #   #   #   #   #   #   #   #   #   #
	#   #   #   #   #   #   #   #   #   #   #
	#   #   #   #   #   #   #   #   #   #   #
	#   #   # A #   #   #   # B #   #   #   #  A or B cut
	#   #   #   #   #   #   #   #   #   #   #
	#   #   #   #   #   #   #   #   #   #   #
	#   #   #   #   #   #   #   #   #   #   #
	=========================================
	=========================================
	=========================================
	  |   |   x   |   |   |   x   |   |   |
	  |   |   |   |   |   |   |   |   |   | 
	  |   |   |   |   |   |   |   |   |   |

------------------------------------------------------------------------------

5. memory card format

    1M bit(128K byte) = 16 block
    1 block = 8K byte
    1 block = 64 frame
    1 frame = 8K byte / 64 frame = 128 byte

  5.1.memory card block map
       block    block
	 No. 	name		fuction
	  0	directory	card ID , directory
	  1	data block 1	data
	  2	data blcok 2
	  |	      |
	 14	data block 14
	 15	data block 15

  5.2.memory card frame map
    * directory block map
        frame No.	fuction
	  00h		memory card ID
	  01h-0fh	directory 0-14
	  10h-23h	reserve
	  24h-3eh	not use
	  3fh		write test

    * data block map(top)
        frame No.	fuction
	  00h		title & icon palete
	  01h-n		icon data
	  n+1		save data

    * data block map(link)
        frame No.	fuction
	  00h		save data

  5.3.block detail

   5.3.1.directory block detail

   * memory card ID
	+00,01	'MC'
	+02-7E	00h
	+7F	XOR CODE

  note : XOR Code = 00 - 7e data EX-or

   * directory frame
	+00	data flag
		bit 7-4		A  free(not use , delete)
				5  busy
				F  reserve
		bit 3-0		0  not use
				1  top block
				2  link block
				3  link end block
				F  reserve
	+01-03	????
	+04-07	byte length	06,05,04  (block count * 2000h)
				 0,00,00  not use , link , link end
				 0,20,00  1 block used

	+08,09	link directory number(0-14)
		FFFFh = no link block
	+0A,0B	'BI'
	+0C -	product code + game  ID + 00 (ASCIIZ string)
	+7F	XOR code

    * data flag type
	A0  not use(default , format)
	51  busy / link block top
	52         link block
	53         link end block
	Ax  delete block
	FF  reserve block

  * directory frame (reserve area)
	+00-03	FF * 4
	+04-07	00
	+08,09	FF * 2
	+0A-7E	00
	+7F	00	XOR CODE

 5.3.2.data block detail
  * title & icon palete
	+00,01	data ID String 'SC'
	+02	7-4	icon display flag
		3-0	icon count
	+03	icon block count
	+04-5F	title(ASCIIZ string)
	+60-	icon palete data 16 / 65536 color

  * icon frame
	+00-7F	icon data(4bit=1pixel * 16 * 16 )

 5.4.directory example

 * example 1
directory.0  +00  51 00 00 00 00 A0 00 00   Q.......
top	     +08  01 00 42 49 53 4C 50 53   ..BISLPS
	     +10  2D 30 30 31 37 35 54 50   -00175TP
	     +18  41 52 4B 2E 47 30 00 00   ARK.G0..

directory.1  +00  52 00 00 00 00 00 00 00   R.......
	     +08  02 00 00 00 00 00 00 00   ........
	     +10  00 00 00 00 00 00 00 00   ........
	     +18  00 00 00 00 00 00 00 00   ........

directory.2  +00  52 00 00 00 00 00 00 00   R.......
	     +08  03 00 00 00 00 00 00 00   ........
	     +10  00 00 00 00 00 00 00 00   ........
	     +18  00 00 00 00 00 00 00 00   ........

directory.3  +00  52 00 00 00 00 00 00 00   R.......
	     +08  04 00 00 00 00 00 00 00   ........
	     +10  00 00 00 00 00 00 00 00   ........
	     +18  00 00 00 00 00 00 00 00   ........

directory.4  +00  53 00 00 00 00 00 00 00   S.......
	     +08  FF FF 00 00 00 00 00 00   ........
	     +10  00 00 00 00 00 00 00 00   ........
	     +18  00 00 00 00 00 00 00 00   ........

 * example 2(wizadry)

dir.0      +00	51 00 00 00 00 20 00 00   Q.... ..	character data
	   +08	FF FF 42 49 53 43 50 53   ..BISCPS
	   +10	2D 31 30 30 31 30 50 43   -10010PC
	   +18	46 49 4C 45 2E 00 00 00   FILE....

dir.1      +00	51 00 00 00 00 60 00 00   Q.......	save data 1
	   +08  02 00 42 49 53 43 50 53   ..BISCPS
	   +10	2D 31 30 30 31 30 43 44   -10010CD
	   +18	53 31 00 00 00 00 00 00   S1......

dir.2      +00	52 00 00 00 00 00 00 00   R.......
	   +08	03 00 00 00 00 00 00 00   ........
	   +10	00 00 00 00 00 00 00 00   ........
	   +18	00 00 00 00 00 00 00 00   ........

dir.3      +00	53 00 00 00 00 00 00 00   S.......
	   +08	FF FF 00 00 00 00 00 00   ........
	   +10	00 00 00 00 00 00 00 00   ........
	   +18	00 00 00 00 00 00 00 00   ........

 * icon palete

  bit  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
       ??  B4  B3  B2  B1  B0  G4  G3  G2  G1  G0  R4  R3  R2  R1  R0
           ------------------  ------------------  ------------------
                Blue data           Green data           Red data