home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 2000 April & May / AMIGA_2000_04.iso / patches / mccontrol / mccontrol.lha..lha / MCControl / Modules / Modules.doc < prev    next >
Encoding:
Text File  |  1999-10-15  |  11.1 KB  |  307 lines

  1. ;----------------------------------------------------------------------------
  2. ;This is not an documentation how to use the .mcm modules in your own
  3. ;software! Its an documentation about how to write modules for other
  4. ;card reader.
  5. ;----------------------------------------------------------------------------
  6. TABLE OF CONTENTS
  7.  
  8. MCControlModule/General
  9. MCControlModule/Module_Delay
  10. MCControlModule/Module_Open
  11. MCControlModule/Module_FrameOpen
  12. MCControlModule/Module_FrameClose
  13. MCControlModule/Module_ReadCommand
  14. MCControlModule/Module_WriteCommand
  15. MCControlModule/Module_PADOpen
  16. MCControlModule/Module_PADClose
  17. MCControlModule/Module_PADCommand
  18. ;----------------------------------------------------------------------------
  19.  *General*
  20.  
  21. First the main structure:
  22.  
  23.         RSRESET
  24. Module_RTS                   rs.w 1 ;to avoid crash when user is starting module
  25. Module_Version               rs.w 1 ;Currently 1
  26. Module_ID                    rs.l 1 ;must be "MCCM"
  27. Module_Flags                 rs.l 1 ;Unused Flags must be ZERO
  28. Module_Exec_Base             rs.l 1 ;Filled by MCControl
  29. Module_Dos_Base              rs.l 1 ;Filled by MCControl
  30. Module_Intuition_Base        rs.l 1 ;Filled by MCControl
  31. ;--- Card Data
  32. Module_DelayReadByte         rs.l 1 ;Filled by MCControl
  33. Module_DelayReadBit          rs.l 1 ;Filled by MCControl
  34. Module_DelayWriteByte        rs.l 1 ;Filled by MCControl
  35. Module_DelayWriteBit         rs.l 1 ;Filled by MCControl
  36.                              rs.l 10 ;reserved (must be ZERO)
  37. ;--- Jump Table
  38. Module_Delay                 rs.w 3 ;Filled by MCControl
  39. Module_Open                  rs.w 3
  40. Module_Close                 rs.w 3
  41. Module_FrameOpen             rs.w 3
  42. Module_FrameClose            rs.w 3
  43. Module_ReadCommand           rs.w 3
  44. Module_WriteCommand          rs.w 3
  45. Module_PADOpen               rs.w 3
  46. Module_PADClose              rs.w 3
  47. Module_PADCommand            rs.w 3
  48.                              rs.w 3*10 ;reserved
  49. Module_SIZEOF                rs.b 0
  50. ;----------------------------------------------------------------------------
  51.  BITDEF Module,DelayMode,0       ;Tell MCControl you require timing data.
  52.                                  ;This will be used to disable/hide delay
  53.                                  ;slider.
  54.  BITDEF Module,Device,1          ;Tell MCControl you require an Device/Unit
  55.                                     ;selector
  56. ;----------------------------------------------------------------------------
  57. Module_Error_OpenDevice    = 1
  58. Module_Error_NotCompatible = 2   ;If hardware supports identification!
  59. Module_Error_OutOfMemory   = 20
  60. ;----------------------------------------------------------------------------
  61.  
  62.  
  63.  NOTES 
  64.  
  65.        The exec, dos and intuition bases are free. Just use them. 
  66.        This saves memory, time and of cource code size. The card 
  67.        data is for free usage, too.
  68.        
  69.        Its not required to create an real jumptable, by using JMPs.
  70.        Feel free, to use an BRA followed by an NOP. (See Standard.mcm)
  71.        
  72.        Its strongly required to implement all given jumps. (except the
  73.        Module_Delay). If you don´t require FrameOpen, then jump (branch)
  74.        to Module_RTS.
  75.  
  76.        Implement the code as fast as possible, because its used for
  77.        many times during reading and writing memory cards. Try to avoid
  78.        overhead by using Module_Open, or if not possible Module_FrameOpen.
  79.        
  80.        Your reader expects only a frame number and returns a complete
  81.        frame? Well, this isn´t realy a problem. Just simulate an real
  82.        memory card. Use the bytes given by MCControl to get the frame
  83.        number. Send the number to your hardware and send the frame
  84.        including checksumm to MCControl. I know this isn´t very easy, 
  85.        but implementing more routines and overhead will blow up MCControl 
  86.        and all the Modules. If you need help then ask me and I am 
  87.        telling you what to do.
  88.        
  89.  
  90. ;----------------------------------------------------------------------------
  91. MCControlModule/Module_Delay
  92.  
  93.    NAME
  94.                  Module_Delay
  95.         
  96.    SYNOPSIS
  97.                  Module_Delay(Time);
  98.                               D0
  99.  
  100.                  Module_Delay(ULONG);
  101.  
  102.    FUNCTION
  103.                  Standard MCControl timer for high speed delay
  104.                  calculations.
  105.  
  106.    INPUTS
  107.                  Time faktor (use Module_Delay#? field for getting
  108.                  values. The delay is on all systems nearly identicaly.
  109.    WARNING
  110.                  Due multi tasking it is possible that this delay is
  111.                  much longer, but this should be no problem.
  112. ;----------------------------------------------------------------------------
  113. MCControlModule/Module_Open
  114.  
  115.    NAME
  116.                  Module_Open -- open and inits the module
  117.  
  118.    SYNOPSIS
  119.                  Error   = Module_Open(Device, Unit)
  120.                  D0                    a0,     d0
  121.  
  122.                  (ULONG) = Module_Open(*UBYTE,ULONG)
  123.    FUNCTION
  124.                  Open the required device and alloc additional memory
  125.                  if needed.
  126.    INPUTS
  127.                  Device: Pointer on device name (STRING IS READ ONLY!!!)
  128.                  Unit:   Unit of the given device
  129.    RESULT
  130.                   0 = No Error
  131.                   1 = Open device error
  132.                   2 = Not compatible
  133.                  20 = Out of memory
  134.  
  135.                  Other results are not allowed!!
  136.    NOTES
  137.                  Device and Unit are only valid if the Device-Flag within
  138.                  the module structure (Module_Flags) is set.
  139.  
  140.    SEE ALSO
  141.                  Module_Close()
  142. ;----------------------------------------------------------------------------
  143. MCControlModule/Module_Close
  144.  
  145.    NAME
  146.                  Module_Close -- free all data and close all devices.
  147.  
  148.    SYNOPSIS
  149.                  Error = Module_Close()
  150.                  D0
  151.  
  152.    FUNCTION
  153.                  Close all devices and free all allocated memory .
  154.    NOTES
  155.                  Module_Close must be save to be called more than
  156.                  one time. This means you must detect an closing of
  157.                  an just closed module. In this case you must return
  158.                  without any action.
  159.    SEE ALSO
  160.                  Module_Open()
  161. ;----------------------------------------------------------------------------
  162. MCControlModule/Module_FrameOpen
  163.  
  164.    NAME
  165.                  Module_FrameOpen -- Prepare for frame read/write
  166.  
  167.    SYNOPSIS
  168.                  Module_FrameOpen(Slot)
  169.                                   D0
  170.  
  171.                  Module_FrameOpen(UWORD);
  172.  
  173.    FUNCTION
  174.                  No special function. Just do what is required to
  175.                  access the given slot. Standard.mcm is using this
  176.                  function to active the select line of the given
  177.                  slot.
  178.    SEE ALSO
  179.                  Module_FrameClose()
  180. ;----------------------------------------------------------------------------
  181. MCControlModule/Module_FrameClose
  182.  
  183.    NAME
  184.                  Module_FrameClose -- frame read/write done
  185.  
  186.    SYNOPSIS
  187.                  Module_FrameClose()
  188.  
  189.    FUNCTION
  190.                  No special function. Just do what is required after
  191.                  reading a frame. Standard.mcm is using this
  192.                  function to deactive all select lines slot.
  193.    SEE ALSO
  194.                  Module_FrameOpen()
  195. ;----------------------------------------------------------------------------
  196. MCControlModule/Module_ReadCommand
  197.  
  198.    NAME
  199.                  Module_ReadCommand -- Send command and get answer
  200.  
  201.    SYNOPSIS
  202.                  Result = Module_ReadCommand(Command)
  203.                  D0                          D0
  204.  
  205.                  BYTE   = Module_ReadCommand(BYTE)
  206.  
  207.    FUNCTION
  208.                  Command will be transfered to memory card. The
  209.                  card answer will be returned to Result.
  210.  
  211.    NOTES
  212.                  There is no need to implement different routines
  213.                  for Module_ReadCommand and Module_WriteCommand.
  214.                  Internaly these commands are working equal. The
  215.                  only difference is that the ReadCommand is used
  216.                  when reading frames and the WriteCommand on writing
  217.                  frames. This allows to use different delays for
  218.                  reading and writing. If you hardware isn´t using
  219.                  any different delays use the same routine
  220.                  for both commands.
  221.  
  222.    SEE ALSO
  223.                  Module_WriteCommand()
  224. ;----------------------------------------------------------------------------
  225. MCControlModule/Module_WriteCommand
  226.  
  227.    NAME
  228.                  Module_WriteCommand -- Send command and get answer
  229.  
  230.    SYNOPSIS
  231.                  Result = Module_WriteCommand(Command)
  232.                  D0                           D0
  233.  
  234.                  BYTE = Module_WriteCommand(BYTE)
  235.  
  236.    FUNCTION
  237.                  Command will be transfered to memory card. The
  238.                  card answer will be returned to Result.
  239.  
  240.    NOTES
  241.                  There is no need to implement different routines
  242.                  for Module_ReadCommand and Module_WriteCommand.
  243.                  Internaly these commands are working equal. The
  244.                  only difference is that the ReadCommand is used
  245.                  when reading frames and the WriteCommand on writing
  246.                  frames. This allows to use different delays for
  247.                  reading and writing. If you hardware isn´t using
  248.                  any different delays use the same routine
  249.                  for both commands.
  250.                        
  251.    SEE ALSO
  252.                  Module_ReadCommand()
  253. ;----------------------------------------------------------------------------
  254. MCControlModule/Module_PADOpen
  255.  
  256.    NAME
  257.                  Module_PADOpen -- Prepare for PAD emulation
  258.  
  259.    SYNOPSIS
  260.                  Module_PADOpen()
  261.  
  262.    FUNCTION
  263.                  Again there is no predefined function for this
  264.                  function. Just do what is required or even nothing.
  265.                  Standard.mcm is using this function to set all
  266.                  IO ports to output.
  267.    SEE ALSO
  268.                  Module_PADClose()
  269. ;----------------------------------------------------------------------------
  270. MCControlModule/Module_PADClose
  271.  
  272.    NAME
  273.                  Module_PADClose -- PAD emulation done
  274.  
  275.    SYNOPSIS
  276.                  Module_PADClose()
  277.  
  278.    FUNCTION
  279.                  Again there is no predefined function for this
  280.                  function. Just do what is required or even nothing.
  281.                  Standard.mcm is using this function to reset all
  282.                  IO ports to default.
  283.    SEE ALSO
  284.                  Module_PADClose()
  285. ;----------------------------------------------------------------------------
  286. MCControlModule/Module_PADCommand
  287.  
  288.    NAME
  289.                  Module_PADCommand -- Simulate PAD
  290.  
  291.    SYNOPSIS
  292.                  Module_PADCommand(Command,Answer)
  293.                                    D0,     D1
  294.  
  295.                  Module_PADCommand(BYTE   ,BYTE)
  296.         
  297.    FUNCTION
  298.                  Well, this is a little tricky. You must send the
  299.                  Command on the command line, while simulating
  300.                  an PSX Pad answer on the Dataline by using Answer.
  301.                         
  302.                  The card will think its hearing the playstation is
  303.                  talking to a card and vice versa.
  304.    SEE ALSO
  305.                  Module_PADOpen(), Module_PADClose()
  306. ;----------------------------------------------------------------------------
  307.