; MACRO LIBRARY FOR 8-BIT COMPARISON OPERATION ; TEST? MACRO X,Y ;; UTILTITY MACRO TO GENERATE CONDITION CODES IF NOT NUL X ;;THEN LOAD X LDA X ;;X ASSUMED TO BE IN MEMORY ENDIF IRPC ?Y,Y ;;Y MAY BE CONSTANT OPERAND TDIG? SET '&?Y'-'0' ;;FIRST CHAR DIGIT? EXITM ;;STOP IRPC AFTER FIRST CHAR ENDM IF TDIG? <= 9 ;;Y NUMERIC? SUI Y ;;YES, SO SUB IMMEDIATE ELSE LXI H,Y ;;Y NOT NUMERIC SUB M ;;SO SUB FROM MEMORY ENDM ; LSS MACRO X,Y,TL,FL ;; X LSS THAN Y TEST, ;; IF TL IS PRESENT, ASSUME TRUE TEST ;; IF TL IS ABSENT, THEN INVERT TEST IF NUL TL GEQ X,Y,FL ELSE TEST? X,Y ;;SET CONDITION CODES JC TL ENDM ; LEQ MACRO X,Y,TL,FL ;; X LESS THAN OR EQUAL TO Y TEST IF NUL TL GTR X,Y,FL ELSE LSS X,Y,TL JZ TL ENDM ; EQL MACRO X,Y,TL,FL ;; X EQUAL TO Y TEST IF NUL TL NEQ X,Y,FL ELSE TEST? X,Y JZ TL ENDM ; NEQ MACRO X,Y,TL,FL ;; X NOT EQUAL TO Y TEST IF NUL TL EQL X,Y,FL ELSE TEST? X,Y JNZ TL ENDM ; GEQ MACRO X,Y,TL,FL ;; X GREATER THAN OR EQUAL TO Y TEST IF NUL TL LSS X,Y,FL ELSE TEST? X,Y JNC TL ENDM ; GTR MACRO X,Y,TL,FL ;; X GREATER THAN Y TEST IF NUL TL LEQ X,Y,FL ELSE LOCAL GFL ;;FALSE LABEL TEST? X,Y JC GFL DCR A JNC TL GFL: ENDM