* src/*.c, src/pic16/{gen.c,glue.c,main.c}: applied Vangelis
[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
25 #ifdef FLOAT_ASM_MCS51
26
27 static void dummy(void) _naked
28 {
29         _asm
30         .globl  fs_swap_a_b
31 fs_swap_a_b:
32         mov     a, exp_a
33         xch     a, exp_b
34         mov     exp_a, a
35         // is there a faster way to swap these 2 bits???
36         // this trick with psw can play havoc with the resiter bank setting
37         // mov  a, psw
38         // swap a               // depends on sign bits in psw.1 & psw.5
39         // mov  psw, a
40          mov    c, sign_a
41          rlc    a
42          mov    c, sign_b
43          mov    sign_a, c
44          rrc    a
45          mov    sign_b, c
46         mov     a, r4
47         xch     a, r7
48         mov     r4, a
49         mov     a, r3
50         xch     a, r6
51         mov     r3, a
52         mov     a, r2
53         xch     a, r5
54         mov     r2, a
55         ret
56         _endasm;
57 }
58
59 #endif
60