fp_move.S 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * fp_move.S
  3. *
  4. * Copyright Roman Zippel, 1997. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, and the entire permission notice in its entirety,
  11. * including the disclaimer of warranties.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. The name of the author may not be used to endorse or promote
  16. * products derived from this software without specific prior
  17. * written permission.
  18. *
  19. * ALTERNATIVELY, this product may be distributed under the terms of
  20. * the GNU General Public License, in which case the provisions of the GPL are
  21. * required INSTEAD OF the above restrictions. (This clause is
  22. * necessary due to a potential bad interaction between the GPL and
  23. * the restrictions contained in a BSD-style copyright.)
  24. *
  25. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  26. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  27. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  29. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  30. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  31. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  33. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  35. * OF THE POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #include "fp_emu.h"
  38. #include "fp_decode.h"
  39. do_no_pc_mode=1
  40. .globl fp_fmove_fp2mem
  41. fp_fmove_fp2mem:
  42. clr.b (2+FPD_FPSR,FPDATA)
  43. fp_decode_dest_format
  44. move.w %d0,%d1 | store data size twice in %d1
  45. swap %d1 | one can be trashed below
  46. move.w %d0,%d1
  47. #ifdef FPU_EMU_DEBUG
  48. lea 0f,%a0
  49. clr.l %d0
  50. move.b (%a0,%d1.w),%d0
  51. printf PDECODE,"fmove.%c ",1,%d0
  52. fp_decode_src_reg
  53. printf PDECODE,"fp%d,",1,%d0
  54. .data
  55. 0: .byte 'l','s','x','p','w','d','b','p'
  56. .previous
  57. #endif
  58. | encode addressing mode for dest
  59. fp_decode_addr_mode
  60. .long fp_data, fp_ill
  61. .long fp_indirect, fp_postinc
  62. .long fp_predecr, fp_disp16
  63. .long fp_extmode0, fp_extmode1
  64. | addressing mode: data register direct
  65. fp_data:
  66. fp_mode_data_direct
  67. move.w %d0,%d1
  68. fp_decode_src_reg
  69. fp_get_fp_reg
  70. lea (FPD_TEMPFP1,FPDATA),%a1
  71. move.l (%a0)+,(%a1)+
  72. move.l (%a0)+,(%a1)+
  73. move.l (%a0),(%a1)
  74. lea (-8,%a1),%a0
  75. swap %d1
  76. move.l %d1,%d2
  77. printf PDECODE,"\n"
  78. jmp ([0f:w,%pc,%d1.w*4])
  79. .align 4
  80. 0:
  81. .long fp_data_long, fp_data_single
  82. .long fp_ill, fp_ill
  83. .long fp_data_word, fp_ill
  84. .long fp_data_byte, fp_ill
  85. fp_data_byte:
  86. jsr fp_normalize_ext
  87. jsr fp_conv_ext2byte
  88. move.l %d0,%d1
  89. swap %d2
  90. move.w %d2,%d0
  91. jsr fp_get_data_reg
  92. move.b %d1,%d0
  93. move.w %d2,%d1
  94. jsr fp_put_data_reg
  95. jra fp_final
  96. fp_data_word:
  97. jsr fp_normalize_ext
  98. jsr fp_conv_ext2short
  99. move.l %d0,%d1
  100. swap %d2
  101. move.w %d2,%d0
  102. jsr fp_get_data_reg
  103. move.w %d1,%d0
  104. move.l %d2,%d1
  105. jsr fp_put_data_reg
  106. jra fp_final
  107. fp_data_long:
  108. jsr fp_normalize_ext
  109. jsr fp_conv_ext2long
  110. swap %d2
  111. move.w %d2,%d1
  112. jsr fp_put_data_reg
  113. jra fp_final
  114. fp_data_single:
  115. jsr fp_normalize_ext
  116. jsr fp_conv_ext2single
  117. swap %d2
  118. move.w %d2,%d1
  119. jsr fp_put_data_reg
  120. jra fp_final
  121. | addressing mode: address register indirect
  122. fp_indirect:
  123. fp_mode_addr_indirect
  124. jra fp_putdest
  125. | addressing mode: address register indirect with postincrement
  126. fp_postinc:
  127. fp_mode_addr_indirect_postinc
  128. jra fp_putdest
  129. | addressing mode: address register indirect with predecrement
  130. fp_predecr:
  131. fp_mode_addr_indirect_predec
  132. jra fp_putdest
  133. | addressing mode: address register indirect with 16bit displacement
  134. fp_disp16:
  135. fp_mode_addr_indirect_disp16
  136. jra fp_putdest
  137. fp_extmode0:
  138. fp_mode_addr_indirect_extmode0
  139. jra fp_putdest
  140. fp_extmode1:
  141. fp_decode_addr_reg
  142. jmp ([0f:w,%pc,%d0*4])
  143. .align 4
  144. 0:
  145. .long fp_abs_short, fp_abs_long
  146. .long fp_ill, fp_ill
  147. .long fp_ill, fp_ill
  148. .long fp_ill, fp_ill
  149. fp_abs_short:
  150. fp_mode_abs_short
  151. jra fp_putdest
  152. fp_abs_long:
  153. fp_mode_abs_long
  154. jra fp_putdest
  155. fp_putdest:
  156. move.l %a0,%a1
  157. fp_decode_src_reg
  158. move.l %d1,%d2 | save size
  159. fp_get_fp_reg
  160. printf PDECODE,"\n"
  161. addq.l #8,%a0
  162. move.l (%a0),-(%sp)
  163. move.l -(%a0),-(%sp)
  164. move.l -(%a0),-(%sp)
  165. move.l %sp,%a0
  166. jsr fp_normalize_ext
  167. swap %d2
  168. jmp ([0f:w,%pc,%d2.w*4])
  169. .align 4
  170. 0:
  171. .long fp_format_long, fp_format_single
  172. .long fp_format_extended, fp_format_packed
  173. .long fp_format_word, fp_format_double
  174. .long fp_format_byte, fp_format_packed
  175. fp_format_long:
  176. jsr fp_conv_ext2long
  177. putuser.l %d0,(%a1),fp_err_ua1,%a1
  178. jra fp_finish_move
  179. fp_format_single:
  180. jsr fp_conv_ext2single
  181. putuser.l %d0,(%a1),fp_err_ua1,%a1
  182. jra fp_finish_move
  183. fp_format_extended:
  184. move.l (%a0)+,%d0
  185. lsl.w #1,%d0
  186. lsl.l #7,%d0
  187. lsl.l #8,%d0
  188. putuser.l %d0,(%a1)+,fp_err_ua1,%a1
  189. move.l (%a0)+,%d0
  190. putuser.l %d0,(%a1)+,fp_err_ua1,%a1
  191. move.l (%a0),%d0
  192. putuser.l %d0,(%a1),fp_err_ua1,%a1
  193. jra fp_finish_move
  194. fp_format_packed:
  195. /* not supported yet */
  196. lea (12,%sp),%sp
  197. jra fp_ill
  198. fp_format_word:
  199. jsr fp_conv_ext2short
  200. putuser.w %d0,(%a1),fp_err_ua1,%a1
  201. jra fp_finish_move
  202. fp_format_double:
  203. jsr fp_conv_ext2double
  204. jra fp_finish_move
  205. fp_format_byte:
  206. jsr fp_conv_ext2byte
  207. putuser.b %d0,(%a1),fp_err_ua1,%a1
  208. | jra fp_finish_move
  209. fp_finish_move:
  210. lea (12,%sp),%sp
  211. jra fp_final