home *** CD-ROM | disk | FTP | other *** search
- ;***************************************
- ; Standard definitions.
-
- IFNDEF _STDDEF_
- _STDDEF_ = 1
-
- FALSE EQU 0 ;false value
- TRUE EQU -1 ;true value
-
- ;=======================================
- ; Check if argument is 8 bit register.
- ; If so, ?ISR8 is set to TRUE.
-
- ?reg8 MACRO arg
- ?isr8 = FALSE
- IRP test, <ah, al, bh, bl, ch, cl, dh, dl>
- IFIDNI <arg>, <test>
- ?isr8 = TRUE
- EXITM
- ENDIF
- ENDM
- ENDM
-
- ;=======================================
- ; Check if argument is 16 bit register.
- ; If so, ?ISR16 is set to TRUE.
-
- ?reg16 MACRO arg
- ?isr16 = FALSE
- IRP test, <ax, bx, cx, dx, di, si, bp, cs, ds, es, ss>
- IFIDNI <arg>, <test>
- ?isr16 = TRUE
- EXITM
- ENDIF
- ENDM
- ENDM
-
- ;=======================================
- ; Check if argument is immediate data.
- ; If so, ?ISI is set to true.
-
- ?imed MACRO arg
- ?isi = FALSE
- IFE (TYPE arg)
- ?reg16 arg
- IFE ?isr16
- ?reg8 arg
- IFE ?isr8
- ?isi = TRUE
- ENDIF
- ENDIF
- ENDIF
- ENDM
-
- ;=======================================
- ; Load any 16 bit argument to the stack.
- ; WARNING: destroys BP if argument is
- ; immediate data.
-
- ldarg MACRO arg
- IF (TYPE arg) EQ 0
- ?reg16 arg
- IF ?isr16
- push arg
- ELSE
- mov bp, arg
- push bp
- ENDIF
- ELSE
- push arg
- ENDIF
- ENDM
-
- ;=======================================
- ; Load some number of 16 bit arguments
- ; to the stack.
-
- ldargs MACRO args
- IRP arg, <args>
- ldarg arg
- ENDM
- ENDM
-
- ;=======================================
- ; Load a register.
-
- ldreg MACRO reg, val
- IFNB <val>
- IFDIFI <val>, <reg>
- mov reg, val
- ENDIF
- ENDIF
- ENDM
-
- ;=======================================
- ; Load an address to DX or DS:DX.
-
- ldadr MACRO addr
- IFNB <addr>
- IF TYPE (addr) EQ 0
- IFDIFI <addr>, <dx>
- mov dx, addr
- ENDIF
- ELSE
- IF TYPE (addr) EQ 1
- mov dx, OFFSET addr
- ELSE
- IF TYPE (addr) EQ 2
- mov dx, addr
- ELSE
- IF TYPE (addr) EQ 4
- lds dx, addr
- ELSE
- .ERR
- %OUT Incorrect address specification
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- ENDM
-
- ENDIF
-