; ; SYSTEM MACROS ; ; DISPLAY TEXT ON SCREEN ; DISP MACRO TEXT,SEGM IFNB IFDIF , PUSH DS MOV AX,SEGM MOV DS,AX ENDIF ENDIF IFNB LEA DX,TEXT ENDIF DOS DSTR IFNB IFDIF , POP DS ENDIF ENDIF ENDM ; DMSG MACRO MSG IFNB LEA DX,MSG ENDIF DISP ENDM ; DCHAR MACRO CHAR PUSH DX IFNB 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 MOV DX,ROW*256+COL ; SET ROW AND COLUMN ENDIF IFNB 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 LABEL BYTE ; DEFINE ESSAGE ENDIF IFNB DB T1 ENDIF IFNB DB T2 ENDIF IFNB DB T3 ENDIF IFNB DB T4 ENDIF IFNB DB T5 ENDIF IFNB DB T6 ENDIF IFNB DB T7 ENDIF IFNB DB T8 ENDIF IFNB DB T9 ENDIF IFNB DB T10 ENDIF DB '$' ENDM ; MOVE MACRO TO,LEN,FROM IFNB LEA DI,TO ; SET DESTINATION ENDIF IFNB MOV CX,LEN ; SET LENGTH ENDIF IFNB LEA SI,FROM ; SET SOURCE ENDIF REP MOVS BYTE PTR[DI],BYTE PTR[SI] ENDM MOVEZ MACRO TO,FROM IFNB LEA DI,TO ; SET DESTINATION ENDIF IFNB LEA SI,FROM ; SET SOURCE ENDIF CALL MOVZ$ ENDM ; SCAN MACRO TO,LEN,VALUE,TYPE IFNB LEA DI,TO ; SET DESTINATION ENDIF IFNB MOV CX,LEN ; SET LENGTH ENDIF IFNB MOV AL,VALUE ; SET SOURCE ENDIF IFB REPZ SCASB ENDIF IFIDN , REPZ SCASB ENDIF IFIDN , REPZ SCASB ENDIF IFIDN , REPNZ SCASB ENDIF IFIDN , REPNZ SCASB ENDIF ENDM ; FILL MACRO TO,LEN,VALUE PUSH DI PUSH CX IFNB LEA DI,TO ; SET DESTINATION ENDIF IFNB MOV CX,LEN ; SET LENGTH ENDIF IFNB MOV AL,VALUE ; SET SOURCE ENDIF REP STOS BYTE PTR[DI] POP CX POP DI ENDM ; COMP MACRO TO,LEN,FROM IFNB LEA DI,TO ; SET DESTINATION ENDIF IFNB MOV CX,LEN ; SET LENGTH ENDIF IFNB LEA SI,FROM ; SET SOURCE ENDIF REPE CMPS BYTE PTR[DI],BYTE PTR[SI] ENDM COMPZ MACRO TO,FROM IFNB LEA DI,TO ; SET DESTINATION ENDIF IFNB 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 JMP TARGET ENDIF IFIDN , JNA LAB JMP TARGET LAB: ENDIF IFIDN , JBE LAB JMP TARGET LAB: ENDIF IFIDN , JNAE LAB JMP TARGET LAB: ENDIF IFIDN , JB LAB JMP TARGET LAB: ENDIF IFIDN , JNB LAB JMP TARGET LAB: ENDIF IFIDN , JAE LAB JMP TARGET LAB: ENDIF IFIDN , JNC LAB JMP TARGET LAB: ENDIF IFIDN , JNBE LAB JMP TARGET LAB: ENDIF IFIDN , JA LAB JMP TARGET LAB: ENDIF IFIDN , OR CX,CX JNZ LAB JMP TARGET LAB: ENDIF IFIDN , JNE LAB JMP TARGET LAB: ENDIF IFIDN , JNZ LAB JMP TARGET LAB: ENDIF IFIDN , JNG LAB JMP TARGET LAB: ENDIF IFIDN , JLE LAB JMP TARGET LAB: ENDIF IFIDN , JNGE LAB JMP TARGET LAB: ENDIF IFIDN , JL LAB JMP TARGET LAB: ENDIF IFIDN , JNL LAB JMP TARGET LAB: ENDIF IFIDN , JGE LAB JMP TARGET LAB: ENDIF IFIDN , JNLE LAB JMP TARGET LAB: ENDIF IFIDN , JG LAB JMP TARGET LAB: ENDIF IFIDN , JC LAB JMP TARGET LAB: ENDIF IFIDN , JE LAB JMP TARGET LAB: ENDIF IFIDN , JZ LAB JMP TARGET LAB: ENDIF IFIDN , JO LAB JMP TARGET LAB: ENDIF IFIDN , JP LAB JMP TARGET LAB: ENDIF IFIDN , JPE LAB JMP TARGET LAB: ENDIF IFIDN , JS LAB JMP TARGET LAB: ENDIF IFIDN , JNO LAB JMP TARGET LAB: ENDIF IFIDN ,

JNP LAB JMP TARGET LAB: ENDIF IFIDN , JPO LAB JMP TARGET LAB: ENDIF IFIDN , JNS LAB JMP TARGET LAB: ENDIF ENDM ;