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

📄 pdefni86.h

📁 Open Watcom 的 C 编译器源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
*               DESCRIBE IT HERE!
*
****************************************************************************/


#define NC '\0'

hw_reg_set DefaultVarParms[] = {
        0 };


hw_reg_set DefaultParms[] = {
#ifndef WCPP
        HW_D_4( HW_AX, HW_BX, HW_CX, HW_DX ) /*+HW_ST1+HW_ST2+HW_ST3+HW_ST4*/,
#endif
        0 };

#if _CPU == 8086 || _CPU == 386
#ifndef WCPP
        char Registers[] = {            /* table for TableLookup*/
                'e','s',NC,             /* should agree with RegBits*/
                'd','s',NC,
                'c','s',NC,
                's','s',NC,
                'a','x',NC,
                'b','x',NC,
                'c','x',NC,
                'd','x',NC,
                'a','l',NC,
                'b','l',NC,
                'c','l',NC,
                'd','l',NC,
                'a','h',NC,
                'b','h',NC,
                'c','h',NC,
                'd','h',NC,
                's','i',NC,
                'd','i',NC,
                'b','p',NC,
                's','p',NC,
                'f','s',NC,
                'g','s',NC,
#if _CPU == 386
                'e','a','x',NC,
                'e','b','x',NC,
                'e','c','x',NC,
                'e','d','x',NC,
                'e','s','i',NC,
                'e','d','i',NC,
                'e','b','p',NC,
                'e','s','p',NC,
#endif
                NC };

        hw_reg_set RegBits[] ={
                                HW_D( HW_ES ),
                                HW_D( HW_DS ),
                                HW_D( HW_CS ),
                                HW_D( HW_SS ),
                                HW_D( HW_AX ),
                                HW_D( HW_BX ),
                                HW_D( HW_CX ),
                                HW_D( HW_DX ),
                                HW_D( HW_AL ),
                                HW_D( HW_BL ),
                                HW_D( HW_CL ),
                                HW_D( HW_DL ),
                                HW_D( HW_AH ),
                                HW_D( HW_BH ),
                                HW_D( HW_CH ),
                                HW_D( HW_DH ),
                                HW_D( HW_SI ),
                                HW_D( HW_DI ),
                                HW_D( HW_BP ),
                                HW_D( HW_SP ),
                                HW_D( HW_FS ),
                                HW_D( HW_GS ),
#if _CPU == 386
                                HW_D( HW_EAX ),
                                HW_D( HW_EBX ),
                                HW_D( HW_ECX ),
                                HW_D( HW_EDX ),
                                HW_D( HW_ESI ),
                                HW_D( HW_EDI ),
                                HW_D( HW_EBP ),
                                HW_ESP,
#endif
 };

/*      these are the registers that Microsoft saves and restores */

hw_reg_set MSC_Save = { HW_D_3( HW_SI, HW_DI, HW_BP ) };

/*      INLINE FUNCTIONS */

struct  aux_info        InlineInfo;

enum    asm_codes {
        push_es = 0x06,
        pop_es  = 0x07,
        sbb_rr  = 0x19,
        sbb_ax_i= 0x1d,
        push_ds = 0x1e,
        pop_ds  = 0x1f,
        sub_rr  = 0x29,
        xor_rr  = 0x31,
        cmp_al  = 0x3c,
        inc_cx  = 0x41,
        inc_di  = 0x47,
        dec_cx  = 0x49,
        dec_si  = 0x4e,
        dec_di  = 0x4f,
        push_ax = 0x50,
        push_cx = 0x51,
        push_dx = 0x52,
        push_si = 0x56,
        push_di = 0x57,
        pop_ax  = 0x58,
        pop_cx  = 0x59,
        pop_dx  = 0x5a,
        pop_si  = 0x5e,
        pop_di  = 0x5f,
        je      = 0x74,
        jne     = 0x75,
        jge     = 0x7d,
        xchg_cx_ax = 0x91,
        xchg_si_ax = 0x96,
        cbw     = 0x98,
        cwd     = 0x99,
        fwait   = 0x9b,
        movsb   = 0xa4,
        movsw   = 0xa5,
        cmpsb   = 0xa6,
        stosb   = 0xaa,
        stosw   = 0xab,
        lodsb   = 0xac,
        lodsw   = 0xad,
        scasb   = 0xae,
        mov_cx  = 0xb9,
        jcxz    = 0xe3,
        in_al_dx= 0xec,
        in_ax_dx= 0xed,
        out_dx_al=0xee,
        out_dx_ax=0xef,
        rep     = 0xf2,
        repnz   = 0xf2,
        repz    = 0xf3,
        cli     = 0xfa,
        sti     = 0xfb,
        cld     = 0xfc,
        ax_ax   = 0xc0,
        di_cx   = 0xcf,
        ax_dx   = 0xd0,
        cx_cx   = 0xc9,
        si_si   = 0xf6,
        hide1   = 0xa8,
        hide2   = 0xa9,
        cmc     = 0xf5,
};
#define sbb_cx_ffff     0x83,0xd9,0xff
#define mov_dx_ax       0x89,0xc2
#define mov_ax_dx       0x89,0xd0
#define mov_ax_bx       0x89,0xd8
#define mov_dx_si       0x89,0xf2
#define mov_ax_di       0x89,0xf8
#define mov_ax_es       0x8c,0xc0
#define mov_cx_es       0x8c,0xc1
#define mov_dx_es       0x8c,0xc2
#define mov_ax_ds       0x8c,0xd8
#define mov_dx_ds       0x8c,0xda
#define mov_ds_ax       0x8e,0xd8
#define mov_es_ax       0x8e,0xc0
#define mov_es_dx       0x8e,0xc2
#define mov_ds_dx       0x8e,0xda
#define mov_ds_si       0x8e,0xde
#define mov_ah_atdi     0x8a,0x25
#define mov_ah_atesdi   0x26,0x8a,0x25
#define not_cx          0xf7,0xd1
#define or_cx_cx        0x09,0xc9
#define or_dx_dx        0x0b,0xd2
#define neg_ax          0xf7,0xd8
#define adc_dx_0        0x83,0xd2,0x00
#define neg_dx          0xf7,0xda
#define sub_al_ah       0x28,0xe0
#define sub_ah_ah       0x28,0xe4
#define shr_cx_1        0xd1,0xe9
#define adc_cx_cx       0x11,0xc9
#define xchg_si_di      0x87,0xfe
#define mov_ax_0        0xb8,0x00,0x00
#define mov_cx_0        0xb9,0x00,0x00
#define test_al_al      0x84,0xc0
#define test_ah_ah      0x84,0xe4
#define test_al_aa      0xa8,0xaa
#define fabs            0xd9,0xe1
#define and_ah_7f       0x80,0xe4,0x7f
#define mov_ah_al       0x88,0xc4
#define mov_di_cx       0x89,0xcf
#define cmp_al_dl       0x38,0xd0
#define cmp_ah_dl       0x38,0xd4
#define cmp_al_cl       0x38,0xc8
#define cmp_ah_cl       0x38,0xcc
#define cmp_al_ah       0x38,0xe0
#define mov_dx_si       0x89,0xf2
#define cmp_atdi_0      0x80,0x3d,0x00
#define cmp_atesdi_0    0x26,0x80,0x3d,0x00
#define idiv_cx         0xf7,0xf9
#define sub_ax_dx       0x29,0xd0
#define sbb_cx_cx       0x19,0xc9
#define and_ax_cx       0x21,0xc8
#define add_ax_dx       0x01,0xd0
#define sbb_ah_ah       0x18,0xe4

/*
  here come the code bursts ...
*/
/****************************************************************/
#include "codei86.gh"

/* dx:ax  div( ax, cx ) */
#define C_div_ret       HW_D_2( HW_AX, HW_DX )
#define C_div_parms     P_AX_CX
#define C_div_saves      HW_NotD_2( HW_AX, HW_DX )
static byte_seq C_div = {
                3,
                cwd,
                idiv_cx
        };

/****************************************************************/

/* di stosw( di, si, cx ) zaps ax,es,si,cx */
/* used when value of CX is known to be even */

/* es:di stosw( es:di, ds:si, cx ) zaps si,cx */
#define DF_stosw_ret   HW_D( HW_DI )
#define DF_stosw_parms P_ESDI_AX_CX
#define DF_stosw_saves  HW_NotD_2( HW_DI, HW_CX )
static byte_seq DF_stosw = {
                2,
                rep,
                stosw,
        };


#define DP_stosw_ret   DF_stosw_ret
#define DP_stosw_parms DF_stosw_parms
#define DP_stosw_saves  DF_stosw_saves
#define DP_stosw       DF_stosw

#define C_stosw_ret   DF_stosw_ret
#define C_stosw_parms DF_stosw_parms
#define C_stosw_saves  DF_stosw_saves
#define C_stosw       DF_stosw
/****************************************************************/

/* di stoswb( di, si, cx ) zaps ax,es,si,cx */
/* used when value of CX is known to be even */

/* es:di stoswb( es:di, ds:si, cx ) zaps si,cx */
#define DF_stoswb_ret   HW_D( HW_DI )
#define DF_stoswb_parms P_ESDI_AX_CX
#define DF_stoswb_saves  HW_NotD_2( HW_DI, HW_CX )
static byte_seq DF_stoswb = {
                3,
                rep,
                stosw,
                stosb,
        };


#define C_stoswb_ret   DF_stoswb_ret
#define C_stoswb_parms DF_stoswb_parms
#define C_stoswb_saves  DF_stoswb_saves
#define C_stoswb       DF_stoswb

#define DP_stoswb_ret   DF_stoswb_ret
#define DP_stoswb_parms DF_stoswb_parms
#define DP_stoswb_saves  DF_stoswb_saves
#define DP_stoswb       DF_stoswb
/****************************************************************/

/* ax memcmp( si, di, cx ) zaps ax,es,si,di,cx */
#define C_memcmp_ret    HW_D( HW_AX )
#define C_memcmp_parms  P_SI_DI_CX
#define C_memcmp_saves   HW_NotD_5( HW_AX, HW_ES, HW_SI, HW_DI, HW_CX )
static byte_seq C_memcmp = {
                15,
                mov_ax_ds,
                mov_es_ax,
                xor_rr, ax_ax,
                repz,
                cmpsb,
                je,  5,
                sbb_rr, ax_ax,
                sbb_ax_i, 0xff, 0xff
        };


/* cx memcmp( ds:si, es:di, cx ) zaps si,di,cx */
#define DF_memcmp_ret   HW_D( HW_CX )
#define DF_memcmp_parms P_DSSI_ESDI_CX
#define DF_memcmp_saves  HW_NotD_3( HW_SI, HW_DI, HW_CX )
static byte_seq DF_memcmp = {
                11,
                or_cx_cx,
                repz,
                cmpsb,
                je,  5,
                sbb_rr, cx_cx,
                sbb_cx_ffff     /* 3 bytes */
        };


/* cx memcmp( cx:si, es:di, ax ) zaps si,di,cx,ax */
#define DP_memcmp_ret   HW_D( HW_CX )
#define DP_memcmp_parms P_CXSI_ESDI_AX
#define DP_memcmp_saves  HW_NotD_4( HW_SI, HW_DI, HW_CX, HW_AX )

⌨️ 快捷键说明

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