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