input_routines.s 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ************************************************
  2. ***** READ MOUSE *****
  3. ************************************************
  4. readmouse
  5. *updates mousex_inc and mousey_inc - it is done this way
  6. *for total flexibility as it can be used to scroll the
  7. *screen or move an on screen pointer or be used to increase
  8. *levels volume menu options etc etc
  9. moveq #0,d0
  10. move.w $dff00a,d0 ;mouse port
  11. move.w d0,d1
  12. andi.w #$00ff,d1
  13. move.w last_mousex,d3
  14. sub.w d1,d3
  15. cmp.w #127,d3
  16. blt.s test_under
  17. add.w #-255,d3
  18. bra.s add_to_scrollx
  19. test_under
  20. cmp.w #-127,d3
  21. bgt.s add_to_scrollx
  22. add.w #255,d3
  23. add_to_scrollx
  24. neg.w d3
  25. move.w d3,mousex_inc
  26. test_sp_y
  27. move.w d1,last_mousex
  28. move.w last_mousey,d3
  29. lsr.w #8,d0
  30. sub.w d0,d3
  31. cmp.w #127,d3
  32. blt.s test_under_y
  33. add.w #-255,d3
  34. bra.s add_to_scrolly
  35. test_under_y
  36. cmp.w #-127,d3
  37. bgt.s add_to_scrolly
  38. add.w #255,d3
  39. add_to_scrolly
  40. neg.w d3
  41. move.w d3,mousey_inc
  42. move_y_value
  43. move.w d0,last_mousey
  44. move.w mousex_inc,d0
  45. muls sensativity,d0
  46. divs #100,d0
  47. move.w d0,mousex_inc
  48. move.w mousey_inc,d0
  49. muls sensativity,d0
  50. divs #100,d0
  51. move.w d0,mousey_inc
  52. rts
  53. last_mousex dc.w 0
  54. last_mousey dc.w 0
  55. mousex_inc dc.w 0
  56. mousey_inc dc.w 0
  57. mouse_x dc.w 160
  58. mouse_y dc.w 100
  59. sensativity dc.w 100 ;1 in other words
  60. ****************************************
  61. ****** GET STICK READINGS *****
  62. ****************************************
  63. get_stick_readings
  64. tst.w edit_data_flag ;crap code
  65. bne.s set_fire_up ;frigged for time
  66. cmp.w #1,edit_mode
  67. bne quit_scroll_joy
  68. move.w #0,fire
  69. btst #7,$bfe001
  70. bne.s set_fire_up
  71. move.w #1,fire
  72. set_fire_up
  73. move.w $dff00c,d0 ;joy1dat
  74. update_joy_values
  75. btst #9,d0
  76. beq.s tryleft
  77. move.w #-1,xdirec
  78. bra upanddown
  79. tryleft
  80. btst #1,d0
  81. beq.s movezero
  82. move.w #1,xdirec
  83. bra.s upanddown
  84. movezero
  85. move.w #0,xdirec
  86. upanddown
  87. move.w d0,d1
  88. rol.w #1,d0
  89. eor.w d0,d1
  90. btst #1,d1
  91. beq.s tryup
  92. move.w #-1,ydirec
  93. bra.s quitjoyread
  94. tryup
  95. btst #9,d1
  96. beq.s stop_y
  97. move.w #1,ydirec
  98. bra.s quitjoyread
  99. stop_y
  100. move.w #0,ydirec
  101. quitjoyread
  102. tst ydirec
  103. beq.s testlr
  104. bpl.s joy_scroll_up
  105. bsr scroll_map_down
  106. bra.s testlr
  107. joy_scroll_up
  108. bsr scroll_map_up
  109. testlr
  110. tst xdirec
  111. beq.s done_scroll_bits
  112. bpl.s joy_scroll_right
  113. bsr scroll_map_right
  114. bra.s done_scroll_bits
  115. joy_scroll_right
  116. bsr scroll_map_left
  117. done_scroll_bits
  118. tst edit_data_flag
  119. beq.s quit_scroll_joy
  120. jsr display_alien_numbers
  121. quit_scroll_joy
  122. rts
  123. fire dc.w 0
  124. fire2 dc.w 0
  125. xdirec dc.w 0
  126. ydirec dc.w 0