00001 /* Copyright (c) 1999, Michael Stumpf 00002 All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright 00008 notice, this list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright 00010 notice, this list of conditions and the following disclaimer in 00011 the documentation and/or other materials provided with the 00012 distribution. 00013 * Neither the name of the copyright holders nor the names of 00014 contributors may be used to endorse or promote products derived 00015 from this software without specific prior written permission. 00016 00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 POSSIBILITY OF SUCH DAMAGE. */ 00028 00029 /* 00030 CtoASM.inc 00031 00032 Specify the parameter passing from C functions 00033 00034 Michael Stumpf, (c) 9. August 1999 00035 */ 00036 00037 #ifndef __CTOASM_INC 00038 #define __CTOASM_INC 00039 00040 #define rP0 r25 /* first incoming parameter (MSB) */ 00041 #define rP1 r24 /* 2nd incoming parameter */ 00042 #define rP2 r23 /* 3rd incoming parameter */ 00043 #define rP3 r22 /* 4th incoming parameter */ 00044 #define rP4 r21 /* */ 00045 #define rP5 r20 /* */ 00046 #define rP6 r19 /* */ 00047 #define rP7 r18 /* */ 00048 00049 #define rByte r24 /* a function returning a byte passes this as if it was 00050 an integer in R25:R24, but R25 is unused */ 00051 /* temporary registers, usable without saving, 00052 maybe clobbered after an external function call */ 00053 #ifndef __tmp_reg__ 00054 #define __tmp_reg__ r0 00055 #endif 00056 /* r1 MUST be cleared on return */ 00057 #ifndef __zero_reg__ 00058 #define __zero_reg__ r1 00059 #endif 00060 00061 #define rTI0 r31 /* 1st temporary with immidiate */ 00062 #define rTI1 r30 /* 2nd temporary with immidiate */ 00063 #define rTI2 r27 /* 3rd temporary with immidiate */ 00064 #define rTI3 r26 /* 4th temporary with immidiate */ 00065 00066 /* registers wich have to be saved */ 00067 #define rSI0 r17 /* first saved (pushed) register with immidiate */ 00068 #define rSI1 r16 /* 2nd push register */ 00069 #define rSI2 r29 /* 3rd saved (pushed) register */ 00070 #define rSI3 r28 /* 4th saved (pushed) register */ 00071 00072 #define rS0 r15 /* 3rd pushed register */ 00073 #define rS1 r14 /* 4th pushed register */ 00074 #define rS2 r13 /* */ 00075 #define rS3 r12 /* */ 00076 #define rS4 r11 /* */ 00077 #define rS5 r10 /* */ 00078 #define rS6 r9 /* */ 00079 #define rS7 r8 /* */ 00080 #define rS8 r7 /* */ 00081 #define rS9 r6 /* */ 00082 #define rS10 r5 /* */ 00083 #define rS11 r4 /* */ 00084 #define rS12 r3 /* */ 00085 #define rS13 r2 /* */ 00086 00087 #endif /* __CTOASM_INC */