Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : DVGLUE17.ZIP
Filename : RULES.ASI

 
Output of file : RULES.ASI contained in archive : DVGLUE17.ZIP
.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
; 12/92 rb:
; modified for DV-GLUE v1.5

;[]------------------------------------------------------------[]
;| |
;| 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
DIST equ NEAR
ENDIF

IFDEF __MEDIUM__ ; Large Code - Small Data
LPROG equ 1
LDATA equ 0
DIST equ FAR
ENDIF

IFDEF __COMPACT__ ; Small Code - Large Data
LPROG equ 0
LDATA equ 1
DIST equ NEAR
ENDIF

IFDEF __LARGE__ ; Large Code - Large Data
LPROG equ 1
LDATA equ 1
DIST equ FAR
ENDIF

IFDEF __TP
__TEXT equ CODE
ELSEIF LPROG
__TEXT equ DVGLUE_TEXT
ELSE
__TEXT equ _TEXT
ENDIF

PAGE
;[]------------------------------------------------------------[]
;| |
;| Segment Declarations Macros |
;| |
;[]------------------------------------------------------------[]

CSeg@ MACRO ;; Open a Code Segment
IFDEF __TP
CODE SEGMENT BYTE PUBLIC
ELSEIF LPROG
DVGLUE_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
DVGLUE_TEXT ENDS
ELSE
_TEXT ENDS
ENDIF
ENDM

DSeg@ MACRO ;; Open a Data Segment (initialized)
IFDEF __TP
CSeg@
ELSE
_DATA SEGMENT WORD PUBLIC 'DATA'
ENDIF
ENDM

DSegEnd@ MACRO ;; Close a Data Segment (initialized)
IFDEF __TP
CSegEnd@
ELSE
_DATA ENDS
ENDIF
ENDM

VerStartSeg@ MACRO
_DATA_VER_FIRST SEGMENT WORD PUBLIC 'DATA'
ENDM

VerStartEnd@ MACRO
_DATA_VER_FIRST ENDS
ENDM

VerSeg@ MACRO ;; Open data segment for minimum version numbers
_DATA_VER SEGMENT WORD PUBLIC 'DATA'
ENDM

VerSegEnd@ MACRO ;; Close data segment for min version numbers
_DATA_VER ENDS
ENDM

VerLastSeg@ MACRO
_DATA_VER_LAST SEGMENT WORD PUBLIC 'DATA'
ENDM

VerLastEnd@ MACRO
_DATA_VER_LAST ENDS
ENDM

XVerSeg@ MACRO ;; Open data seg for minimum DV/X version numbers
_DATA_XVER SEGMENT WORD PUBLIC 'DATA'
ENDM

XVerSegEnd@ MACRO ;; Close data seg for min DV/X version numbers
_DATA_XVER ENDS
ENDM

XVerLastSeg@ MACRO
_DATA_XVER_LAST SEGMENT WORD PUBLIC 'DATA'
ENDM

XVerLastEnd@ MACRO
_DATA_XVER_LAST ENDS
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 $DVG$MIN_VER
$$DVG$MIN_VER equ $DVG$MIN_VER
ELSE
$$DVG$MIN_VER equ 0
ENDIF
IFDEF __TP
NOWARN RES
ENDIF
CSeg@
CSegEnd@
DSeg@
DSegEnd@
IFNDEF __TP
IF $$DVG$MIN_VER gt 0
VerStartSeg@
VerStartEnd@
VerSeg@
dw $$DVG$MIN_VER
VerSegEnd@
VerLastSeg@
VerLastEnd@
XVerSeg@
IFDEF $DVG$MIN_XVER
dw $DVG$MIN_XVER
ENDIF ;$DVG$MIN_XVER
XVerSegEnd@
XVerLastSeg@
XVerLastEnd@
ENDIF ;$$DVG$MIN_VER
ENDIF
IFNDEF __HUGE__
BSeg@
BSegEnd@
ENDIF

IFDEF __TINY__
IF $$DVG$MIN_VER gt 0
DGROUP GROUP _TEXT, _DATA, _DATA_VER, _DATA_XVER, _BSS
ELSE
DGROUP GROUP _TEXT, _DATA, _BSS
ENDIF
ELSEIFDEF __HUGE__
IF $$DVG$MIN_VER gt 0
DGROUP GROUP _DATA, _DATA_VER, _DATA_XVER
ELSE
DGROUP GROUP _DATA
ENDIF
ELSEIFDEF __TP
DGROUP GROUP DATA
ELSE
IF $$DVG$MIN_VER gt 0
DGROUP GROUP _DATA, _DATA_VER, _DATA_XVER, _BSS
ELSE
DGROUP GROUP _DATA, _BSS
ENDIF
ENDIF
ASSUME CS:__TEXT, DS:DGROUP
ENDM

PAGE
;[]------------------------------------------------------------[]
;| |
;| C Naming Convention Macros |
;| |
;[]------------------------------------------------------------[]

ExtSym@ MACRO Sym, sType, sName
IFDIF , <__PASCAL__>
EXTRN _&Sym : sType
Sym&@ equ _&Sym
ELSE
EXTRN Sym : sType
Sym&@ equ Sym
ENDIF
ENDM

PubSym@ MACRO Sym, Definition, sName
IFDIF , <__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:
SS_ equ SS:
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:
SS_ equ DS:
LDS_ equ MOV

pushDS_ MACRO
ENDM

popDS_ MACRO
ENDM

ENDIF ;LDATA

IFDEF __HUGE__

Overhead equ 4+cPtrSize ; bytes between BP and first stack arg

SET_DS MACRO reg
push ds
IFNB
mov reg,DGROUP
mov ds,reg
ELSE
mov ax,DGROUP
mov ds,ax
ENDIF
ASSUME DS:DGROUP
ENDM

RESTORE_DS MACRO
pop ds
ASSUME DS:NOTHING
ENDM

ELSE ;__HUGE__

Overhead equ 2+cPtrSize ; bytes between BP and first stack arg

SET_DS MACRO reg
ASSUME DS:DGROUP
ENDM

RESTORE_DS MACRO
ENDM

ENDIF ;__HUGE__

PAGE
;[]------------------------------------------------------------[]
;| |
;| Macros which are Code Size Dependent |
;| |
;[]------------------------------------------------------------[]

IF LPROG
cPtrSize equ 4
CPTR_ equ DWORD PTR

PubProc@ MACRO Sym, sName ;; Open a Public function
PubSym@ Sym, , sName
IFDEF __HUGE__
ASSUME DS:NOTHING
ELSE
ASSUME DS:DGROUP
ENDIF
ENDM

ExtProc@ MACRO Sym, sName ;; External Function
ExtSym@ Sym, FAR, sName
ENDM

TAIL_CALL MACRO Dest
CALL Dest
RET
ENDM

ELSE
cPtrSize equ 2
CPTR_ equ WORD PTR

PubProc@ MACRO Sym, sName ;; Open a Public function
PubSym@ Sym, , sName
ASSUME DS:DGROUP
ENDM

ExtProc@ MACRO Sym, sName ;; External Function
ExtSym@ Sym, NEAR, sName
ENDM

TAIL_CALL MACRO Dest
JMP Dest
ENDM

ENDIF

EndProc@ MACRO Sym, sName ;; Close a function
IFDIF , <__PASCAL__>
_&Sym ENDP
ELSE
Sym ENDP
ENDIF
ENDM

PAGE
;[]------------------------------------------------------------[]
;| |
;| Macros for Automatic Version Checks |
;| |
;[]------------------------------------------------------------[]

REQUIRED_DV_VERSION equ 0200h ; need at least 2.00 to use DV-GLUE

MIN_VERSION MACRO major,minor
LOCAL version
IFNDEF __TP
IFB
.ERR "You must supply both major and minor version"
ENDIF
IFB
.ERR "You must supply both major and minor version"
ENDIF
version = (256*major)+minor
IF version gt REQUIRED_DV_VERSION
$DVG$MIN_VER equ (256*major)+minor
ELSE
$DVG$MIN_VER equ 0
ENDIF
ENDIF ;__TP
ENDM


MIN_X_VERSION MACRO major,minor
IFNDEF __TP
IFB
.ERR "You must supply both major and minor version"
ENDIF
IFB
.ERR "You must supply both major and minor version"
ENDIF
$DVG$MIN_XVER equ (256*major)+minor
MIN_VERSION 2,50
ENDIF ;__TP
ENDM

;[]------------------------------------------------------------[]
;| |
;| Stack Frame macros |
;| |
;[]------------------------------------------------------------[]


@Enter MACRO size,reg
ASSUME DS:NOTHING
SET_DS reg
push bp
mov bp,sp
IFNB
sub sp,size
ENDIF
ENDM

@Exit MACRO restore
IFDEF DV386
leave
ELSE
IFNB
mov sp,bp
ENDIF
pop bp
ENDIF ;DV386
RESTORE_DS
ENDM


.LIST


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : DVGLUE17.ZIP
Filename : RULES.ASI

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/