⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 macros.m43

📁 shengji chengxu daoshi hezai xiaznai
💻 M43
字号:
/////////////////////////////////////////////////////////////////////
// Copyright 2002 IAR Systems. All rights reserved.
// $Id: macros.m43 1.5 2004/02/09 12:26:45Z IASL Exp andersl $

//
// Macros used by the part of the run-time library written in assembler.
//

#ifndef MACROS_M43
#define MACROS_M43

// -----------------------------------------------
// 16 bit Library parameters
//

#define     W0	    R12
#define     W1	    R14
#define     W2	    R13
#define     W3	    R15


// -----------------------------------------------
// 32 bit Library parameters
//

#define     L0L     R12
#define     L0H     R13
#define     L1L     R14
#define     L1H     R15
#define     L2L     R10
#define     L2H     R11


// -----------------------------------------------
// 64 bit Library parameters
//

#define     D0A     R12
#define     D0B     R13
#define     D0C     R14
#define     D0D     R15

#define     D1A     R8
#define     D1B     R9
#define     D1C     R10
#define     D1D     R11


// -----------------------------------------------
// Function call macro, expands differently based on pic mode.
//
// Note: The macros are designed to be "called" with the "#"-sign as
// part pf the function name so that the syntax of the macros looks
// like that of corresponding normal function.
//

// XBR    --  Jump to the destination.
// XCALL  --  Call the destination.
// XRET   --  Return from normal subroutine.
// XRETI  --  Return from interrupt routine.

#ifdef PIC

//
// The add will add the distance to the destination to the PC.  (This
// would actually work in normal mode also.)
//
// Note that the "value" if the PC in the add operation below is the
// address of the next instruction.  This is the reason why we
// subtract "$+4".
//

XBR:    MACRO   func
        ADD.W   func-($+4), PC
        ENDM


XCALL:  MACRO   func
        PUSH.W  PC
        XBR     func
        ENDM


XRET    MACRO
        ADD.W   #4, 0(SP)
        RET
        ENDM


XRETI   MACRO
        ADD.W   #4, 2(SP)
        RETI
        ENDM

XPICRTMODEL MACRO
        RTMODEL "__pic", "yes"
        ENDM

#else

//
// Non-pic variants.
//

XBR:    MACRO   func
        BR      func
        ENDM


XCALL:  MACRO   func
        CALL    func
        ENDM


XRET:   MACRO
        RET
        ENDM


XRETI:  MACRO
        RETI
        ENDM

XPICRTMODEL MACRO
        RTMODEL "__pic", "no"
        ENDM

#endif

#endif // MACROS_M43

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -