home *** CD-ROM | disk | FTP | other *** search
- ;
- ; SYSLIB Module Name: SCOMP
- ; Author: Richard Conn
- ; SYSLIB Version Number: 2.0
- ; Module Version Number: 1.0
- ; Module Entry Points:
- ; COMPB COMPBC
- ; Module External References:
- ; None
- ;
-
- ;
- ; SCOMP --
- ; Vector Compare Routine. Compare vector pointed to by HL with that
- ; pointed to by DE. Vector is B bytes long for COMPB and BC bytes long for
- ; COMPBC. On exit, Zero Flag Set indicates match, Carry Flag Set indicates
- ; that vector pointed to by HL is binarily less than vector pointed to by DE.
- ; PSW is affected. HL, DE, BC are not affected.
- ;
-
- COMPB::
- PUSH B ; SAVE BC
- MOV C,B ; SET COUNT IN C
- MVI B,0
- CALL COMPBC ; USE BC FOR COUNT
- POP B ; RESTORE BC
- RET
-
- COMPBC::
- PUSH H ; SAVE REGISTERS
- PUSH D
- PUSH B
-
- ; COMPARE LOOP
- COMP:
- LDAX D ; GET BYTE PTED TO BY DE
- CMP M ; COMPARE TO BYTE PTED TO BY HL
- JNZ COMPDN ; DONE IF NO MATCH
- INX H ; PT TO NEXT
- INX D
- DCX B ; COUNT DOWN
- MOV A,B ; DONE?
- ORA C
- JNZ COMP
-
- ; DONE WITH COMPARE; Z=>MATCH, C=>(HL)>(DE)
- COMPDN:
- JZ CMPDN ; DON'T COMPLEMENT CARRY IF ZERO SET
- CMC ; C=>(HL)<(DE)
- CMPDN:
- POP B ; RESTORE REGISTERS
- POP D
- POP H
- RET
-
- END
-