|
|
; ; SYSTEM MACROS ; ; DISPLAY TEXT ON SCREEN ; DISP MACRO TEXT,SEGM IFNB <SEGM> IFDIF <SEGM>,<DS> PUSH DS MOV AX,SEGM MOV DS,AX ENDIF ENDIF IFNB <TEXT> LEA DX,TEXT ENDIF DOS DSTR IFNB <SEGM> IFDIF <SEGM>,<DS> POP DS ENDIF ENDIF ENDM ; DMSG MACRO MSG IFNB <MSG> LEA DX,MSG ENDIF DISP ENDM ; DCHAR MACRO CHAR PUSH DX IFNB <CHAR> MOV DL,CHAR ; SET CHARACTER ELSE MOV DL,AL ENDIF DOS DO POP DX ENDM ; ; CLEAR SCREEN ; CLEAR MACRO MOV CX,00H*256+00H ; ROW=00, COL=00 MOV DX,24H*256+79H ; ROW=24, COL=79 MOV BH,07H ; NORMAL ATTRIBUTE MOV AX,06H*256+00H ; CLEAR WHOLE SCREEN INT 10H ENDM ; POS MACRO ROW,COL,PAGE IFNB <ROW> MOV DX,ROW*256+COL ; SET ROW AND COLUMN ENDIF IFNB <PAGE> MOV BH,PAGE ; SET PAGE ELSE MOV BH,0 ENDIF MOV AH,02H ; POSTIION CURSOR INT 10H ENDM ; DEFMSG MACRO ID,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 IFNB <ID> ID LABEL BYTE ; DEFINE ESSAGE ENDIF IFNB <T1> DB T1 ENDIF IFNB <T2> DB T2 ENDIF IFNB <T3> DB T3 ENDIF IFNB <T4> DB T4 ENDIF IFNB <T5> DB T5 ENDIF IFNB <T6> DB T6 ENDIF IFNB <T7> DB T7 ENDIF IFNB <T8> DB T8 ENDIF IFNB <T9> DB T9 ENDIF IFNB <T10> DB T10 ENDIF DB '$' ENDM ; MOVE MACRO TO,LEN,FROM IFNB <TO> LEA DI,TO ; SET DESTINATION ENDIF IFNB <LEN> MOV CX,LEN ; SET LENGTH ENDIF IFNB <FROM> LEA SI,FROM ; SET SOURCE ENDIF REP MOVS BYTE PTR[DI],BYTE PTR[SI] ENDM MOVEZ MACRO TO,FROM IFNB <TO> LEA DI,TO ; SET DESTINATION ENDIF IFNB <FROM> LEA SI,FROM ; SET SOURCE ENDIF CALL MOVZ$ ENDM ; SCAN MACRO TO,LEN,VALUE,TYPE IFNB <TO> LEA DI,TO ; SET DESTINATION ENDIF IFNB <LEN> MOV CX,LEN ; SET LENGTH ENDIF IFNB <VALUE> MOV AL,VALUE ; SET SOURCE ENDIF IFB <TYPE> REPZ SCASB ENDIF IFIDN <TYPE>,<EQ> REPZ SCASB ENDIF IFIDN <TYPE>,<Z> REPZ SCASB ENDIF IFIDN <TYPE>,<NE> REPNZ SCASB ENDIF IFIDN <TYPE>,<NZ> REPNZ SCASB ENDIF ENDM ; FILL MACRO TO,LEN,VALUE PUSH DI PUSH CX IFNB <TO> LEA DI,TO ; SET DESTINATION ENDIF IFNB <LEN> MOV CX,LEN ; SET LENGTH ENDIF IFNB <VALUE> MOV AL,VALUE ; SET SOURCE ENDIF REP STOS BYTE PTR[DI] POP CX POP DI ENDM ; COMP MACRO TO,LEN,FROM IFNB <TO> LEA DI,TO ; SET DESTINATION ENDIF IFNB <LEN> MOV CX,LEN ; SET LENGTH ENDIF IFNB <FROM> LEA SI,FROM ; SET SOURCE ENDIF REPE CMPS BYTE PTR[DI],BYTE PTR[SI] ENDM COMPZ MACRO TO,FROM IFNB <TO> LEA DI,TO ; SET DESTINATION ENDIF IFNB <FROM> LEA SI,FROM ; SET SOURCE ENDIF CALL CMPZ$ ENDM ; XCHGS MACRO O1,O2 PUSH O1 PUSH O2 POP O1 POP O2 ENDM ; JUMP MACRO COND,TARGET LOCAL LAB IFB <COND> JMP TARGET ENDIF IFIDN <COND>,<A> JNA LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NBE> JBE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<AE> JNAE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NB> JB LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<B> JNB LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NAE> JAE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<C> JNC LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<BE> JNBE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NA> JA LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<CXZ> OR CX,CX JNZ LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<E> JNE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<Z> JNZ LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<G> JNG LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NLE> JLE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<GE> JNGE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NL> JL LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<L> JNL LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NGE> JGE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<LE> JNLE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NG> JG LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NC> JC LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NE> JE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NZ> JZ LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NO> JO LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NP> JP LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<PO> JPE LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<NS> JS LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<O> JNO LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<P> JNP LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<PE> JPO LAB JMP TARGET LAB: ENDIF IFIDN <COND>,<S> JNS LAB JMP TARGET LAB: ENDIF ENDM ;
|