.386

     
.$$RESET_DS = 0
.$$CHECK_STACK = ._NO
.$$USE_286_INSTRUCTION_SET = ._YES
.$$ALWAYS_SET_NEW_STACK_FRAME = ._NO

.$$ALWAYS_SAVE_EBX = ._YES

.$$SAVE_SI = .$RSI;
.$$SAVE_DI = .$RDI;
.$$SAVE_ES = .$RES

.$$LATTICE_LONG = ._NO;
.$$FCN_BASE = 8800H 			; .xC_ARGS + .xLABEL
.$$UNDERSCORE = ._LEADING

; DS_SEG EQU 14H

.$$DISPLAY_COMPILER_AND_MEMORY_MODEL MACRO
	%OUT
	%OUT COMPILER ***** ZORTECH C VERSION 3.0+ ******
	IF (.$MEMORY_MODEL EQ ._FLAT_MODEL)
		%OUT MEMORY MODEL       ***** X (FLAT) -- 386 Protected Mode *****
		ENDIF
	ENDM


.$$SET_MEM_MODEL MACRO
			
	IF (.$MEMORY_MODEL EQ ._FLAT_MODEL)
		CODE_PTR = ._SMALL_CODE_PTR;
		DATA_PTR = ._SMALL_DATA_PTR;
		.$$CODE_SIZE = ._SMALL_CODE;
		.$$DATA_SIZE = ._SMALL_DATA;
		.$$DFLT_DATA_ATTR = 0
		.$$DFLT_CODE_ATTR = .$$FCN_BASE
		EXITM
		ENDIF
		
	ENDM


	
.$$SET_CHECK_STACK MACRO
		
	
	ENDM
	
	
.$$SET_FCN_STACK_FRAME MACRO REG_LIST
	
	.@PUSH_N_BYTES = 0
	IF (.$FAR_DS NE 0)
		.@PUSH_N_BYTES = 4;
		ENDIF
	IF (.$$ALWAYS_SAVE_EBX EQ ._YES)
		PUSH	EBX
		.@PUSH_N_BYTES = 4;
		ENDIF
	IF ((.$$CHECK_STACK + .$$ALWAYS_SET_NEW_STACK_FRAME + .$N_FCN_ARG_BYTES + .$N_AUTO_BYTES) GT 0)
		PUSH	EBP
		MOV	EBP, ESP
	     .@PUSH_N_BYTES = .@PUSH_N_BYTES  + 4;
		.$NEW_STACK_FRAME = ._YES
;		IF (.$$CHECK_STACK EQ ._YES) 
;			IF (.$$DATA_SIZE NE ._LARGE_DATA)
;			     IF (.$$DATA_SIZE EQ ._SMALL_DATA)
;			     	cmp	sp, _mwstack_limit
;		     	ELSE
;			     	cmp	sp, ds:_mwstack_limit
;			     	ENDIF
;			ELSE
;			     cmp	sp, ss:-2
;				ENDIF
;		     jnb	LBL_1
;			INT  0
;		  	LBL_1:
;			ENDIF
		ENDIF

		IF (.$N_AUTO_BYTES GT 0) 
			SUB	ESP, .$N_AUTO_BYTES
			ENDIF
	
	.$PUSH_PROLOGUE_REGS <REG_LIST>
	
	IF ((.$N_AUTO_BYTES GT 0) OR (.$PUSH_N_REGS GT 0))
		.$BP_EQUALS_SP = ._NO;
		ENDIF
	
	.$FCN_ARG_BASE = .$FCN_RETURN_PTR_SZ + .@PUSH_N_BYTES
	
	ENDM


DEFINE_DATA_SEG MACRO MODULE_NAME
	
	START_DATA	MACRO
		.386
		_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
		ENDM
		
     END_DATA		MACRO
     	_DATA ENDS
     	ENDM
	
		DGROUP    GROUP     _DATA
		ASSUME    DS:DGROUP
		DS_LBL	EQU		DS
		DS_SEG	EQU		DGROUP
	
	ENDM
		

		
.$$SINGLE_CODE_SEG = ._YES

DEFINE_CODE_SEG  MACRO   MODULE_NAME
    	.$$DEFINE_SEGMENTS _TEXT, PUBLIC
    	ASSUME	CS:_TEXT
    	CS_LBL	EQU _TEXT
	ENDM
		

.$$DEFINE_SEGMENTS MACRO MODULE_NAME, IS_PUBLIC
	
	START_CODE  MACRO
          .386
          MODULE_NAME SEGMENT DWORD USE32 'CODE' IS_PUBLIC 
		ENDM
			
	END_CODE	MACRO
		MODULE_NAME ENDS
		ENDM       
			
	ENDM

