buffer_setup.s 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. **********************************************
  2. ********* DISPLAY BUFFER WINDOW **********
  3. **********************************************
  4. display_buffer_window
  5. bsr remove_current_buff_name
  6. bsr set_original_colours
  7. move.l #buffer_window,a0
  8. jsr create_window
  9. move.l #buffer_buttons,a0
  10. jsr display_button_list
  11. move.l #Buffer_Window,a0 ; write in filename
  12. move.l #buffer_text,a1
  13. move.w #2,d2
  14. move.w #6,d0
  15. move.w #6,d1
  16. move.w #1,d3
  17. jsr Write_Text
  18. move.l #buffer_window,a0
  19. move.w #95,d0
  20. move.w #37,d1
  21. move.w #95+(8*16)-4,d2
  22. move.w #37+16,d3
  23. jsr draw_box
  24. jsr display_buffer_name
  25. rts
  26. **********************************************
  27. ********* REMOVE BUFFER WINDOW **********
  28. **********************************************
  29. remove_buffer_window
  30. move.l #buffer_buttons,a0
  31. jsr remove_button_list
  32. move.l #buffer_window,a0
  33. jsr destroy_window
  34. jsr set_current_page_colours
  35. bsr draw_current_buff_name
  36. rts
  37. ***********************************************
  38. ******* ENTER BUFFER NAME *******************
  39. ***********************************************
  40. Enter_buffer_name
  41. move.l current_buffer_mem,a0
  42. add.l #buffername,a0
  43. move.b #0,(a0)
  44. move.w #0,char_position
  45. move.l #buffer_window,a0
  46. move.w #6,d0
  47. move.w #40,d1
  48. move.w #7,d2
  49. move.w #10,d3
  50. jsr Clear_Word_Chunk ; clear text
  51. bkey_in_loop
  52. btst.b #6,$bfe001
  53. beq bend_enter_file
  54. jsr get_pressed_key ; key in d0
  55. tst.b d0
  56. beq.s bkey_in_loop
  57. cmp.b #KEY_RETURN,d0
  58. beq bend_enter_file
  59. cmp.b #KEY_DELETE,d0
  60. bne.s bnobackspace
  61. cmp.w #0,char_position
  62. ble.s bnobackspace
  63. subq.w #1,char_position
  64. move.l current_buffer_mem,a0
  65. add.l #buffername,a0
  66. move.w char_position,d1
  67. move.b #0,(a0,d1.w) ; terminate string
  68. bra.s bprint_fname
  69. bnobackspace
  70. move.l current_buffer_mem,a0
  71. add.l #buffername,a0
  72. move.w char_position,d1
  73. cmp.w #11,char_position
  74. bge.s bfilename_to_big
  75. add.w #1,char_position
  76. move.b d0,(a0,d1.w) ; put character in
  77. bterminator
  78. move.b #0,1(a0,d1.w) ; terminate string
  79. bfilename_to_big
  80. bprint_fname
  81. move.l #Buffer_Window,a0
  82. move.w #6,d0
  83. move.w #40,d1
  84. move.w #7,d2
  85. move.w #10,d3
  86. jsr Clear_Word_Chunk ; clear text
  87. move.l #Buffer_Window,a0 ; write in filename
  88. move.l current_buffer_mem,a1
  89. add.l #buffername,a1
  90. move.w #1,d2
  91. move.w #100,d0
  92. move.w #40,d1
  93. jsr Write_Text
  94. bra bkey_in_loop
  95. bend_enter_file
  96. rts
  97. *********************************************
  98. ****** CALCULATE BUFFER MEM *******
  99. *********************************************
  100. calculate_buffer_mem
  101. move.w current_buffer,d0
  102. mulu #buffstructsize,d0
  103. add.l #buffers,d0
  104. move.l d0,current_buffer_mem
  105. rts
  106. **********************************************
  107. ********* BUFFER UP **********
  108. **********************************************
  109. buffer_up
  110. bsr remove_buffer_name
  111. cmp.w #7,current_buffer
  112. beq.s at_buff_max
  113. addq.w #1,current_buffer
  114. bsr calculate_buffer_mem
  115. at_buff_max
  116. bsr display_buffer_name
  117. rts
  118. **********************************************
  119. ********* BUFFER DOWN **********
  120. **********************************************
  121. buffer_down
  122. bsr remove_buffer_name
  123. cmp.w #0,current_buffer
  124. beq.s at_buff_min
  125. subq.w #1,current_buffer
  126. bsr calculate_buffer_mem
  127. at_buff_min
  128. bsr display_buffer_name
  129. rts
  130. **********************************************
  131. ********* DISPLAY BUFFER NAME **********
  132. **********************************************
  133. display_buffer_name
  134. moveq #0,d0
  135. move.w #1,d3
  136. move.w #1,d4
  137. remove_buffer_text
  138. move.w current_buffer,d0
  139. mulu #buffstructsize,d0
  140. move.l #buffers,a2
  141. add.l d0,a2
  142. move.l a2,a1
  143. add.l #buffername,a1
  144. move.l #Buffer_Window,a0 ; write in filename
  145. move.w #1,d2
  146. move.w #100,d0
  147. move.w #40,d1
  148. jsr Write_Text
  149. move.w buffer_xsize(a2),d3
  150. move.w #1,d2
  151. move.w #100,d0
  152. move.w #60,d1
  153. jsr Write_Num
  154. move.w buffer_ysize(a2),d3
  155. move.w #1,d2
  156. move.w #100,d0
  157. move.w #80,d1
  158. jsr Write_Num
  159. rts
  160. **********************************************
  161. ********* REMOVE BUFFER NAME **********
  162. **********************************************
  163. remove_buffer_name
  164. moveq #0,d3 ;delete for text
  165. moveq #0,d4 ;delete for nums
  166. bsr remove_buffer_text
  167. rts
  168. current_buffer
  169. dc.w 0
  170. current_buffer_mem
  171. dc.l buffers
  172. buffer_info_size equ 2+2+12 ;x,y and name
  173. rsreset
  174. buffer_xsize rs.w 1
  175. buffer_ysize rs.w 1
  176. buffername rs.b 12
  177. buffer_mem rs.l 1
  178. buffstructsize rs.w 1
  179. EVEN
  180. *define 8 buffers
  181. buffers
  182. ds.w 2
  183. dc.b "Buff1 ",0
  184. dc.l buff1
  185. ds.w 2
  186. dc.b "Buff2 ",0
  187. dc.l buff2
  188. ds.w 2
  189. dc.b "Buff3 ",0
  190. dc.l buff3
  191. ds.w 2
  192. dc.b "Buff4 ",0
  193. dc.l buff4
  194. ds.w 2
  195. dc.b "Buff5 ",0
  196. dc.l buff5
  197. ds.w 2
  198. dc.b "Buff6 ",0
  199. dc.l buff6
  200. ds.w 2
  201. dc.b "Buff7 ",0
  202. dc.l buff7
  203. ds.w 2
  204. dc.b "Buff8 ",0
  205. dc.l buff8
  206. buff1
  207. ds.b 40*32*2
  208. buff2
  209. ds.b 40*32*2
  210. buff3
  211. ds.b 40*32*2
  212. buff4
  213. ds.b 40*32*2
  214. buff5
  215. ds.b 40*32*2
  216. buff6
  217. ds.b 40*32*2
  218. buff7
  219. ds.b 40*32*2
  220. buff8
  221. ds.b 40*32*2
  222. scr1b ds.b 40*32*2
  223. scr2b ds.b 40*32*2
  224. ***************buffer window routines
  225. buffer_window
  226. dc.w 272
  227. dc.w 144
  228. dc.w 24
  229. dc.w 20
  230. dc.l 0
  231. dc.l 0
  232. dc.b "BUFFER WINDOW",0
  233. even
  234. buffer_text
  235. dc.b " Select Buffer",$a,$a,$a
  236. dc.b "Name : ",$a,$a
  237. dc.b "X Size :",$a,$a
  238. dc.b "Y Size :",0
  239. EVEN
  240. buffer_buttons
  241. dc.l buffer_ok_button,buffer_save_button,buffer_load_button
  242. dc.l buffer_up_button,buffer_down_button,get_buff_name,-1
  243. buffer_Ok_Button
  244. dc.w 21
  245. dc.w 110
  246. dc.w WINDOW ;frame type
  247. dc.b CUSTOM_BUTTON ;standard
  248. dc.b NOT_DEPRESSED
  249. dc.b 0
  250. dc.b 0 ;not used
  251. dc.l ok_custom_button
  252. dc.l 0 ;not used
  253. dc.l remove_buffer_window
  254. dc.b 0
  255. even
  256. buffer_save_Button
  257. dc.w 21+64+5
  258. dc.w 110
  259. dc.w WINDOW ;frame type
  260. dc.b CUSTOM_BUTTON ;standard
  261. dc.b NOT_DEPRESSED
  262. dc.b 0
  263. dc.b 0 ;not used
  264. dc.l save_custom_button
  265. dc.l 0 ;not used
  266. dc.l save_buffers
  267. dc.b 0
  268. even
  269. buffer_load_Button
  270. dc.w 21+64+5+64+5
  271. dc.w 110
  272. dc.w WINDOW ;frame type
  273. dc.b CUSTOM_BUTTON ;standard
  274. dc.b NOT_DEPRESSED
  275. dc.b 0
  276. dc.b 0 ;not used
  277. dc.l load_custom_button
  278. dc.l 0 ;not used
  279. dc.l load_buffers
  280. dc.b 0
  281. even
  282. buffer_Up_Button
  283. dc.w 100+30
  284. dc.w 20
  285. dc.w WINDOW ;frame type
  286. dc.b CUSTOM_BUTTON+HOLD_BUTTON ;standard
  287. dc.b NOT_DEPRESSED
  288. dc.b 0
  289. dc.b 0 ;not used
  290. dc.l arrow_right
  291. dc.l 0 ;not used
  292. dc.l buffer_up
  293. dc.b 0
  294. EVEN
  295. buffer_Down_Button
  296. dc.w 100
  297. dc.w 20
  298. dc.w WINDOW ;frame type
  299. dc.b CUSTOM_BUTTON+HOLD_BUTTON ;standard
  300. dc.b NOT_DEPRESSED
  301. dc.b 0
  302. dc.b 0 ;not used
  303. dc.l arrow_left
  304. dc.l 0 ;not used
  305. dc.l buffer_down
  306. dc.b 0
  307. EVEN
  308. get_buff_name
  309. dc.w 100
  310. dc.w 39
  311. dc.w WINDOW ;frame type
  312. dc.b CUSTOM_BUTTON
  313. dc.b NOT_DEPRESSED
  314. dc.b 0
  315. dc.b 0 ;not used
  316. dc.l buffername_get
  317. dc.l 0 ;not used
  318. dc.l enter_buffer_name
  319. dc.b 0
  320. EVEN