home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Utilities / MCControl / Modules / RamCard_mcm.asm < prev    next >
Assembly Source File  |  1999-11-26  |  4KB  |  138 lines

  1. ;----------------------------------------------------------------------------
  2. ;    RamCard.mcm by Guido Mersmann
  3. ;----------------------------------------------------------------------------
  4. ; This is an example code! I didn´t made any optimizations to make the
  5. ; code easy to understand! So don´t blame me!
  6. ;----------------------------------------------------------------------------
  7.     include "Include.i"
  8.     ;include "SRC.MC_ModuleInclude"
  9.     output Sourcecodes:MCControl/Modules/RamCard.mcm
  10.     opt o+,w-
  11. ;----------------------------------------------------------------------------
  12. Version = 1
  13. Revision = 4
  14. Day = 21
  15. Month = 11
  16. Year = 99
  17. ;----------------------------------------------------------------------------
  18. ;--- Macros
  19. Version_String    MACRO
  20.     dc.b "$VER: ",\1,' \<Version>.\<Revision>'," (\<Day>.\<Month>.\<Year>) ",'\2',0
  21.     ENDM
  22. ;----------------------------------------------------------------------------
  23. ;--- Your defines
  24. ;----------------------------------------------------------------------------
  25. Card_Frame_SIZEOF    = 128
  26. ;----------------------------------------------------------------------------
  27.     RSSET Module_SIZEOF
  28. ;--- User Data
  29. Module_UserData    rs.b 0
  30. ;--- Insert Userdata here!
  31. Module_CurrentPage    rs.l 1
  32. Module_UserData_End    rs.b 0
  33. ;----------------------------------------------------------------------------
  34. ;----------------------------------------------------------------------------
  35. DModule_Code    rts
  36. DModule_Version    dc.w 1
  37. DModule_ID    dc.l Module_Identifier
  38. DModule_Flags    dc.l ModuleF_MultiPage|ModuleF_DirectAccess
  39. DModule_Exec_Base    dc.l 0 ;Filled by MCControl
  40. DModule_Dos_Base    dc.l 0 ;Filled by MCControl
  41. DModule_Intuition_Base    dc.l 0 ;Filled by MCControl
  42. ;--- Card Data
  43. DModule_DelayReadByte    dc.l 0 ;Filled by MCControl
  44. DModule_DelayReadBit    dc.l 0 ;Filled by MCControl
  45. DModule_DelayWriteByte    dc.l 0 ;Filled by MCControl
  46. DModule_DelayWriteBit    dc.l 0 ;Filled by MCControl
  47.     ds.l 10 ;reserved
  48. ;--- Jump Table
  49. DModule_Delay    ds.w 3 ;Delay
  50.     bra DModule_Open
  51.     nop
  52.     bra DModule_Close
  53.     nop
  54.     bra DModule_FrameOpen
  55.     nop
  56.     bra DModule_FrameClose
  57.     nop
  58.     bra DModule_ReadCommand
  59.     nop
  60.     bra DModule_WriteCommand
  61.     nop
  62.     bra DModule_PADOpen
  63.     nop
  64.     bra DModule_PADClose
  65.     nop
  66.     bra DModule_PADCommand
  67.     nop
  68.     bra DModule_DirectFrame
  69.     nop
  70.     bra DModule_DirectPage
  71.     nop
  72.     ds.w 3*8 ;reserved
  73.     ds.b Module_UserData_End-Module_UserData
  74. ;----------------------------------------------------------------------------
  75.     Version_String "RamCard.mcm",<by Guido Mersmann>
  76.     even
  77. ;----------------------------------------------------------------------------
  78. DModule_Open    lea    RAMCARD_Page1,a0
  79.     move.l    a0,Module_CurrentPage(a4)
  80. DModule_FrameOpen
  81. DModule_FrameClose
  82. DModule_ReadCommand
  83. DModule_WriteCommand
  84. DModule_PADOpen
  85. DModule_PADClose
  86. DModule_PADCommand
  87.  
  88. DModule_Close    moveq    #Module_Error_NoError,d0
  89.     rts
  90. ;----------------------------------------------------------------------------
  91. ;----------------------------------------------------------------------------
  92. ;    DModule_DirectFrame
  93. ;    >a0.l Pointer on Buffer
  94. ;    >d0.w Number of Frame
  95. ;    <d0.l NULL = OK, -1 = Error
  96. ;----------------------------------------------------------------------------
  97. ;----------------------------------------------------------------------------
  98. DModule_DirectFrame    ext.l    d0
  99.     subq.l    #Module_DirectFrame_Write,d1
  100.     beq    Card_WriteFrame
  101. ;----------------------------------------------------------------------------
  102. Card_ReadFrame    move.l    Module_CurrentPage(a4),a1
  103.     mulu    #Card_Frame_SIZEOF,d0
  104.     add.l    d0,a1
  105.     moveq    #Card_Frame_SIZEOF-1,d0
  106. .Loop    move.b    (a1)+,(a0)+
  107.     dbra    d0,.Loop
  108.     moveq    #0,d0 ;NoError
  109.     rts
  110. ;----------------------------------------------------------------------------
  111. Card_WriteFrame    move.l    Module_CurrentPage(a4),a1
  112.     mulu    #Card_Frame_SIZEOF,d0
  113.     add.l    d0,a1
  114.     moveq    #Card_Frame_SIZEOF-1,d0
  115. .Loop    move.b    (a0)+,(a1)+
  116.     dbra    d0,.Loop
  117.     moveq    #0,d0 ;NoError
  118.     rts
  119. ;----------------------------------------------------------------------------
  120. ;    DModule_DirectPage
  121. ;    >d0.w Number
  122. ;    >d1.l Mode
  123. ; We only have two pages, so there is no need to check d1 for Next or Prev
  124. ; Page!!
  125. ;----------------------------------------------------------------------------
  126. DModule_DirectPage    lea    RAMCARD_Page1,a0
  127.     lea    RAMCARD_Page2,a1
  128.     cmp.l    Module_CurrentPage(a4),a1
  129.     beq    .UseA0
  130.     move.l    a1,a0
  131. .UseA0    move.l    a0,Module_CurrentPage(a4)
  132.     moveq    #0,d0 ;NoError
  133.     rts
  134. ;----------------------------------------------------------------------------
  135.     Section "RamCard",BSS
  136. RAMCARD_Page1    ds.b 2*65536
  137. RAMCARD_Page2    ds.b 2*65536
  138.