MACRO @LOADSEG Segt, Value
LOCAL @@IsSegReg
MACRO @@CheckSegReg Register
@@IsSegReg=0
IF (SYMTYPE Register) EQ 110000b
IRP Reg, <CS, DS, ES, FS, GS, SS>
IFIDNI <Register>, <&Reg&>
@@IsSegReg = 1
EXITM
ENDIF
ENDM
ENDIF
ENDM
@@CheckSegReg <Value>
IF @@IsSegReg
Push Value
Pop Segt
ELSE
IF (SYMTYPE Value) EQ 0h
Mov Segt, Value
ELSE
Mov AX, Value
Mov Segt, AX
ENDIF
ENDIF
ENDM
MACRO @GET_VECT INT_NB
Mov AX, 3500h + INT_NB
INT 21h
ENDM
MACRO @SET_VECT INT_NB, SEGT, OFFS
Mov DX, OFFS
IFDIFI <SEGT>, <DS>
Push DS
@LOADSEG DS, SEGT
ENDIF
Mov AX, 2500h + INT_NB
INT 21h
IFDIFI <SEGT>, <DS>
Pop DS
ENDIF
ENDM
MACRO @DOS_EXEC TYPE, SEGT_PAR, OFFS_PAR, SEGT_PROGNAME, OFFS_PROGNAME
Mov AX, 4B00h + TYPE ; Program execution service
@LOADSEG ES, SEGT_PAR
Mov BX, OFFS_PAR ; ES:BX = Parameter block
@LOADSEG DS, SEGT_PROGNAME
Mov DX, OFFS_PROGNAME ; DS:DX = Porgram name
INT 21h
ENDM
MACRO @DOS_EXIT RC
IFB <RC>
Mov AH, 4Ch
ELSE
Mov AX, 4C00h + RC
ENDIF
INT 21h
ENDM
MACRO @MKPS Id, Msg
LOCAL MsgLen, EndStr
IFB <Id>
ERR "Must pass name of string to @MKPS"
ELSE
IFB <Msg>
ERR "Must pass string parameter to @MKPS"
ELSE
LABEL Id BYTE
DB EndStr-Id-1, &Msg& ; Allocate space for the string
LABEL EndStr BYTE ; a preceding byte storing the
ENDIF ; length of the string
ENDIF
ENDM
MACRO @DCR REP_CNT
LOCAL @@DCR_LOOP
Push AX BX
Mov AX, 0E0Dh
Mov BH, 0
INT 10h
IFNB <REP_CNT>
Push CX
Mov CX, REP_CNT
@@DCR_LOOP:
Mov AL, 0Ah
INT 10h
LOOP @@DCR_LOOP
Pop CX
ELSE
Mov AL, 0Ah
INT 10h
ENDIF
Pop BX AX
ENDM
MACRO @DSEP SEPARATOR
Push AX BX
Mov AX, 0E00h + SEPARATOR
Mov BH, 0
INT 10h
Mov AL, ' '
INT 10h
Pop BX AX
ENDM
MACRO @KB_HIT
Push DS AX
Mov AX, 0040h
Mov DS, AX
Cli
Mov AX, [001Ah]
Cmp AX, [001Ch]
Sti
Pop AX DS
ENDM