BEGLIB MACRO name
  .MODEL TINY
  .CODE
  .386
  .387
  STARTLIB:
  ORG 0
  ALIGN BYTE
  DB 'lib2d'
  DW FIRST
  DW 0
  DW 0
  DB 1,0
  DB name,0
  LINK = 0
ENDM

SAX MACRO reg
  mov reg,ax
  pop ax
ENDM

LAX MACRO reg
  push ax
  mov ax,reg
ENDM


ITEM MACRO NAME, FLAG, PR, LOC
  LOCAL LTMP
  LTMP = $
  DW LINK
  DB FLAG
  DB PR
  DB LOC
  DB NAME, 0
  LINK = LTMP
ENDM

VAR MACRO NAME, INTER
  LOCAL LOC
  ITEM NAME, 0, -1
  CALL LOC
  INTER DW ?
  LOC:
ENDM

ENDLIB MACRO
  ITEM '',0,0,0
  nop
  FIRST = LINK
  END STARTLIB
ENDM



