cursor_routines.s 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. *****************************************************************
  2. * MODULE TITLE :cursor_routines *
  3. * *
  4. * DESCRIPTION :software to move cursor and display *
  5. * additional information at the cursor *
  6. * when neccessary *
  7. * *
  8. * NAME DATE *
  9. * *
  10. * LIST OF ROUTINES :position_cursor *
  11. * position_note_info *
  12. * attach_pointer *
  13. * attach_note *
  14. * attach_graphics *
  15. * detach_pointer *
  16. * *
  17. *****************************************************************
  18. ***********************************************
  19. ***** POSITION CURSOR *****
  20. ***********************************************
  21. position_cursor
  22. move.w mousex_inc,d0
  23. add.w d0,mouse_x
  24. cmp.w #319,mouse_x
  25. ble.s in_rangex
  26. move.w #319,mouse_x
  27. in_rangex
  28. cmp.w #0,mouse_x
  29. bge.s still_range_x
  30. move.w #0,mouse_x
  31. still_range_x
  32. move.w mousey_inc,d0
  33. add.w d0,mouse_y
  34. cmp.w #256,mouse_y
  35. ble.s in_range_y
  36. move.w #256,mouse_y
  37. in_range_y
  38. cmp.w #0,mouse_y
  39. bge.s still_range_y
  40. move.w #0,mouse_y
  41. still_range_y
  42. cmp.b #0,pointer_state
  43. beq.s normal_state
  44. move.l #wait_pointer,a0
  45. move.w #27,d7
  46. bra.s do_other_mouse_stuff
  47. normal_state
  48. move.l #mouse_pointer,a0
  49. move.w #16,d7
  50. do_other_mouse_stuff
  51. move.w mouse_x,d0
  52. add.w #$81-1,d0 ;tricky positioning
  53. move.b #0,3(A0)
  54. asr.w #1,d0
  55. bcc.s no_bit_set
  56. bset #0,3(a0)
  57. no_bit_set
  58. move.b d0,1(a0)
  59. move.w mouse_y,d0
  60. add.w #$2c,d0
  61. btst #8,d0
  62. beq.s not_vert_set
  63. bset #2,3(a0)
  64. not_vert_set
  65. move.b d0,(a0)
  66. add.w d7,d0
  67. btst #8,d0
  68. beq.s not_vstop_set
  69. bset #1,3(a0)
  70. not_vstop_set
  71. move.b d0,2(a0)
  72. cmp.b #0,pointer_state
  73. beq.s normal_pointer
  74. move.l #wait_pointer,d0
  75. bra.s stuff_spr_data
  76. normal_pointer
  77. move.l #mouse_pointer,d0
  78. stuff_spr_data
  79. move.w d0,sprite0l
  80. swap d0
  81. move.w d0,sprite0h
  82. rts
  83. ***********************************************
  84. ***** ATTACH POINTER *****
  85. ***********************************************
  86. attach_pointer
  87. *routine for anyone to use
  88. **send sprite y size in d0
  89. **send sprite graphics in a0
  90. move.w d0,attach_pointer_size
  91. move.l #pointer_attach_bits+4,a2
  92. subq.w #1,d0
  93. fill_mouse_pointer
  94. move.w (a0)+,(a2)+
  95. move.w (a0)+,(a2)+
  96. dbra d2,fill_mouse_pointer
  97. move.l #$0,(a2)
  98. move.b #1,attach_information
  99. rts
  100. ***********************************************
  101. ***** ATTACH GRAPHICS *****
  102. ***********************************************
  103. attach_graphics
  104. move.w attach_pointer_size,d2
  105. move.l #pointer_attach_bits,a0
  106. move.l mouse_pointer,(a0)
  107. add.b #17,(a0) ;add to x
  108. bcc.s no_set_ex
  109. bset.b #2,3(a0)
  110. no_set_ex
  111. add.w #1,d2
  112. add.b d2,2(a0)
  113. bcc.s no_vstop_ex
  114. bset.b #1,3(a0)
  115. no_vstop_ex
  116. rts
  117. attach_pointer_size
  118. dc.w 0
  119. attach_information
  120. dc.b 0
  121. EVEN
  122. pointer_state
  123. dc.b 0
  124. EVEN
  125. ********************************
  126. *** POSITION BOX SPRITE ****
  127. ********************************
  128. position_box_sprite
  129. move.w mouse_x,d0
  130. move.w mouse_y,d1
  131. cmp.w #1,show_box
  132. bne.s blank_out_sprite
  133. cmp.w max_screen_pos,d1
  134. blt.s display_box_sprite
  135. blank_out_sprite
  136. move.l #blank,d0
  137. move.w d0,sprite2l
  138. swap d0
  139. move.w d0,sprite2h
  140. move.l #blank,d0
  141. move.w d0,sprite3l
  142. swap d0
  143. move.w d0,sprite3h
  144. rts
  145. display_box_sprite
  146. move.l current_map_ptr,a0
  147. cmp.w #8,map_block_size(a0)
  148. beq.s position_sprite8x8
  149. cmp.w #16,map_block_size(a0)
  150. beq.s position_sprite16x16
  151. cmp.w #32,map_block_size(a0)
  152. beq.s position_sprite32x32
  153. position_sprite8x8
  154. andi.w #$fff8,d0
  155. andi.w #$fff8,d1
  156. move.w #8,d2
  157. move.l #sprite8x8,a0
  158. bsr position_any_sprite
  159. move.l a0,d0
  160. move.w d0,sprite2l
  161. swap d0
  162. move.w d0,sprite2h
  163. move.l #blank,d0
  164. move.w d0,sprite3l
  165. swap d0
  166. move.w d0,sprite3h
  167. rts
  168. position_sprite16x16
  169. andi.w #$fff0,d0
  170. andi.w #$fff0,d1
  171. move.w #16,d2
  172. move.l #sprite16x16,a0
  173. bsr position_any_sprite
  174. move.l a0,d0
  175. move.w d0,sprite2l
  176. swap d0
  177. move.w d0,sprite2h
  178. move.l #blank,d0
  179. move.w d0,sprite3l
  180. swap d0
  181. move.w d0,sprite3h
  182. rts
  183. position_sprite32x32
  184. andi.w #$ffe0,d0
  185. andi.w #$ffe0,d1
  186. move.w #32,d2
  187. move.l #sprite32x321,a0
  188. bsr position_any_sprite
  189. move.l a0,d0
  190. move.w d0,sprite2l
  191. swap d0
  192. move.w d0,sprite2h
  193. move.w mouse_x,d0
  194. move.w mouse_y,d1
  195. andi.w #$ffe0,d0
  196. add.w #16,d0
  197. andi.w #$ffe0,d1
  198. move.w #32,d2
  199. move.l #sprite32x322,a0
  200. bsr position_any_sprite
  201. move.l a0,d0
  202. move.w d0,sprite3l
  203. swap d0
  204. move.w d0,sprite3h
  205. rts
  206. show_box
  207. dc.w 1
  208. show_box2
  209. dc.w 1
  210. ********************************
  211. *** POSITION BOX SPRITE2 ****
  212. ********************************
  213. position_box_sprite2
  214. cmp.w #1,show_box2
  215. beq.s display_box_sprite2
  216. blank_box2
  217. move.l #blank,d0
  218. move.w d0,sprite6l
  219. swap d0
  220. move.w d0,sprite6h
  221. move.l #blank,d0
  222. move.w d0,sprite7l
  223. swap d0
  224. move.w d0,sprite7h
  225. rts
  226. display_box_sprite2
  227. move.w current_block,d0
  228. move.w current_page,d1
  229. mulu num_blocks_in_page,d1
  230. sub.w d1,d0
  231. move.l current_map_ptr,a0
  232. move.l #main_screen_struct,a1
  233. move.w screen_x_size(a1),d1
  234. divu map_block_size(a0),d1 ;divide factor
  235. divu d1,d0
  236. move.w d0,d1 ;y
  237. swap d0 ;x
  238. mulu map_block_size(a0),d1 ;y
  239. mulu map_block_size(a0),d0 ;x
  240. add.w #BUTTON_WINDOW_OFFSET-32,d1
  241. move.l page_pointer,a1
  242. move.w screen_y_pos(a1),d2
  243. add.w #BUTTON_WINDOW_OFFSET-32,d2
  244. cmp.w d2,d1
  245. blt blank_box2
  246. add.w #32,d2
  247. sub.w map_block_size(a0),d2
  248. cmp.w d2,d1
  249. bgt blank_box2
  250. sub.w screen_y_pos(a1),d1
  251. move.w d0,d6
  252. move.w d1,d7
  253. cmp.w #8,map_block_size(a0)
  254. beq.s position_sprite8x82
  255. cmp.w #16,map_block_size(a0)
  256. beq.s position_sprite16x162
  257. cmp.w #32,map_block_size(a0)
  258. beq.s position_sprite32x322
  259. position_sprite8x82
  260. andi.w #$fff8,d0
  261. andi.w #$fff8,d1
  262. move.w #8,d2
  263. move.l #sprite8x82,a0
  264. bsr position_any_sprite
  265. move.l a0,d0
  266. move.w d0,sprite6l
  267. swap d0
  268. move.w d0,sprite6h
  269. move.l #blank,d0
  270. move.w d0,sprite7l
  271. swap d0
  272. move.w d0,sprite7h
  273. rts
  274. position_sprite16x162
  275. andi.w #$fff0,d0
  276. andi.w #$fff0,d1
  277. move.w #16,d2
  278. move.l #sprite16x162,a0
  279. bsr position_any_sprite
  280. move.l a0,d0
  281. move.w d0,sprite6l
  282. swap d0
  283. move.w d0,sprite6h
  284. move.l #blank,d0
  285. move.w d0,sprite7l
  286. swap d0
  287. move.w d0,sprite7h
  288. rts
  289. position_sprite32x322
  290. andi.w #$ffe0,d0
  291. andi.w #$ffe0,d1
  292. move.w #32,d2
  293. move.l #sprite32x3212,a0
  294. bsr position_any_sprite
  295. move.l a0,d0
  296. move.w d0,sprite6l
  297. swap d0
  298. move.w d0,sprite6h
  299. move.w d6,d0
  300. move.w d7,d1
  301. andi.w #$ffe0,d0
  302. add.w #16,d0
  303. andi.w #$ffe0,d1
  304. move.w #32,d2
  305. move.l #sprite32x3222,a0
  306. bsr position_any_sprite
  307. move.l a0,d0
  308. move.w d0,sprite7l
  309. swap d0
  310. move.w d0,sprite7h
  311. rts
  312. position_any_sprite
  313. *send in data in a0
  314. *x in d0
  315. *y in d1
  316. *height in d2
  317. gendo_other_mouse_stuff
  318. add.w #$81-1,d0 ;tricky positioning
  319. move.b #0,3(A0)
  320. asr.w #1,d0
  321. bcc.s genno_bit_set
  322. bset #0,3(a0)
  323. genno_bit_set
  324. move.b d0,1(a0)
  325. add.w #$2c,d1
  326. btst #8,d1
  327. beq.s gennot_vert_set
  328. bset #2,3(a0)
  329. gennot_vert_set
  330. move.b d1,(a0)
  331. add.w d2,d1
  332. btst #8,d1
  333. beq.s gennot_vstop_set
  334. bset #1,3(a0)
  335. gennot_vstop_set
  336. move.b d1,2(a0)
  337. rts
  338. ******************************************
  339. **** DISPLAY HELPFUL CURSOR *****
  340. ******************************************
  341. display_helpful_cursor
  342. * cmp.w #BUTTON_WINDOW_OFFSET,mouse_y
  343. * bge.s blank_out_help
  344. cmp.w #0,sprite_to_attach
  345. bne.s attach_help
  346. blank_out_help
  347. move.l #blank,d0
  348. move.w d0,sprite4l
  349. swap d0
  350. move.w d0,sprite4h
  351. bra.s quit_display_helpful
  352. attach_help
  353. cmp.w #WITH,sprite_to_attach
  354. bne.s check_next
  355. move.l #sprwith,a0
  356. bra.s position_it
  357. check_next
  358. cmp.w #TO,sprite_to_attach
  359. bne.s default_last
  360. move.l #sprto,a0
  361. bra.s position_it
  362. default_last
  363. move.l #sprpick,a0
  364. position_it
  365. move.w mouse_x,d0
  366. move.w mouse_y,d1
  367. add.w #18,d1
  368. move.w #10,d2
  369. bsr position_any_sprite
  370. move.l a0,d0
  371. move.w d0,sprite4l
  372. swap d0
  373. move.w d0,sprite4h
  374. quit_display_helpful
  375. rts
  376. **********************************
  377. *** BLANK SPRITES ****
  378. **********************************
  379. blank_sprites
  380. move.l #blank_sprite,d0
  381. move.w d0,sprite1l
  382. move.w d0,sprite2l
  383. move.w d0,sprite3l
  384. move.w d0,sprite4l
  385. move.w d0,sprite5l
  386. move.w d0,sprite6l
  387. move.w d0,sprite7l
  388. swap d0
  389. move.w d0,sprite1h
  390. move.w d0,sprite2h
  391. move.w d0,sprite3h
  392. move.w d0,sprite4h
  393. move.w d0,sprite5h
  394. move.w d0,sprite6h
  395. move.w d0,sprite7h
  396. rts