; TITLE "SCOMPBC - Syslib 4.0" NAME ('COMPBC') ;=============================================================== ; Author : Harold F. Bower ; Derived from SCOMP.Z80 Ver 1.1 by Richard Conn ; Date : 17 Sep 89 ; Version : 1.2 ; Module : SCOMPBC ; Abstract: This module contains the vector compare routine ; COMPBC which compares two arrays of up to 65536 characters ; for equality. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC COMPBC .Z80 CSEG ;=============================================================== ; NAME - COMPBC ; Entry: HL - Addresses one Array ; DE - Addresses the second array ; BC - Number of characters to compare ; Exit : F - Zero Set (Z) = Match, Carry Set (C) = (HL) < (DE) ; Uses : AF ; Special Requirements: None ;=============================================================== COMPBC: PUSH HL ; Save registers PUSH DE PUSH BC ; Compare Loop COMP: LD A,(DE) ; Get Byte pted to by DE CPI ; Compare to byte pted to by HL JR NZ,COMPDN ; Done if no match INC DE JP PE,COMP ; Loop if count not zero ; Done with Compare; Z => Match, C => (HL) > (DE) COMPDN: JR Z,CMPDN ; Don't complement carry if Zero set DEC HL CP (HL) CCF ; C => (HL) < (DE) CMPDN: POP BC ; Restore registers POP DE POP HL RET END