home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / gamesuite_1 / GameSuite / Sources / Stasis / Alien / Raw / AlSource next >
Encoding:
Text File  |  1995-01-23  |  4.2 KB  |  214 lines

  1. #type &ffa
  2. #name StasisRaw
  3. #base 0
  4. #include ASMLib:Standard
  5. #set Service_PsychoStarting=&80300
  6. #set Service_PsychoDying   =&80301
  7. #set Service_UKStasisFormat=&80310
  8. #set Service_StasisSave    =&80311
  9. #set Service_StasisIdentify=&80312
  10. #set stasis_alien          =1
  11. #set raw_filetype       =&FFD
  12.  
  13. .ModuleHeader
  14. .start
  15. DCD 0
  16. DCD init
  17. DCD final
  18. DCD service
  19. DCD title
  20. DCD help
  21. DCD helptable
  22. DCD 0
  23. DCD 0
  24. DCD 0
  25. DCD 0
  26. .title
  27. DCB  "StasisRaw"
  28. DCB 0
  29. ALIGN
  30. .help
  31. DCB  "Stasis Alien",9,"1.00 (24 Jan 1995) - For raw data samples"
  32. DCB 0
  33. ALIGN
  34. .helptable
  35. DCB  "StasisRaw"
  36. DCB 0
  37. ALIGN
  38. DCD 0
  39. DCD 0
  40. DCD 0
  41. DCD rawhelp
  42. DCD 0;End Marker
  43. .rawhelp
  44. DCB "This module allows Stasis to handle raw data.  The samples can be replayed, and saved by the *StasisSave Raw command.",0
  45. ALIGN
  46. .service
  47. ;R12 is the only register we may corrupt in a service call
  48. SUBS R12,R1,#&80000
  49. MOVMI PC,R14
  50. SUB R12,R12,#&300
  51. TEQ R12,#Service_UKStasisFormat-&80300
  52. TEQNE R12,#Service_StasisIdentify-&80300
  53. TEQNE R12,#Service_StasisSave-&80300
  54. MOVNE PC,R14
  55. TEQ R12,#Service_StasisIdentify-&80300
  56. BEQ identify
  57. TEQ R12,#Service_StasisSave-&80300
  58. BEQ save
  59. .ukformat
  60. STMFD R13!,{R3-R4,R14}
  61. MOV R3,#&FFD
  62. CMP R2,R3
  63. LDMNEFD R13!,{R3-R4,PC}^
  64. ;identified a raw sample by its filetype.
  65.  
  66. ADR R0,alienblock
  67. MOV R1,#0; claim service call
  68. LDMFD R13!,{R3-R4,PC}
  69.  
  70. .alienblock
  71. DCB "StAl"; ID Word - required - used to check if the block is valid.
  72. DCD getinfo-alienblock;get info routine
  73. DCD putinfo-alienblock;put info routine
  74. DCD 0     ;release routine (we don't have one)
  75. DCD 0     ;must be zero
  76. DCD 0     ;for future use
  77. DCD 0     ;for future use
  78. DCD name1-alienblock
  79. DCD formatname-alienblock
  80. DCD raw_filetype
  81. DCD title-alienblock
  82. DCD 0
  83. ALIGN
  84.  
  85. ;The info routine is entered with
  86. ;R0 points to the stasis slot decription block
  87. ;R1 points to your sample
  88.  
  89. ;The file length as loaded may be accessed by LDR R0,[R10,#4]
  90.  
  91. ;The info entry should return:
  92.  
  93. ;R1=name *
  94. ;R2=length
  95. ;R3=finetune * &4000=default, &2000=1 octave lower, &8000=1 octave higher etc 
  96. ;R4=repofs *
  97. ;R5=replen *
  98. ;R6=datastart
  99. ;R7=volume *
  100. ;R8=special (return R8=0)
  101. ; *= may return zero if not supported
  102.  
  103. .getinfo
  104. MOV R11,R1;our sample address
  105. MOV R1,#0; sample name - not supported by raw samples
  106. LDR R2,[R10,#4]; file length
  107. MOV R3,#0
  108. MOV R4,#0
  109. MOV R5,#0
  110. MOV R7,#0
  111. MOV R6,R11
  112. MOV R7,#0
  113. MOV R8,#0
  114. MOV PC,R14
  115.  
  116. .putinfo
  117. AND R0,R8,#%111111111         ;what we don't support ie everything
  118. MOV PC,R14
  119.  
  120. .identify
  121. ADD R0,R0,#1
  122. CMP R2,#0
  123. MOVEQ PC,R14
  124. ADR R12,alienblock
  125. STR R12,[R2],#4
  126. MOV PC,R14
  127.  
  128. ;On entry to a save routine, R0 is the slot number (for us to pass
  129. ;to Stasis_GetSlotInfo.
  130. ;R2 points to the filename
  131. ;R3 points to the namecheck routine in Stasis which compares the name
  132. ;pointed to by R1 to that entered at the command line
  133.  
  134. ;We pass on the Service call if we don't recognise the save type
  135. ;ie return with MOV PC,R14 with registers unchanged.
  136. ;If we want to save in our format we return with
  137. ;R0 preserved.
  138. ;R1=0 to claim the service call
  139. ;R2 points to a filled-in header block
  140. ;R3 is the length of the header block
  141. ;R4 is the filetype
  142. ;Stasis will add the sample data in logarithmic format after the header
  143. ;
  144. ;Otherwise return with R2=0 after carrying out the whole save process
  145. ;yourself.
  146. ;To return an error, return with R2=1 and R0 pointing to an error block.
  147.  
  148. .rawformat
  149. .save
  150. STMFD R13!,{R1,R14}
  151. ADR R1,name1
  152. MOV R14,PC
  153. MOV PC,R3       ;BL to R3
  154. LDMFD R13!,{R1,R14}
  155. MOVNES PC,R14;return if no match
  156. STMFD R13!,{R0,R5-R10,R14}
  157. MOV R1,#0
  158. ADR R2,rawformat
  159. MOV R3,#0
  160. MOV R4,#raw_filetype
  161. LDMFD R13!,{R0,R5-R10,PC}
  162. ;return and let Stasis do the rest
  163.  
  164. .init                  ;My standard init/final service calls.
  165. STMFD R13!,{R0-R3,R14}
  166. ADR R0,start
  167. MOV R1,#Service_PsychoStarting
  168. MOV R2,#0; the R12 value
  169. MOV R3,stasis_alien
  170. ADR R4,alienblock
  171. SWI OS_ServiceCall
  172. CMP R1,#0
  173. LDMFD R13!,{R0-R3,R14}
  174. ADREQ R0,initerrtext
  175. ORRVS R14,R14,#1<<28
  176. MOVS PC,R14
  177.  
  178. .final
  179. STMFD R13!,{R0-R3,R14}
  180. ADR R0,start
  181. MOV R1,#Service_PsychoDying
  182. MOV R2,#0
  183. MOV R3,stasis_alien
  184. ADR R4,alienblock
  185. SWI OS_ServiceCall
  186. CMP R1,#0
  187. LDMFD R13!,{R0-R3,R14}
  188. ADREQ R0,finalerrtext
  189. ORRVS R14,R14,#1<<28
  190. MOVS PC,R14
  191.  
  192. .initerrtext
  193. DCD &809DFE
  194. DCB "StasisRaw : Initialisation veto",0
  195. ALIGN
  196. .finalerrtext
  197. DCD &809DFF
  198. DCB "StasisRaw : RMKill veto",0
  199.  
  200. .name1
  201. DCB "Raw",0
  202. .name2
  203. DCB "Raw",0
  204. .formatname
  205. DCB "Raw Data",0
  206. ALIGN
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.