; LM8086.MAC  13 Dec 83  Craig Milo Rogers at USC/ISI
;	Prevent multiply defined GROUPs.

;**
;
; This macro library defines the operating environment for the 8086 large
; model, which allows 1Mbyte for program and 1 Mbyte for data.
;
;**

;**
;
; The following symbols define the 8086 memory mode being used.  Set LPROG
; to 1 for a large program segment (greater than 64K-bytes), and set LDATA
; to 1 for a large data segment.
;
;**
LPROG	EQU	0
LDATA	EQU	0

;**
;
; The following symbols are established via LPROG and LDATA as follows:
;
;	S8086	set for small model (small prog, small data)
;	D8086	set for model with large data, small prog
;	P8086	set for model with large prog, small data
;	L8086	set for large model
;
;**
	IF	(LPROG EQ 0) AND (LDATA EQ 0)
S8086	EQU	1
D8086	EQU 	0
P8086	EQU	0
L8086	EQU	0
	ENDIF

	IF	(LPROG EQ 0) AND (LDATA NE 0)
S8086	EQU	0
D8086	EQU	1
P8086	EQU	0
L8086	EQU	0
	ENDIF

	IF	(LPROG NE 0) AND (LDATA EQ 0)
S8086	EQU	0
D8086	EQU	0
P8086	EQU	1
L8086	EQU	0
	ENDIF

	IF	(LPROG NE 0) AND (LDATA NE 0)
S8086	EQU	0
D8086	EQU	0
P8086	EQU	0
L8086	EQU	1
	ENDIF


;**
;
; The DSEG and PSEG macros are defined to generate the appropriate GROUP
; and SEGMENT statements for the memory model being used.  The ENDDS and
; ENDPS macros are then used to end the segments.
;
;**
DSEG	MACRO	
	IFNDEF	DGROUP
DGROUP	GROUP	DATA
	ENDIF
DATA	SEGMENT	WORD PUBLIC 'DATA'
	ASSUME	DS:DATA
	ENDM
ENDDS	MACRO
DATA	ENDS
	ENDM

	IF	S8086
PSEG	MACRO
	IFNDEF	PGROUP
PGROUP	GROUP	PROG
	ENDIF
PROG	SEGMENT	BYTE PUBLIC 'PROG'
	ASSUME	CS:PROG
	ENDM
ENDPS	MACRO
PROG	ENDS
	ENDM
	ENDIF

	IF	D8086
PSEG	MACRO
	IFNDEF	CGROUP
CGROUP	GROUP	CODE
	ENDIF
CODE	SEGMENT	BYTE PUBLIC 'CODE'
	ASSUME	CS:CODE
	ENDM
ENDPS	MACRO
CODE	ENDS
	ENDM
	ENDIF

	IF	P8086
PSEG	MACRO
_CODE	SEGMENT	BYTE
	ASSUME	CS:_CODE
	ENDM
ENDPS	MACRO
_CODE	ENDS
	ENDM
	ENDIF

	IF	L8086
PSEG	MACRO
_PROG	SEGMENT	BYTE
	ASSUME	CS:_PROG
	ENDM
ENDPS	MACRO
_PROG	ENDS
	ENDM
	ENDIF
