Added mcs51 assembly versions for the 12 float/integer conversion functions.
[fw/sdcc] / device / lib / _fsswapargs.c
1 /* Floating point library in optimized assembly for 8051
2  * Copyright (c) 2004, Paul Stoffregen, paul@pjrc.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  */
18
19
20
21 #define SDCC_FLOAT_LIB
22 #include <float.h>
23
24 static void dummy(void) _naked
25 {
26         _asm
27         .globl  fs_swap_a_b
28 fs_swap_a_b:
29         mov     a, exp_a
30         xch     a, exp_b
31         mov     exp_a, a
32         // is there a faster way to swap these 2 bits???
33         // this trick with psw can play havoc with the resiter bank setting
34         // mov  a, psw
35         // swap a               // depends on sign bits in psw.1 & psw.5
36         // mov  psw, a
37          mov    c, sign_a
38          rlc    a
39          mov    c, sign_b
40          mov    sign_a, c
41          rrc    a
42          mov    sign_b, c
43         mov     a, r4
44         xch     a, r7
45         mov     r4, a
46         mov     a, r3
47         xch     a, r6
48         mov     r3, a
49         mov     a, r2
50         xch     a, r5
51         mov     r2, a
52         ret
53         _endasm;
54 }
55