Category : Utilities for DOS and Windows Machines
Archive   : DKEY120.ZIP
Filename : STRUCT.MAC

 
Output of file : STRUCT.MAC contained in archive : DKEY120.ZIP

;
; MACRO: ENTER
;
; Macro placed at entry point of routine, sets up important stuff.
;
; PARAMETERS:
;
; NONE
;

ENTER macro
IF LPROG
pass_o = 6
ELSE
pass_o = 4
ENDIF
local_o = 0
res_amt = 0

PUSH BP
MOV BP,SP

endm ; ENTER

;
; MACRO: REGPARM
;
; Macro to save in LOCAL stack a register.
;
; PARAMETERS:
;
; label - Variable name used in other references
; reg - Register to save on stack
;

REGPARM macro label,reg
local_o = local_o + 2
PUSH REG
MAKE_BP label,-%local_o,WORD

endm ; REGPARM


REDEF macro label,type
MAKE_BP label,-%local_o,type

endm ; REDEF

;
; MACRO: RESWORD
;
; Macro to allocate a word of storage on local stack and give the
; location a name.
;
; PARAMETERS:
;
; label - Name that location will go by.
;

RESWORD macro label
local_o = local_o + 2
res_amt = res_amt + 2
MAKE_BP label,-%local_o,WORD

endm ; RESWORD

RESDWORD macro label
local_o = local_o + 4
res_amt = res_amt + 4
MAKE_BP label,-%local_o,DWORD

endm ; RESDWORD

;
; MACRO: PASSW
;
; Macro that creates a label out of a passed parameter pushed on the
; stack by the CALLER!
;
; PARAMETERS:
;
; label - Variable name to use in reference.
;

IF LDATA
PASSA macro label
PASSD label
endm
ELSE
PASSA macro label
PASSW label
endm
ENDIF



PASSW macro label
MAKE_BP label,%pass_o,WORD
pass_o = pass_o + 2

endm ; PASSW


PASSD macro label ;; SAME THING FOR POINTERS
MAKE_BP label,%pass_o,DWORD ;; DWORD REFERENCE
PASSW label&_OFF ;; AND TWO WORD REFERENCES
PASSW label&_SEG

endm ; PASSD

;
; MACRO: RESERVE
;
; Macro used prior to FIRST executable statement in subroutine.
; Allocates stack space for local variables.
;
; PARAMETERS: (NONE)
;

RESERVE macro
SUB SP,res_amt

endm ; RESERVE

;
; MACRO: RETURN
;
; Macro used to return from a subroutine, will release local variables,
; restore BP and return to caller
;
; PARAMETERS: (NONE)
;

RETURN macro
MOV SP,BP
POP BP
RET

endm ; RETURN


MAKE_BP macro label,value,type
label EQU type PTR value[BP]

endm ; MAKE_BP



; The following macros make procedure definitions easier

IF LPROG

PROCEDURE MACRO NAME
PUBLIC NAME
NAME PROC FAR
ENDM

EXTERNAL MACRO NAME
EXTRN NAME:FAR
ENDM

ELSE

PROCEDURE MACRO NAME
PUBLIC NAME
NAME PROC NEAR
ENDM

EXTERNAL MACRO NAME
EXTRN NAME:NEAR
ENDM

ENDIF


  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : DKEY120.ZIP
Filename : STRUCT.MAC

  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/