project_code.s 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. FILENAME_LENGTH EQU 216
  2. ********************************************
  3. **** SET PROJECT INFORMATION ****
  4. ********************************************
  5. Set_Project_Information
  6. *send struct pos in d0 and string in a0
  7. movem.l a0-a1/d1,-(sp)
  8. move.l #Current_Project_Information,a1
  9. move.w #FILENAME_LENGTH-1,d1
  10. copy_name_loop
  11. cmp.b #0,(a0)
  12. beq.s finished_copy
  13. move.b (a0)+,(a1,d0.l)
  14. addq.w #1,d0
  15. dbra d1,copy_name_loop
  16. finished_copy
  17. movem.l (sp)+,a0-a1/d1
  18. rts
  19. ********************************************
  20. **** SET PROJECT VALUE ****
  21. ********************************************
  22. Set_Project_Value
  23. *send struct pos in d0 and value in d1
  24. movem.l a0,-(sp)
  25. move.l #Current_Project_Information,a0
  26. add.l d0,a0
  27. move.w d1,(a0)
  28. movem.l (sp)+,a0
  29. rts
  30. **********************************
  31. **** LOAD PROJECT REQUESTER *****
  32. **********************************
  33. load_project_requester
  34. move.l #load_project_file,File_Routine_Pointer
  35. jsr display_file_request
  36. rts
  37. **********************************
  38. **** SAVE PROJECT REQUESTER *****
  39. **********************************
  40. save_project_requester
  41. move.l #save_project_file,File_Routine_Pointer
  42. jsr display_file_request
  43. rts
  44. **********************************
  45. **** SAVE PROJECT FILE *****
  46. **********************************
  47. Save_Project_File
  48. move.l #Current_Project_Information,a0
  49. move.w sensativity,Project_Mouse_Sense(a0)
  50. cmp.l #Map_Details,current_map_ptr
  51. beq.s looking_at_first_map
  52. move.w map_x_position,Project_Map2_X(a0)
  53. move.w map_y_position,Project_Map2_Y(a0)
  54. move.w map_details+Map_X_Val,Project_Map1_X(a0)
  55. move.w map_details+Map_Y_Val,Project_Map1_Y(a0)
  56. bra.s save_prj_Details
  57. looking_at_first_map
  58. move.w map_x_position,Project_Map1_X(a0)
  59. move.w map_y_position,Project_Map1_Y(a0)
  60. move.w map_details2+Map_X_Val,Project_Map2_X(a0)
  61. move.w map_details2+Map_Y_Val,Project_Map2_Y(a0)
  62. save_prj_details
  63. move.l a6,-(sp)
  64. move.l #Current_Filename,d1
  65. move.l #MODE_NEW,d2
  66. move.l dosbase,a6
  67. jsr Open(a6)
  68. move.l (sp)+,a6
  69. tst.l d0
  70. beq.s couldnt_save_project_file
  71. move.l a6,-(sp)
  72. move.l d0,Project_File_Handle
  73. move.l d0,d1
  74. move.l #Current_Project_Information,d2
  75. move.l #Project_Struct_Size,d3
  76. move.l dosbase,a6
  77. jsr Write(a6)
  78. move.l dosbase,a6
  79. move.l project_file_handle,d1
  80. jsr close(a6)
  81. move.l (sp)+,a6
  82. Couldnt_save_project_file
  83. jsr remove_file_request
  84. rts
  85. **********************************
  86. **** LOAD PROJECT FILE *****
  87. **********************************
  88. Load_Project_File
  89. move.l a6,-(sp)
  90. move.l #Current_Filename,d1
  91. move.l #MODE_OLD,d2
  92. move.l dosbase,a6
  93. jsr Open(a6)
  94. move.l (sp)+,a6
  95. tst.l d0
  96. beq.s couldnt_load_project_file
  97. move.l a6,-(sp)
  98. move.l d0,Project_File_Handle
  99. move.l d0,d1
  100. move.l #Current_Project_Information,d2
  101. move.l #Project_Struct_Size,d3
  102. move.l dosbase,a6
  103. jsr Read(a6)
  104. move.l dosbase,a6
  105. move.l project_file_handle,d1
  106. jsr close(a6)
  107. move.l (sp)+,a6
  108. couldnt_load_project_file
  109. jsr remove_file_request
  110. bsr Load_Project_Files
  111. rts
  112. ********************************************
  113. *** LOAD PROJECT FILES ***
  114. ********************************************
  115. Load_Project_Files
  116. move.l a6,-(sp)
  117. *** LOAD PAGES
  118. clr.l d2
  119. move.l #Picture_Pages,a1
  120. move.l #Current_Project_Information,a0
  121. move.w #4-1,d1
  122. Load_In_Pages
  123. move.l (a1,d2),page_pointer
  124. tst.b (a0)
  125. beq.s no_gfx_page_saved
  126. movem.l d1-d2/a0-a1/a6,-(sp)
  127. move.l a0,d1
  128. move.l #MODE_OLD,d2
  129. move.l dosbase,a6
  130. jsr Open(a6)
  131. tst.l d0
  132. beq.s cannot_load_page
  133. jsr Load_Graphics
  134. cannot_load_page
  135. movem.l (sp)+,d1-d2/a0-a1/a6
  136. no_gfx_page_saved
  137. add.l #FILENAME_LENGTH,a0 ;next name
  138. addq.w #4,d2
  139. dbra d1,Load_In_pages
  140. move.l (a1),page_pointer
  141. clr.w current_page
  142. *** LOAD MAPS
  143. move.l #map_details,current_map_ptr
  144. move.l #Current_Project_Information,a0
  145. move.w Project_Map1_X(a0),map_details+Map_X_Val
  146. move.w Project_Map1_Y(a0),map_details+Map_Y_Val
  147. add.l #Project_Map1,a0
  148. tst.b (a0)
  149. beq.s cant_load_map1
  150. movem.l a6/a0,-(sp)
  151. move.l a0,d1
  152. move.l #MODE_OLD,d2
  153. move.l dosbase,a6
  154. jsr Open(a6)
  155. movem.l (sp)+,a6/a0
  156. tst.l d0
  157. beq.s cant_load_map1
  158. jsr Load_Map_Proj
  159. cant_load_map1
  160. move.l #map_details2,current_map_ptr
  161. move.l #Current_Project_Information,a0
  162. move.w Project_Map2_X(a0),map_details2+Map_X_Val
  163. move.w Project_Map2_Y(a0),map_details2+Map_Y_Val
  164. add.l #Project_Map2,a0
  165. tst.b (a0)
  166. beq.s cant_load_map2
  167. movem.l a6/a0,-(sp)
  168. move.l a0,d1
  169. move.l #MODE_OLD,d2
  170. move.l dosbase,a6
  171. jsr Open(a6)
  172. movem.l (sp)+,a6/a0
  173. tst.l d0
  174. beq.s cant_load_map2
  175. jsr Load_Map_Proj
  176. move.l #Current_Project_Information,a0
  177. cant_load_map2
  178. move.l #map_details,current_map_ptr ;reset
  179. *** LOAD BUFFERS
  180. move.l #Current_Project_Information,a0
  181. add.l #Project_Buffers,a0
  182. tst.b (a0)
  183. beq.s cant_load_buffs
  184. movem.l a6/a0,-(sp)
  185. move.l a0,d1
  186. move.l #MODE_OLD,d2
  187. move.l dosbase,a6
  188. jsr Open(a6)
  189. movem.l (sp)+,a6/a0
  190. tst.l d0
  191. beq.s cant_load_buffs
  192. jsr Load_Buffers_Proj
  193. cant_load_buffs
  194. *** LOAD BLK DATA LIST
  195. move.l #Current_Project_Information,a0
  196. add.l #Project_DataList,a0
  197. tst.b (a0)
  198. beq.s cant_load_blk_data_list
  199. movem.l a0/a6,-(sp)
  200. move.l a0,d1
  201. move.l #MODE_OLD,d2
  202. move.l dosbase,a6
  203. jsr Open(a6)
  204. movem.l (sp)+,a0/a6
  205. tst.l d0
  206. beq.s cant_load_blk_data_list
  207. jsr Load_Block_Data_From_File
  208. cant_load_blk_data_list
  209. ****Other info to set up
  210. move.l #Current_Project_Information,a0
  211. move.w Project_Del_Block(a0),delete_block
  212. move.w Project_Mouse_Sense(a0),sensativity
  213. move.w Project_Map1_X(a0),map_x_position
  214. move.w Project_Map1_Y(a0),map_y_position
  215. jsr Convert_Delete_Block_Number_To_Memory
  216. move.l (sp)+,a6
  217. rts
  218. Project_Page1 rs.b FILENAME_LENGTH
  219. Project_Page2 rs.b FILENAME_LENGTH
  220. Project_Page3 rs.b FILENAME_LENGTH
  221. Project_Page4 rs.b FILENAME_LENGTH
  222. Project_Map1 rs.b FILENAME_LENGTH
  223. Project_Map1_X rs.w 1
  224. Project_Map1_Y rs.w 1
  225. Project_Map2 rs.b FILENAME_LENGTH
  226. Project_Map2_X rs.w 1
  227. Project_Map2_Y rs.w 1
  228. Project_Buffers rs.b FILENAME_LENGTH
  229. Project_AlienList rs.b FILENAME_LENGTH
  230. Project_DataList rs.b FILENAME_LENGTH
  231. Project_Del_Block rs.w 1
  232. Project_Mouse_sense rs.w 1
  233. Project_Struct_Size rs.w 0
  234. Current_Project_Information
  235. ds.b Project_Struct_Size
  236. Project_File_Handle
  237. dc.l 0