00001 /* 00002 * modsi3.c 00003 * 00004 * 32-bit signed modulo: r0r1 %= r2r3 00005 * 00006 * Calls the ROM version of divsi3, which leaves the absolute value of the 00007 * remainder in r3r4. 00008 * 00009 * The contents of this file are subject to the Mozilla Public License 00010 * Version 1.0 (the "License"); you may not use this file except in 00011 * compliance with the License. You may obtain a copy of the License at 00012 * http://www.mozilla.org/MPL/ 00013 * 00014 * Software distributed under the License is distributed on an "AS IS" 00015 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 00016 * License for the specific language governing rights and limitations 00017 * under the License. 00018 * 00019 * The Original Code is Rcxlib code, released January 20, 1999. 00020 * 00021 * The Initial Developer of the Original Code is Kekoa Proudfoot. 00022 * Portions created by Kekoa Proudfoot are Copyright (C) 1999 00023 * Kekoa Proudfoot. All Rights Reserved. 00024 * 00025 * Contributor(s): Kekoa Proudfoot <kekoa@graphics.stanford.edu> 00026 */ 00027 00028 __asm__ ( 00029 ".section .text\n\t" 00030 ".global ___modsi3\n" 00031 "___modsi3:\n\t" 00032 "push r4\n\t" 00033 "push r5\n\t" 00034 "push r6\n\t" 00035 "push r0\n\t" 00036 "mov.w r1,r6\n\t" 00037 "mov.w r0,r5\n\t" 00038 "mov.w r3,r4\n\t" 00039 "mov.w r2,r3\n\t" 00040 "jsr @@88\n\t" 00041 "mov.w r4,r1\n\t" 00042 "mov.w r3,r0\n\t" 00043 "# negate remainder if numerator was less than zero\n\t" 00044 "btst #0x7,@r7\n\t" 00045 "beq skipnegate\n\t" 00046 "not.b r0l\n\t" 00047 "not.b r0h\n\t" 00048 "not.b r1l\n\t" 00049 "not.b r1h\n\t" 00050 "add.b #0x1,r1l\n\t" 00051 "addx #0x0,r1h\n\t" 00052 "addx #0x0,r0l\n\t" 00053 "addx #0x0,r0h\n" 00054 "skipnegate:\n\t" 00055 "adds #0x2,r7\n\t" 00056 "pop r6\n\t" 00057 "pop r5\n\t" 00058 "pop r4\n\t" 00059 "rts" 00060 );
1.3.9.1