home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
spawno40.arj
/
SOURCE.ZIP
/
RULES.ASI
< prev
next >
Wrap
Text File
|
1991-11-17
|
6KB
|
305 lines
.XLIST
PAGE
;[]------------------------------------------------------------[]
;| RULES.ASI -- Rules & Structures for assembler |
;| |
;| Turbo-C Run Time Library version 2.0 |
;| |
;| Copyright (c) 1987,1988 by Borland International Inc. |
;| All Rights Reserved. |
;[]------------------------------------------------------------[]
; 4/15/88 ah:
; Emulator segment directives modified for Turbo Pascal
; using _Pascal_ conditional.
; 9/91 rb:
; Removed definitions not needed by SPAWNO
; 11/91 rb:
; Added Turbo Pascal compatibility
;[]------------------------------------------------------------[]
;| |
;| Conditional Assembly Directives |
;| |
;[]------------------------------------------------------------[]
IFDEF __TINY__ ; *** Special case ***
__SMALL__ equ 1
ENDIF
IFDEF __HUGE__ ; *** Special case ***
__LARGE__ equ 1
ENDIF
IFNDEF __SMALL__
IFNDEF __MEDIUM__
IFNDEF __COMPACT__
IFNDEF __LARGE__
%OUT You must supply a model symbol.
.ERR
ENDIF
ENDIF
ENDIF
ENDIF
IFDEF __SMALL__ ; Small Code - Small Data
LPROG equ 0
LDATA equ 0
ENDIF
IFDEF __MEDIUM__ ; Large Code - Small Data
LPROG equ 1
LDATA equ 0
ENDIF
IFDEF __COMPACT__ ; Small Code - Large Data
LPROG equ 0
LDATA equ 1
ENDIF
IFDEF __LARGE__ ; Large Code - Large Data
LPROG equ 1
LDATA equ 1
ENDIF
IFDEF __TP
__TEXT equ CODE
ELSEIF LPROG
__TEXT equ SPAWNO_TEXT
ELSE
__TEXT equ _TEXT
ENDIF
PAGE
;[]------------------------------------------------------------[]
;| |
;| Segment Declarations Macros |
;| |
;[]------------------------------------------------------------[]
CSeg@ MACRO ;; Open a Code Segment
IFDEF __TP
CODE SEGMENT BYTE PUBLIC
ELSEIF LPROG
SPAWNO_TEXT SEGMENT BYTE PUBLIC 'CODE'
ELSE
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ENDIF
ASSUME CS:__TEXT
ENDM
CSegEnd@ MACRO ;; Close a Code Segment
IFDEF __TP
CODE ENDS
ELSEIF LPROG
SPAWNO_TEXT ENDS
ELSE
_TEXT ENDS
ENDIF
ENDM
DSeg@ MACRO ;; Open a Data Segment (initialized)
IFDEF __TP
; DATA SEGMENT WORD PUBLIC
CSeg@
ELSE
_DATA SEGMENT WORD PUBLIC 'DATA'
ENDIF
ENDM
DSegEnd@ MACRO ;; Close a Data Segment (initialized)
IFDEF __TP
; DATA ENDS
CSegEnd@
ELSE
_DATA ENDS
ENDIF
ENDM
IFNDEF __HUGE__
BSeg@ MACRO ;; Open a Data Segment (un-initialized)
IFDEF __TP
DATA SEGMENT WORD PUBLIC
ELSE
_BSS SEGMENT WORD PUBLIC 'BSS'
ENDIF
ENDM
BSegEnd@ MACRO ;; Close a Data Segment (un-initialized)
IFDEF __TP
DATA ENDS
ELSE
_BSS ENDS
ENDIF
ENDM
ELSE
BSeg@ MACRO
DSeg@
ENDM
BSegEnd@ MACRO
DSegEnd@
ENDM
ENDIF
IFDEF __TP
JSeg@ MACRO ;; Jump tables & other relocatable data
CSeg@
ENDM
JS_ equ CS:
ELSE
JSeg@ MACRO ;; Jump tables & other relocatable data
DSeg@
ENDM
JS_ equ DS:
ENDIF
JSegEnd@ MACRO ;; end of jump table/relocatable data
IFDEF __TP
CSegEnd@
ELSE
DSegEnd@
ENDIF
ENDM
Header@ MACRO ;; set up all segments in proper order
IFDEF __TP
NOWARN RES
ENDIF
CSeg@
CSegEnd@
DSeg@
DSegEnd@
IFNDEF __HUGE__
BSeg@
BSegEnd@
ENDIF
IFDEF __TINY__
DGROUP GROUP _TEXT, _DATA, _BSS
ELSEIFDEF __HUGE__
DGROUP GROUP _DATA
ELSEIFDEF __TP
DGROUP GROUP DATA
ELSE
DGROUP GROUP _DATA, _BSS
ENDIF
ASSUME CS:__TEXT, DS:DGROUP
ENDM
PAGE
;[]------------------------------------------------------------[]
;| |
;| C Naming Convention Macros |
;| |
;[]------------------------------------------------------------[]
ExtSym@ MACRO Sym, sType, sName
IFDIF <sName>, <__PASCAL__>
EXTRN _&Sym : sType
Sym&@ equ _&Sym
ELSE
EXTRN Sym : sType
Sym&@ equ Sym
ENDIF
ENDM
PubSym@ MACRO Sym, Definition, sName
IFDIF <sName>, <__PASCAL__>
PUBLIC@ _&Sym
_&Sym Definition
Sym&@ equ _&Sym
ELSE
PUBLIC@ Sym
Sym Definition
Sym&@ equ Sym
ENDIF
ENDM
IFDEF __TP
PUBLIC@ MACRO ID
ENDM
ELSE
PUBLIC@ MACRO ID
PUBLIC ID
ENDM
ENDIF ;__TP
PAGE
;[]------------------------------------------------------------[]
;| |
;| Macros which are Data Size Dependent |
;| |
;[]------------------------------------------------------------[]
IF LDATA
DPTR_ equ DWORD PTR
dPtrSize equ 4
LES_ equ LES
ES_ equ ES:
LDS_ equ LDS
pushDS_ MACRO
PUSH DS
ENDM
popDS_ MACRO
POP DS
ENDM
ELSE
DPTR_ equ WORD PTR
dPtrSize equ 2
LES_ equ MOV
ES_ equ DS:
LDS_ equ MOV
pushDS_ MACRO
ENDM
popDS_ MACRO
ENDM
ENDIF
PAGE
;[]------------------------------------------------------------[]
;| |
;| Macros which are Code Size Dependent |
;| |
;[]------------------------------------------------------------[]
IF LPROG
cPtrSize equ 4
PubProc@ MACRO Sym, sName ;; Open a Public function
PubSym@ Sym, <PROC FAR>, sName
ENDM
ExtProc@ MACRO Sym, sName ;; External Function
ExtSym@ Sym, FAR, sName
ENDM
ELSE
cPtrSize equ 2
PubProc@ MACRO Sym, sName ;; Open a Public function
PubSym@ Sym, <PROC NEAR>, sName
ENDM
ExtProc@ MACRO Sym, sName ;; External Function
ExtSym@ Sym, NEAR, sName
ENDM
ENDIF
EndProc@ MACRO Sym, sName ;; Close a function
IFDIF <sName>, <__PASCAL__>
_&Sym ENDP
ELSE
Sym ENDP
ENDIF
ENDM
.LIST