Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~phil/hardware/vertex/sharemegsvertex/lcu/Sun/include/pctcp/mmodel.inc
Дата изменения: Fri Dec 24 16:56:11 1999
Дата индексирования: Thu Jan 15 14:57:20 2009
Кодировка:

Поисковые слова: iss
;
; $Header: J:\devkit.dos\vcs\include\mmodel.inv 1.4 26 Jan 1994 23:07:00 carvalho $
;

;
; MMODEL.DEF - definitions for PC/TCP "PC" library for multiple
; memory models.
;
; Copyright 1987 - 1993, by FTP Software Inc.
;
; This software is furnished under a license and may be used and copied
; only in accordance with the terms of such license and with the
; inclusion of the above copyright notice. This software or any other
; copies thereof may not be provided or otherwise made available to any
; other person. No title to and ownership of the software is hereby
; transferred.
;
; The information in this software is subject to change without notice
; and should not be construed as a commitment by FTP Software, Inc.
;
; Edit History
; 10-Aug-87 jbvb Create, based on NETLIB\SYSLIB.ASM
; 11-Dec-89 jbvb Add POPFF definition.
; 17-Jun-93 paul re-arranged, added 32-bit protected mode stuff

IFNDEF _32BIT ;;;; Real mode

IFDEF LCODE ;; medium, large, huge models

CPROC MACRO func
PUBLIC func
func PROC FAR
ENDM

; distance to first stack arugment, indexed from BP
SARG EQU 6 ; 4-byte return address, 2-byte BP

ELSE ;; not LCODE - small, compact models

CPROC MACRO func
PUBLIC func
func PROC NEAR
ENDM

; distance to first stack arugment, indexed from BP
SARG EQU 4 ; 2-byte return address, 2-byte BP

ENDIF ;; LCODE

; sizes of various data types
SSHORT EQU 2
SINT EQU 2
SLONG EQU 4

IFDEF LDATA ; compact, large, huge models
SPTR EQU 4 ; default pointer = far
ELSE ; small, medium models
SPTR EQU 2 ; default pointer = near
ENDIF

SFPTR EQU 4 ; far pointer: 2-byte offset + 2-byte segment

ELSE ;;;; 32-bit protected mode

.386p
;
; First define some name-mangling macros. MSC and Borland add a leading
; underscore to all global symbol names, so most of our assembly code has
; that underscore "hard-coded". Watcom (bless them) use a different naming
; convention: in register parameter-passing mode, variables have a leading
; underscore, but functions have a trailing underscore; in stack
; parameter-passing mode, variables and functions have no underscores
; (leading or trailing). Rather than changing a lot of existing assembly
; code that may not even be used in protected mode, I'll do the following
; squirrely stuff for Watcom.
;

CODENAME MACRO func
ifdef __WATCOMC__
ifdef _WC_R ; register parameter passing:
_T textequ <@SubStr(func, 2)_> ; replace leading with trailing
else ; stack parameter passing:
_T textequ <@SubStr(func, 2)> ; remove leading underscore
endif
func textequ _T
endif
ENDM

DATANAME MACRO var
ifdef __WATCOMC__
ifdef _WC_R ; register parameter passing:
; leave it alone ; leading underscore
else ; stack parameter passing:
_T textequ <@SubStr(var, 2)> ; remove leading underscore
var textequ _T
endif
endif
ENDM

PUBCODE MACRO func ; mangle function name, make it public
CODENAME func
PUBLIC func
ENDM

PUBDATA MACRO func ; mangle variable name, make it public
DATANAME func
PUBLIC func
ENDM

CPROC MACRO func ; declare a C-callable procedure
PUBCODE func
func PROC NEAR
ENDM

; distance to first stack arugment, indexed from EBP
SARG EQU 8 ; 4-byte return address, 4-byte EBP

; sizes of various data types
SSHORT EQU 4 ; 2-byte value, but 4 bytes are pushed on the stack
SINT EQU 4
SLONG EQU 4
SPTR EQU 4 ; near pointer: 4-byte offset
SFPTR EQU 8 ; far pointer: 4-byte offset + 2-byte selector
; (4 bytes of selector are pushed, as above)

ENDIF ;;;; protected/real mode

; Pop Flags macro works around 80286 chip bug.

POPFF MACRO
local poplab
jmp $+3
poplab: iret
push cs
call poplab
ENDM

;
; $Log: J:\devkit.dos\vcs\include\mmodel.inv $
;
; Rev 1.4 26 Jan 1994 23:07:00 carvalho
;
; Result of v3.0 branch and v2.3 trunk merge.
;
; Rev 1.3.1.0 29 Dec 1993 17:38:44 paul
; Re-arranged, added 32-bit protected mode stuff.
;
; Rev 1.3 28 Oct 1993 12:16:20 arnoff
; cleaned up.
;
; Rev 1.2 28 Jul 1993 15:31:44 arnoff
; Merge Lilac Branch into trunk.
;
; Rev 1.1.1.0 03 May 1993 16:31:56 irina
; irina Merged with changes made to 2.21 kernel tree
;
; Rev 1.1 22 Jun 1992 16:33:18 paul
; track changes from 2.1
;
; Rev 1.0 30 Jan 1992 08:26:24 arnoff
;
;