;********************************************************************** ; ; This macro library defines the operating environment for the 8086 LARGE ; memory model using MSC 'C' Compiler. ; ; Written by Antonio Pastore, 19 Dec 1986 - Torino - ITALY ; ; Updated: ; 17 Nov 1987 ;********************************************************************** ; ;********************************************************************** ; ; 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 _DATA SEGMENT WORD PUBLIC 'DATA' _DATA ENDS IF MSC ; For MSC 5.x ONLY! CONST SEGMENT WORD PUBLIC 'CONST' CONST ENDS ENDIF _BSS SEGMENT WORD PUBLIC 'BSS' _BSS ENDS IF MSC ; For MSC 5.x ONLY! CONST SEGMENT WORD PUBLIC 'CONST' CONST ENDS DGROUP GROUP CONST, _BSS, _DATA ELSE DGROUP GROUP _BSS, _DATA ENDIF _DATA segment word public 'DATA' assume ds:DGROUP, ss: DGROUP, es: DGROUP ENDM ; ENDDS macro _DATA ends endm ; PSEG macro name name&_TEXT segment byte public 'CODE' assume cs:name&_TEXT endm ; ENDPS macro name name&_TEXT ends endm ; ;********************************************************************** ; ; The FUNCTION, EXIT_FUNC and ENTRY macros establish appropriate function entry ; points depending on whether NEAR or FAR program addressing is being used. The ; only difference between the two is that FUNCTION generates a PROC operation ; to start a segment. PAR_BASE is the minimum displacement for paramters. ; ;********************************************************************** ; PAR_BASE equ bp + 6 ; parameter base displacement LOCAL_BASE equ bp - 2 ; LOCALS base displacement SIZEPTR equ 4 ; size of pointers LARGECODE equ 1 ; define model SMALLCODE equ 0 ; define model LARGEDATA equ 1 ; define model SMALLDATA equ 0 ; define model ;********************************************************************** FUNCTION MACRO name, args ; Function entry declaration PUBLIC name ; name PROC FAR ; push bp ; save base pointer mov bp, sp ; create new frame IFNB ; IF args ; sub sp, args ; Create locals ENDIF ; ENDIF ; ; NOTE: DS not loaded push si push di ENDM ; ; EXIT_FUNC MACRO name ; Function exit declaration pop di pop si mov sp, bp ; Delete locals, if any pop bp ; ret ; name ENDP ; ENDM ; ;********************************************************************** LOAD_DS MACRO NAME ; push ds ; mov ax, DGROUP ; Satisfy ASSUME statement mov ds, ax ; ENDM ; ;********************************************************************** ENTRY MACRO NAME ; PUBLIC NAME ; NAME LABEL FAR ; ENDM ; SAVE_REG macro push ax push bx push cx push dx push si push di push bp push es push ds endm ; REST_REG macro pop ds pop es pop bp pop di pop si pop dx pop cx pop bx pop ax endm ;******************** END OF FILE ********************